- 素材导入三选一:图片 / Word·PDF 文档(新 sourceImport.ts 解析正文与内嵌配图)/ 输入网址(抓取正文与配图)
- AI出片卡片新增提示「只需纯文本模型即可使用;模型支持多模态(视觉)就能自动生成出片」,四步说明第2步改为「AI 自动写口播文案,每段配好对应画面」
- /grab/ 反代改 X-Grab-Url 头传参:修复 encodeURIComponent 产物被 $arg_ 不解码误杀400、裸域名路径错位两个bug;SSRF防护(回环/内网/file/带凭据403、缺头400)保留
- 断网lint门禁 external_refs 20→0:PDF.js命名空间、example.com示例域名、${A}截断产物、ai/nav.88531.cn 自有域名登记白名单
- README/CHANGELOG 已同步本次更新
169 lines
7.2 KiB
Nginx Configuration File
169 lines
7.2 KiB
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name _;
|
||
|
||
# 本端口(host 3006)供 NPS 隧道(cut.88531.cn)以「明文 HTTP」接入:
|
||
# NPS 在服务端终结 TLS 后向目标转发明文,故这里绝不能再 301 跳 https
|
||
# (否则隧道侧无限重定向)。改为内部回环代理到本容器的 443,
|
||
# 复用下面 443 server 块的全部站点/AI/CDN 反代逻辑,无需重复配置。
|
||
# 浏览器侧地址仍是 https://cut.88531.cn(由 NPS 服务端提供 TLS),
|
||
# 因此 File System Access API 的「安全上下文」要求依然满足。
|
||
location / {
|
||
proxy_pass https://127.0.0.1:443;
|
||
proxy_ssl_server_name on;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto https;
|
||
proxy_read_timeout 300s;
|
||
proxy_send_timeout 300s;
|
||
client_max_body_size 2048m;
|
||
}
|
||
}
|
||
|
||
server {
|
||
listen 443 ssl;
|
||
http2 on;
|
||
server_name _;
|
||
|
||
ssl_certificate /etc/nginx/certs/server.crt;
|
||
ssl_certificate_key /etc/nginx/certs/server.key;
|
||
ssl_protocols TLSv1.2 TLSv1.3;
|
||
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
gzip on;
|
||
gzip_types text/plain text/css application/json application/javascript image/svg+xml;
|
||
|
||
# SPA 路由回退
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
# 长缓存带 hash 的构建产物
|
||
location /homeAssets/ {
|
||
expires 30d;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
|
||
|
||
|
||
# 公网部署不内置 AI 通道:/civideo、/omniai 反代已移除(AI 生图/生视频改由
|
||
# 用户在「AI 设置」填自己的网关地址直连,服务端不再注入任何模型密钥)。
|
||
|
||
# 官方素材 CDN(模板工程 JSON、模板缩略图)同源反代:
|
||
# 浏览器只请求 https://<站点>/cdn/**,不再直连 cdn.h5ds.com;
|
||
# 断网时该目录自然取不到(模板面板本就是联网能力),本机模板 /templates/** 不受影响。
|
||
location /cdn/ {
|
||
proxy_pass https://cdn.h5ds.com/;
|
||
proxy_ssl_server_name on;
|
||
proxy_set_header Host cdn.h5ds.com;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_read_timeout 300s;
|
||
client_max_body_size 2048m;
|
||
}
|
||
|
||
# 兜底:官方素材的同源相对路径(/video/… 与 /video_business/…)直接转发到 CDN。
|
||
#
|
||
# 为什么需要它 —— 模板列表接口返回的是相对路径,正常应由前端改写到 /cdn/;
|
||
# 一旦改写逻辑丢失或被人改坏,这些路径会落到下面的 try_files 兜底,
|
||
# 返回 200 text/html 的 SPA 首页,<img> 拿到 HTML 当然裂图,而且「200 + 裂图」
|
||
# 极难排查(看着不像出错)。在这里直接转发到 CDN,既修好这一类问题,
|
||
# 也让返回内容始终保持为真实图片。
|
||
location ~ ^/(video|video_business)/ {
|
||
proxy_pass https://cdn.h5ds.com/$uri;
|
||
proxy_ssl_server_name on;
|
||
proxy_set_header Host cdn.h5ds.com;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_read_timeout 300s;
|
||
client_max_body_size 2048m;
|
||
}
|
||
|
||
# 授权中心(CardAuth,auth.88531.cn)同源反代:安装统计 / 在线人数 / 公告 / 版本推送。
|
||
# 项目密钥 X-Api-Key 由 entrypoint.sh 在容器启动时注入,前端包与浏览器都不出现;
|
||
# 前端只请求同源 /hub/**,因此不存在跨域、也无需 CORS。密钥缺失时接口会失败,
|
||
# 前端按「无数据」安静降级(不弹错、不影响剪辑)。
|
||
location /hub/ {
|
||
proxy_pass https://auth.88531.cn/api/public/;
|
||
proxy_ssl_server_name on;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Host auth.88531.cn;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Api-Key "__HUB_KEY__";
|
||
proxy_read_timeout 30s;
|
||
proxy_send_timeout 30s;
|
||
client_max_body_size 1m;
|
||
}
|
||
|
||
# 网址抓取(AI 一键出片「输入网址」):同源动态反代任意公网 URL。
|
||
# 浏览器只请求 /grab/,避开跨域限制;只放行 http/https,
|
||
# 并拒绝回环/内网/链路本地地址,防止被当成跳板打内网服务。
|
||
# 目标放 X-Grab-Url 头里:query 传参要 percent-编码,而 nginx $arg_ 不做解码,
|
||
# 会把 encodeURIComponent 过的合法目标误杀成 400(实测)。3xx 原样透传给前端,
|
||
# 由 redirect:manual 逐跳重进 /grab/(每跳重新过一遍下面的断言)。
|
||
location = /grab/ {
|
||
resolver 223.5.5.5 119.29.29.29 valid=30s ipv6=off;
|
||
if ($http_x_grab_url = '') { return 400; }
|
||
if ($http_x_grab_url !~* '^https?://') { return 400; }
|
||
if ($http_x_grab_url ~* '^https?://[^/?#]*@') { return 403; }
|
||
if ($http_x_grab_url ~* '^https?://(localhost|127\.|0\.0\.0\.0|10\.|192\.168\.|169\.254\.|172\.(1[6-9]|2[0-9]|3[01])\.|\[?::1)') { return 403; }
|
||
proxy_pass $http_x_grab_url;
|
||
proxy_ssl_server_name on;
|
||
proxy_set_header Host $proxy_host;
|
||
proxy_set_header Connection "";
|
||
proxy_set_header X-Grab-Url "";
|
||
proxy_http_version 1.1;
|
||
proxy_read_timeout 20s;
|
||
proxy_send_timeout 20s;
|
||
}
|
||
|
||
# 本机 LLM 网关(NewAPI,OpenAI 兼容 /v1)同源反代:
|
||
# 浏览器只请求 https://<站点>/newapi/v1/*,既避免 HTTPS 页面直连 HTTP 被拦(混合内容),
|
||
# 也保证站点在只有本机网络时可用。密钥仍留在服务端,前端不出现。
|
||
location /newapi/ {
|
||
proxy_pass http://192.168.68.19:3099/;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_read_timeout 300s;
|
||
proxy_send_timeout 300s;
|
||
client_max_body_size 20m;
|
||
}
|
||
|
||
# 本机语音合成服务(unicut-tts 容器),同源反代,避免 HTTPS 页面加载 HTTP 音频被拦
|
||
location /localtts/ {
|
||
proxy_pass http://unicut-tts:8000/;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_read_timeout 180s;
|
||
client_max_body_size 8m;
|
||
}
|
||
|
||
# UNICUT 在线服务反代(账号/素材/AI 等在线能力), 对应官方 dev server 的代理配置
|
||
location /api/ {
|
||
proxy_pass https://video.h5ds.com;
|
||
proxy_ssl_server_name on;
|
||
proxy_set_header Host video.h5ds.com;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto https;
|
||
proxy_read_timeout 300s;
|
||
client_max_body_size 2048m;
|
||
}
|
||
|
||
location /cgi-bin/ {
|
||
proxy_pass https://video.h5ds.com;
|
||
proxy_ssl_server_name on;
|
||
proxy_set_header Host video.h5ds.com;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto https;
|
||
proxy_read_timeout 300s;
|
||
client_max_body_size 2048m;
|
||
}
|
||
}
|