https://hostloc.com/thread-1091860-1-2.html 看到MJJ求此款图床源码
打开发现是反代Telegraph图床,是的,事情简单了,顺手就扒了!
直接反代Telegraph造成图片内容不可控,想到star的Teleimg这款也是同类型程序
使用Sqlite建立数据库筛选所有从本站上传的图片,非本站上传直接返回指定图片
简单整合了一下,没剔除多余文件,养成习惯了,能用就好!
搭建环境需要PHP7.4,不然会报错
演示:https://dwz.ge/Mjpwe
下载:https://dwz.ge/xOadP
Nginx伪静态
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
location /file/ {
log_not_found off;
expires 30d;
rewrite ^(.*)$ /index.php$1 last;
}
location /assets/ {
etag on;
gzip on;
log_not_found off;
expires 1d;
}
location ~* \.(db)$ {
deny all;
}
宝塔为例,网站配置文件添加反代
location /upload {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
if ($request_method = 'OPTIONS') {
return 204;}
proxy_pass https://telegra.ph/upload;
}
location /file {
proxy_pass https://telegra.ph/file;
}
client_max_body_size 5m;
THE END