feat: 添加 OneDrive 存储支持

This commit is contained in:
2025-11-15 13:54:19 +08:00
parent 730ee20048
commit d0bd44c526
6 changed files with 764 additions and 31 deletions

View File

@@ -1,46 +1,75 @@
# 存储类型选择
## Done
# r2 | Cloudflare R2
# github | GitHub Repository
## TODO LIST:
# cnbcool | Tencent cnb.cool
# s3 | Amazon S3
# Microsoft Onedrive
# ==================== 存储类型选择 ====================
# 支持的存储类型 (Supported Storage Types):
# - r2: Cloudflare R2
# - github: GitHub Repository
# - onedrive: Microsoft OneDrive
STORAGE_TYPE=r2
# ==================== Cloudflare R2 配置 ====================
# R2 账户 ID
# 仅当 STORAGE_TYPE=r2 时需要配置
# R2 账户 ID (Cloudflare 账户 ID)
R2_ACCOUNT_ID=your-account-id
# R2 访问凭证
# R2 访问密钥 ID
R2_ACCESS_KEY_ID=YOUR_R2_ACCESS_KEY_ID
# R2 访问密钥密码
R2_SECRET_ACCESS_KEY=YOUR_R2_SECRET_ACCESS_KEY
# R2 存储桶名称
R2_BUCKET_NAME=drive
# R2 公共访问域名 (可选,例如: https://pub-<bucket-name>.r2.dev)
# R2 公共访问域名 (可选,用于生成公共 URL)
# 示例: https://pub-<bucket-name>.r2.dev
R2_PUBLIC_DOMAIN=https://pub-<bucket-name>.r2.dev
# ==================== GitHub 存储配置 ====================
# GitHub 仓库 (格式: owner/repo)
# 仅当 STORAGE_TYPE=github 时需要配置
# GitHub 仓库地址 (格式: owner/repo)
# 示例: RhenCloud/Cloud-Index
GITHUB_REPO=your-username/your-repo
# GitHub 访问令牌 (需要 repo 权限)
# 生成: https://github.com/settings/tokens
GITHUB_TOKEN=your-access-token
# GitHub 分支名称 (默认: main)
GITHUB_BRANCH=main
# ==================== Microsoft OneDrive 配置 ====================
# 仅当 STORAGE_TYPE=onedrive 时需要配置
# OneDrive 访问令牌
ONEDRIVE_REFRESH_TOKEN=your-refresh-token
ONEDRIVE_CLIENT_ID=your-client-id
ONEDRIVE_CLIENT_SECRET=your-client-secret
# OneDrive 文件夹 ID (可选,留空则使用根目录)
# 默认值: 使用 /me/drive/root (OneDrive 根目录)
# ONEDRIVE_FOLDER_ID=folder-item-id
# ==================== 应用配置 ====================
# 服务器配置
# 服务器监听地址
# 0.0.0.0: 监听所有网卡
# 127.0.0.1: 仅本地访问
HOST=0.0.0.0
# 服务器监听端口 (默认: 5000)
PORT=5000
# 调试模式 (true/false默认: false)
# 生产环境应设置为 false
DEBUG=false
# 缩略图缓存时间(秒,默认: 3600
# ==================== 缓存和 URL 配置 ====================
# 缩略图缓存时间 (秒,默认: 3600)
# 用于浏览器缓存缩略图,减少服务器负担
THUMB_TTL_SECONDS=3600
# 预签名 URL 过期时间秒,默认: 3600
# 预签名 URL 过期时间 (秒,默认: 3600)
# 用于生成临时访问链接3600 秒 = 1 小时
PRESIGNED_URL_EXPIRES=3600
THUMB_TTL_SECONDS=3600