eb32fd5e22
外层仓库管理 webgui 源码、Docker 编排与项目文档;rclone 作为
git submodule 锁定在上游 master HEAD(59c86b01b),不携带任何
我们的改动。
- webgui/: webgui 源码(原本位于 rclone/cmd/webgui/)
- web/: 原生 HTML/CSS/JS 静态前端(Anthropic 设计语言)
- webgui.go: Go 子命令源码,仅当自行构建 rclone 二进制时需要
- rclone-cmd-all-add-webgui-import.patch: 把 webgui 注册进
rclone 的 cmd/all/all.go 的补丁,留作 fork 时使用
- rclone/: submodule → github.com/rclone/rclone,纯净不改动
- Dockerfile.webgui: 基于 nginx:1.27-alpine,从 ./webgui/web/
COPY 静态资源
- docker/nginx.conf: SPA 静态托管 + 反向代理 RC API
(/config/、/operations/、/sync/、/job/ 等) 与文件下载
(/<remote>:<path>) 到 rclone rcd 容器,前端同源访问无 CORS
- docker-compose.yml: rclone (官方镜像 + rcd --rc-no-auth
--rc-serve) + gui (nginx) 双服务编排,config 走 bind mount
持久化
- DESIGN.md / CLAUDE.md / README.md: 文档
- .gitignore / .dockerignore: 排除 rclone.conf 等敏感文件,
Docker 构建上下文只剩 webgui/web/ + nginx 配置(几十 KB)
67 lines
2.2 KiB
Nginx Configuration File
67 lines
2.2 KiB
Nginx Configuration File
# nginx config for the webgui frontend container.
|
|
#
|
|
# Two jobs:
|
|
# 1. Serve the SPA static bundle (HTML/CSS/JS) with SPA fallback.
|
|
# 2. Reverse-proxy RC API calls and remote-file downloads to the
|
|
# rclone rcd container on the compose network.
|
|
#
|
|
# Same-origin from the browser, so the frontend's fetch() calls hit
|
|
# this nginx and get forwarded to rclone — no CORS, no basic-auth
|
|
# popups, no embedded credentials in URLs.
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Uploads can be large; let rclone decide on size limits.
|
|
client_max_body_size 0;
|
|
|
|
# Light gzip for text assets.
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_types
|
|
text/plain
|
|
text/css
|
|
application/javascript
|
|
application/json
|
|
image/svg+xml;
|
|
|
|
# --- Static assets ---
|
|
# Anything that resolves to a real file is served from the bundle.
|
|
# Unknown paths fall through to index.html so client-side hash
|
|
# routing (#/remotes, #/browse/...) keeps working.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# --- RC API endpoints (POST JSON) ---
|
|
# rclone registers endpoints under well-known top-level prefixes.
|
|
# Match any of them and forward to rclone.
|
|
location ~ ^/(config|operations|sync|job|fs|rc|cache|vfs|subsystem|options|metrics)/ {
|
|
proxy_pass http://rclone:5572;
|
|
proxy_http_version 1.1;
|
|
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 $scheme;
|
|
proxy_request_buffering off;
|
|
}
|
|
|
|
# --- Remote file downloads (GET) ---
|
|
# rclone rcd with --rc-serve exposes remotes at /<remote>:<path>.
|
|
# The colon in the first path segment is the tell — static asset
|
|
# paths never have one.
|
|
location ~ ^/([^/]+): {
|
|
proxy_pass http://rclone:5572;
|
|
proxy_http_version 1.1;
|
|
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 $scheme;
|
|
}
|
|
}
|