Files
91/backend/config.example.yaml
nianzhibai 7e5e67697e feat: add GuangYaPan drive support
Implement a new GuangYaPan cloud drive integration across the backend, admin UI, playback proxy, and Spider91 migration flow.

Backend changes:\n- Add a GuangYaPan drive driver with token refresh, QR/device login support, directory listing, stream link resolution, directory creation, rename/delete operations, OSS multipart upload, and upload task polling.\n- Register GuangYaPan as a supported storage kind in configuration, catalog normalization, admin APIs, public drive labels, and 302 playback redirects.\n- Allow Spider91 crawler uploads to target GuangYaPan through a dedicated migration adapter.\n- Add scan, thumbnail, preview, and fingerprint cooldown handling for GuangYaPan based on explicit HTTP status codes, Retry-After values, and structured provider codes instead of natural-language message matching.\n- Tighten existing provider cooldown detectors so OneDrive, Google Drive, 115, PikPak, 123pan, Wopan, and media workers avoid treating arbitrary response text as a rate-limit signal.\n- Keep large videos eligible for preview generation unless the user disables preview generation.

Admin and tooling changes:\n- Add GuangYaPan as a selectable drive type with QR login UI and token/root-path credential fields.\n- Add crawler upload target support for GuangYaPan in the admin UI.\n- Add drive branding, labels, metadata display, and docs/config examples for GuangYaPan.\n- Include a standalone GuangYaPan QR login helper script for manual credential acquisition.

Tests:\n- Add GuangYaPan driver, QR login, proxy, admin API, crawler upload target, fingerprint, cooldown, and form coverage.\n- Update rate-limit tests to assert that message-only throttling text no longer starts cooldowns.\n- Cover explicit HTTP status parsing through shared drive helper tests.
2026-06-14 15:44:50 +08:00

100 lines
3.7 KiB
YAML

# backend 配置示例。首次启动若未发现 config.yaml,会基于此文件自动创建。
server:
# 本地开发默认配合 vite.config.ts 的代理端口。
listen: "127.0.0.1:9192"
# 管理后台用户。保留默认值时,首次访问登录页会要求设置新用户名和密码,
# 并写回 backend/config.yaml。
admin:
username: "admin"
password: "admin123"
# 用于签发 admin session cookie,生产请改成随机字符串
session_secret: "change-me-to-a-random-string"
# CORS 白名单:允许跨源访问的前端 Origin 列表。默认空 = 不允许任何跨源请求。
# 同源部署(前后端在同一域名 + 端口下,由 nginx 反代)不需要配此项。
# 仅在前后端分别部署在不同域名/端口、且需要前端 fetch 后端时填写。
# 不要写 "*";带 cookie 的 CORS 必须列具体 Origin。
# 示例:
# allowed_origins:
# - "https://video.example.com"
# - "http://127.0.0.1:9191"
allowed_origins: []
storage:
# SQLite 数据库文件路径
db_path: "./data/video-site.db"
# 本地预览视频和封面目录
local_preview_dir: "./data/previews"
scanner:
# 已废弃:旧版的"每天 02:00-07:00 按 IntervalSeconds 间隔重复扫盘"已被移除。
# 现在所有定时任务统一由 nightly 块控制(每天 01:00 跑一条完整流水线)。
# 字段保留仅为兼容旧 yaml,运行时被忽略。
interval_seconds: 0
# 单次扫描每家网盘目录递归层数上限
max_depth: 5
# 被扫描的扩展名
video_extensions: [".mp4", ".mkv", ".mov", ".webm", ".avi", ".strm"]
nightly:
# 凌晨流水线触发整点(0-23),默认 1 即每天 01:00。
# 运行时会统一编排扫描、媒体资产生成和后续清理任务。
cron_hour: 1
# 单次流水线总耗时上限(软超时);超过后当前 phase 跑完不启动后续 phase。
max_duration: 6h
preview:
# 是否启用 ffmpeg 抽帧生成预览视频
enabled: true
# ffmpeg / ffprobe 可执行文件名或绝对路径
ffmpeg_path: "ffmpeg"
ffprobe_path: "ffprobe"
# 预览视频每段时长(秒),实际生成时每段最多 3 秒
duration_seconds: 3
# 兼容旧配置;当前 30 秒以下最多 3 段,30 秒及以上固定 4 段
segments: 3
# 预览视频宽度
width: 480
# 盘列表。上线后请通过管理后台添加,本文件可留空。
# kind 支持 quark / p115 / p123 / pikpak / wopan / guangyapan / onedrive / googledrive / localstorage。
# OneDrive 示例:
# - id: "my-onedrive"
# kind: "onedrive"
# name: "我的 OneDrive"
# root_id: "root"
# params:
# refresh_token: "..."
# Google Drive 示例:
# - id: "my-google"
# kind: "googledrive"
# name: "我的 Google Drive"
# root_id: "root"
# params:
# refresh_token: "..."
# # 默认 use_online_api=true,会使用 OpenList 在线续期 API。
# # 如需使用自己创建的 Google OAuth 客户端,取消下面三行注释:
# # use_online_api: "false"
# # client_id: "..."
# # client_secret: "..."
# 光鸭网盘示例:
# - id: "my-guangyapan"
# kind: "guangyapan"
# name: "我的光鸭网盘"
# # 留空表示光鸭网盘根目录;也可以填写光鸭目录 fileId
# root_id: ""
# params:
# # 推荐在后台使用扫码登录自动写入 access_token / refresh_token。
# refresh_token: "..."
# # 可选:按路径解析扫描根目录,优先于 root_id
# # root_path: "影视/电影"
# 本地存储示例:
# - id: "local-media"
# kind: "localstorage"
# name: "本地视频目录"
# root_id: "/"
# params:
# # Docker 部署时这里和 .strm 里的绝对路径都必须使用容器内路径。
# # 例如宿主机 /mnt/videos 挂载为 /media,就填写 /media。
# path: "/mnt/videos"
drives: []