fix: 工具广场统一18000端口 + 去除电量限制 + bot头像更新

nginx反代(tools-nginx.conf):
- 10个工具统一通过18000端口路径分发
- 解决/static/冲突(Lama精确匹配,其余给LibreTranslate)
- 解决/api/冲突(PDF用sub_filter改为/pdf-api/,/api/给imgcompress)
- Overleaf兜底处理所有未匹配的绝对路径
- 前端工具卡片统一走18000端口+路径

后端:
- 去除对话电量限制(validateUser中的num扣减逻辑)

前端:
- bot头像更新为战知logo(蓝底白字)
- LaTeX公式编辑器"复制为图片"改为"下载为图片"(解决跨域问题)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-15 19:28:23 +08:00
parent 00a50858f8
commit 570c0f3d61
5 changed files with 171 additions and 36 deletions

133
scripts/tools-nginx.conf Normal file
View File

@@ -0,0 +1,133 @@
server {
listen 18000;
client_max_body_size 500M;
# 1. Stirling PDF
location /pdf/ {
proxy_pass http://127.0.0.1:18080/;
proxy_set_header Host $host;
proxy_set_header Accept-Encoding "";
proxy_buffering off;
sub_filter_once off;
sub_filter '"/api/' '"/pdf-api/';
}
location /pdf-api/ {
proxy_pass http://127.0.0.1:18080/api/;
proxy_set_header Host $host;
proxy_buffering off;
client_max_body_size 500M;
}
# 2. Excalidraw
location /draw/ {
proxy_pass http://127.0.0.1:18081/;
proxy_set_header Host $host;
}
location /assets/ { proxy_pass http://127.0.0.1:18081/assets/; }
location /v1/ai/ {
proxy_pass http://127.0.0.1:18082/v1/ai/;
proxy_set_header Host $host;
proxy_read_timeout 60s;
proxy_buffering off;
}
# 3. TrWebOCR
location /ocr/ {
proxy_pass http://127.0.0.1:18083/;
proxy_set_header Host $host;
proxy_buffering off;
}
# 4. LibreTranslate
location /translate/ {
proxy_pass http://127.0.0.1:18084/;
proxy_set_header Host $host;
}
# 5. PPTist
location /ppt/ {
proxy_pass http://127.0.0.1:18085/;
proxy_set_header Host $host;
proxy_buffering off;
}
location /pptapi/ {
proxy_pass http://127.0.0.1:18086/;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_cache off;
}
# 6. imgcompress
location /imgcompress/ {
proxy_pass http://127.0.0.1:18087/;
proxy_set_header Host $host;
}
# 7. Lama Cleaner
location /lama/ {
proxy_pass http://127.0.0.1:18088/;
proxy_set_header Host $host;
proxy_buffering off;
}
location /lama/inpaint {
proxy_pass http://127.0.0.1:18088/inpaint;
proxy_set_header Host $host;
proxy_buffering off;
proxy_read_timeout 300s;
client_max_body_size 500M;
}
# Lama Cleaner 的2个精确static文件
location /static/js/main.1bd455bc.js { proxy_pass http://127.0.0.1:18088/static/js/main.1bd455bc.js; }
location /static/css/main.c28d98ca.css { proxy_pass http://127.0.0.1:18088/static/css/main.c28d98ca.css; }
# /static/ 其余的给 LibreTranslate
location /static/ { proxy_pass http://127.0.0.1:18084/static/; }
# LibreTranslate 绝对路径 API
location /languages { proxy_pass http://127.0.0.1:18084/languages; }
location /frontend/settings { proxy_pass http://127.0.0.1:18084/frontend/settings; }
location /detect { proxy_pass http://127.0.0.1:18084/detect; }
# imgcompress 绝对路径
location /_next/ { proxy_pass http://127.0.0.1:18087/_next/; }
location /api/ {
proxy_pass http://127.0.0.1:18087/api/;
proxy_set_header Host $host;
proxy_buffering off;
client_max_body_size 500M;
}
# 8. webp2jpg
location /webp2jpg/ {
proxy_pass http://127.0.0.1:18089/;
proxy_set_header Host $host;
}
location /cdn/ { proxy_pass http://127.0.0.1:18089/cdn/; }
# 9. Overleaf
location /overleaf/ {
proxy_pass http://127.0.0.1:18090/;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
}
# 10. LaTeX 公式编辑器
location /latex/ {
proxy_pass http://127.0.0.1:18091/;
proxy_set_header Host $host;
}
# 默认回落到 Overleaf
location / {
proxy_pass http://127.0.0.1:18090;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
}
}