feat: Add cloud storage integration and visitor mode settings
This commit is contained in:
@@ -35,6 +35,10 @@
|
||||
- `POST /api/videos/:id/view` - Increment view count
|
||||
- `PUT /api/videos/:id/progress` - Update playback progress
|
||||
- Body: `{ progress: number }` (seconds)
|
||||
- `GET /api/videos/author-channel-url` - Get author channel URL for a video
|
||||
- Query params: `sourceUrl` (required)
|
||||
- Returns: `{ success: boolean, channelUrl: string | null }`
|
||||
- Checks database first, then fetches from YouTube/Bilibili API if not found
|
||||
|
||||
## Download Management
|
||||
|
||||
@@ -69,6 +73,7 @@
|
||||
- `GET /api/settings` - Get application settings
|
||||
- `POST /api/settings` - Update application settings
|
||||
- Body: `{ [key: string]: any }` - Settings object
|
||||
- Supports: `visitorMode`, `cloudDriveEnabled`, `openListApiUrl`, `openListToken`, `openListPublicUrl`, `cloudDrivePath`, and other settings
|
||||
- `GET /api/settings/password-enabled` - Check if password protection is enabled
|
||||
- `POST /api/settings/verify-password` - Verify login password
|
||||
- Body: `{ password: string }`
|
||||
@@ -81,8 +86,20 @@
|
||||
- Multipart form data: `file` (cookies.txt)
|
||||
- `POST /api/settings/delete-cookies` - Delete cookies.txt
|
||||
- `GET /api/settings/check-cookies` - Check if cookies.txt exists
|
||||
- `GET /api/settings/export-database` - Export database as backup file
|
||||
- `POST /api/settings/import-database` - Import database from backup file
|
||||
- Multipart form data: `file` (database backup file)
|
||||
- `GET /api/settings/last-backup-info` - Get information about the last database backup
|
||||
- `POST /api/settings/restore-from-last-backup` - Restore database from the last backup
|
||||
- `POST /api/settings/cleanup-backup-databases` - Clean up old backup database files
|
||||
|
||||
## File Management
|
||||
|
||||
- `POST /api/scan-files` - Scan for existing video files in uploads directory
|
||||
- `POST /api/cleanup-temp-files` - Cleanup temporary download files
|
||||
|
||||
## Cloud Storage
|
||||
|
||||
- `GET /cloud/videos/:filename` - Proxy endpoint to stream videos from cloud storage (OpenList/Alist)
|
||||
- `GET /cloud/images/:filename` - Proxy endpoint to serve images from cloud storage (OpenList/Alist)
|
||||
- Note: These endpoints require cloud storage to be configured in settings
|
||||
|
||||
@@ -28,7 +28,9 @@ mytube/
|
||||
│ │ ├── errors/ # Custom error classes
|
||||
│ │ │ └── DownloadErrors.ts
|
||||
│ │ ├── middleware/ # Express middleware
|
||||
│ │ │ └── errorHandler.ts # Error handling middleware
|
||||
│ │ │ ├── errorHandler.ts # Error handling middleware
|
||||
│ │ │ ├── visitorModeMiddleware.ts # Visitor mode (read-only) middleware
|
||||
│ │ │ └── visitorModeSettingsMiddleware.ts # Visitor mode settings middleware
|
||||
│ │ ├── routes/ # API route definitions
|
||||
│ │ │ ├── api.ts # Main API routes
|
||||
│ │ │ └── settingsRoutes.ts # Settings-specific routes
|
||||
|
||||
@@ -172,7 +172,25 @@ npm run test # Run tests with Vitest
|
||||
- Go to Settings → Cookie Settings
|
||||
- Upload your `cookies.txt` file
|
||||
|
||||
5. **Start Downloading**:
|
||||
5. **Configure Cloud Storage** (Optional):
|
||||
|
||||
- Go to Settings → Cloud Drive Settings
|
||||
- Enable "Enable Auto Save to Cloud"
|
||||
- Enter your OpenList/Alist API URL (e.g., `https://your-alist-instance.com/api/fs/put`)
|
||||
- Enter your API token
|
||||
- Optionally set a public URL for direct file access
|
||||
- Set the upload path (e.g., `/mytube-uploads`)
|
||||
- Test the connection to verify settings
|
||||
- Note: When enabled, videos will be automatically uploaded to cloud storage after download, and local files will be deleted
|
||||
|
||||
6. **Configure Visitor Mode** (Optional):
|
||||
|
||||
- Go to Settings → General Settings
|
||||
- Enable "Visitor Mode (Read-only)" to allow viewing videos without modification capabilities
|
||||
- When enabled, all write operations (downloads, deletions, edits) are blocked
|
||||
- To disable visitor mode, you'll need to enter the website password
|
||||
|
||||
7. **Start Downloading**:
|
||||
- Enter a video URL in the download input
|
||||
- Supported platforms: YouTube, Bilibili, MissAV, and all yt-dlp supported sites
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
- `POST /api/videos/:id/view` - 增加观看次数
|
||||
- `PUT /api/videos/:id/progress` - 更新播放进度
|
||||
- 请求体: `{ progress: number }` (秒)
|
||||
- `GET /api/videos/author-channel-url` - 获取视频的作者频道 URL
|
||||
- 查询参数: `sourceUrl` (必需)
|
||||
- 返回: `{ success: boolean, channelUrl: string | null }`
|
||||
- 首先检查数据库,如果未找到则从 YouTube/Bilibili API 获取
|
||||
|
||||
## 下载管理
|
||||
- `POST /api/downloads/cancel/:id` - 取消活动下载
|
||||
@@ -63,6 +67,7 @@
|
||||
- `GET /api/settings` - 获取应用设置
|
||||
- `POST /api/settings` - 更新应用设置
|
||||
- 请求体: `{ [key: string]: any }` - 设置对象
|
||||
- 支持: `visitorMode`, `cloudDriveEnabled`, `openListApiUrl`, `openListToken`, `openListPublicUrl`, `cloudDrivePath` 等设置
|
||||
- `GET /api/settings/password-enabled` - 检查是否启用了密码保护
|
||||
- `POST /api/settings/verify-password` - 验证登录密码
|
||||
- 请求体: `{ password: string }`
|
||||
@@ -75,7 +80,18 @@
|
||||
- 多部分表单数据: `file` (cookies.txt)
|
||||
- `POST /api/settings/delete-cookies` - 删除 cookies.txt
|
||||
- `GET /api/settings/check-cookies` - 检查 cookies.txt 是否存在
|
||||
- `GET /api/settings/export-database` - 导出数据库作为备份文件
|
||||
- `POST /api/settings/import-database` - 从备份文件导入数据库
|
||||
- 多部分表单数据: `file` (数据库备份文件)
|
||||
- `GET /api/settings/last-backup-info` - 获取最后一个数据库备份的信息
|
||||
- `POST /api/settings/restore-from-last-backup` - 从最后一个备份恢复数据库
|
||||
- `POST /api/settings/cleanup-backup-databases` - 清理旧的备份数据库文件
|
||||
|
||||
## 文件管理
|
||||
- `POST /api/scan-files` - 扫描上传目录中的现有视频文件
|
||||
- `POST /api/cleanup-temp-files` - 清理临时下载文件
|
||||
|
||||
## 云存储
|
||||
- `GET /cloud/videos/:filename` - 代理端点,用于从云存储(OpenList/Alist)流式传输视频
|
||||
- `GET /cloud/images/:filename` - 代理端点,用于从云存储(OpenList/Alist)提供图像
|
||||
- 注意:这些端点需要在设置中配置云存储
|
||||
|
||||
@@ -28,7 +28,9 @@ mytube/
|
||||
│ │ ├── errors/ # 自定义错误类
|
||||
│ │ │ └── DownloadErrors.ts
|
||||
│ │ ├── middleware/ # Express 中间件
|
||||
│ │ │ └── errorHandler.ts # 错误处理中间件
|
||||
│ │ │ ├── errorHandler.ts # 错误处理中间件
|
||||
│ │ │ ├── visitorModeMiddleware.ts # 访客模式(只读)中间件
|
||||
│ │ │ └── visitorModeSettingsMiddleware.ts # 访客模式设置中间件
|
||||
│ │ ├── routes/ # API 路由定义
|
||||
│ │ │ ├── api.ts # 主 API 路由
|
||||
│ │ │ └── settingsRoutes.ts # 设置相关路由
|
||||
|
||||
@@ -172,7 +172,25 @@ npm run test # 使用 Vitest 运行测试
|
||||
- 转到设置 → Cookie 设置
|
||||
- 上传您的 `cookies.txt` 文件
|
||||
|
||||
5. **开始下载**:
|
||||
5. **配置云存储** (可选):
|
||||
|
||||
- 转到设置 → 云盘设置
|
||||
- 启用"启用自动保存到云盘"
|
||||
- 输入您的 OpenList/Alist API URL (例如: `https://your-alist-instance.com/api/fs/put`)
|
||||
- 输入您的 API 令牌
|
||||
- 可选:设置用于直接文件访问的公共 URL
|
||||
- 设置上传路径 (例如: `/mytube-uploads`)
|
||||
- 测试连接以验证设置
|
||||
- 注意:启用后,视频将在下载后自动上传到云存储,本地文件将被删除
|
||||
|
||||
6. **配置访客模式** (可选):
|
||||
|
||||
- 转到设置 → 常规设置
|
||||
- 启用"访客模式(只读)"以允许查看视频但无法进行修改
|
||||
- 启用后,所有写入操作(下载、删除、编辑)将被阻止
|
||||
- 要禁用访客模式,您需要输入网站密码
|
||||
|
||||
7. **开始下载**:
|
||||
- 在下载输入框中输入视频 URL
|
||||
- 支持的平台: YouTube, Bilibili, MissAV 以及所有 yt-dlp 支持的网站
|
||||
|
||||
|
||||
Reference in New Issue
Block a user