-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 新增多架構 Docker 建置、多種 BT 下載器整合與文檔更新 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
支援 linux/amd64 和 linux/arm64 平台的並行建置, 使用 GitHub Actions artifact 傳遞 digest 並合併為最終 multi-arch image。
- 新增 /webhook/on-complete 通用端點 - 將 QBittorrentPayload 更名為 DownloaderOnCompletePayload - 更新 API 文檔說明支援多種下載器
- 重寫 README 說明專案功能、Docker 部署和開發指南 - 新增 Transmission、Deluge、rTorrent、Aria2 整合腳本 - 修正 qBittorrent 腳本 JSON 格式錯誤並改用 curl -sS
Summary of ChangesHello @ThanatosDi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取請求旨在顯著擴展 Movera 專案的兼容性和易用性。核心變更包括引入對多種 CPU 架構的 Docker 映像支援,以及與多個主流 BT 下載器的深度整合。此外,API 端點經過重構以提供更通用的 webhook 處理能力,並透過全面更新的文檔,大幅提升了使用者和開發者的入門體驗。 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
您好,感謝您的貢獻!這次的 PR 內容很豐富,新增了多架構 Docker 建置、多種 BT 下載器整合,並重構了 API,整體方向很棒。我主要針對以下幾點提供一些回饋:
- 文件準確性:
README.md中的 Webhook URL 範例似乎不正確,這會導致使用者設定失敗。 - API 文件一致性:後端 API 的 docstring 與實際回應的資料格式有些微出入。
- Shell 腳本安全性:新增的下載器腳本在處理傳入參數時,手動拼接 JSON 字串存在安全風險,可能導致 JSON 格式錯誤或命令注入。
詳細的修改建議請參考各個檔案的 review comments。再次感謝您的努力!
| CATEGORY="" | ||
| TAGS="" | ||
|
|
||
| curl -sS -X POST "$URL" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATH 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。
建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq。
| CATEGORY="" | |
| TAGS="" | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" | |
| # Requires jq to be installed | |
| PAYLOAD=$(jq -c -n --arg filepath "$FILE_PATH" --arg category "" --arg tags "" '{filepath: $filepath, category: $category, tags: $tags}') | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" |
| FILE_PATH="${SAVE_PATH}/${TORRENT_NAME}" | ||
| CATEGORY="" | ||
| TAGS="" | ||
|
|
||
| curl -sS -X POST "$URL" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATH 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。
建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq。
| FILE_PATH="${SAVE_PATH}/${TORRENT_NAME}" | |
| CATEGORY="" | |
| TAGS="" | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" | |
| FILE_PATH="${SAVE_PATH}/${TORRENT_NAME}" | |
| # Requires jq to be installed | |
| PAYLOAD=$(jq -c -n --arg filepath "$FILE_PATH" --arg category "" --arg tags "" '{filepath: $filepath, category: $category, tags: $tags}') | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" |
| FILE_PATH="${TR_TORRENT_DIR}/${TR_TORRENT_NAME}" | ||
| CATEGORY="" | ||
| TAGS="${TR_TORRENT_LABELS:-}" | ||
|
|
||
| curl -sS -X POST "$URL" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATH 或 TAGS 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。
建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq。
| FILE_PATH="${TR_TORRENT_DIR}/${TR_TORRENT_NAME}" | |
| CATEGORY="" | |
| TAGS="${TR_TORRENT_LABELS:-}" | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" | |
| FILE_PATH="${TR_TORRENT_DIR}/${TR_TORRENT_NAME}" | |
| # Requires jq to be installed | |
| PAYLOAD=$(jq -c -n --arg filepath "$FILE_PATH" --arg category "" --arg tags "${TR_TORRENT_LABELS:-}" '{filepath: $filepath, category: $category, tags: $tags}') | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" |
| curl -sS -X POST "$URL" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATH, CATEGORY, 或 TAGS 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。
建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq。
另外,此檔案結尾缺少換行符,建議補上以符合 shell 腳本的最佳實踐。
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" | |
| # Requires jq to be installed | |
| PAYLOAD=$(jq -c -n --arg filepath "$FILE_PATH" --arg category "$CATEGORY" --arg tags "$TAGS" '{filepath: $filepath, category: $category, tags: $tags}') | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" |
| TAGS="" | ||
|
|
||
| curl -sS -X POST "$URL" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATH 或 CATEGORY 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。
建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq。
| TAGS="" | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" | |
| # Requires jq to be installed | |
| PAYLOAD=$(jq -c -n --arg filepath "$FILE_PATH" --arg category "$CATEGORY" --arg tags "" '{filepath: $filepath, category: $category, tags: $tags}') | |
| curl -sS -X POST "$URL" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" |
|
|
||
| 設定 → **下載** → **種子完成時執行外部程式**: | ||
| ```bash | ||
| /path/to/scripts/qBittorrent http://movera:8000/webhook/qbittorrent "%F" "%L" "%G" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件中的 Webhook URL 不正確。根據後端路由的變更,通用端點應為 http://movera:8000/webhook/on-complete。目前範例中使用的 http://movera:8000/webhook/qbittorrent 是一個不存在的路徑,會導致整合失敗。
請將此處以及其他所有下載器範例中的 URL 更新為正確的通用端點。
| /path/to/scripts/qBittorrent http://movera:8000/webhook/qbittorrent "%F" "%L" "%G" | |
| /path/to/scripts/qBittorrent http://movera:8000/webhook/on-complete "%F" "%L" "%G" |
| - `status`: always "success" | ||
| - `message`: "Webhook received and processing scheduled in the background." | ||
| - `content_path`: the content path of the downloaded torrent | ||
| - `code`: "200" for success, "500" for failure" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API 文件與實作不一致。文件說明 status 的值為 "success",但程式碼返回的是 "ok"。另外,文件說明 code 的值為字串 "200",但程式碼返回的是數字 200。
建議更新文件以符合實際的回應內容,確保 API 的使用者不會被誤導。
| - `status`: always "success" | |
| - `message`: "Webhook received and processing scheduled in the background." | |
| - `content_path`: the content path of the downloaded torrent | |
| - `code`: "200" for success, "500" for failure" | |
| - `status`: "ok" | |
| - `code`: 200 for success |
|
|
||
| class QBittorrentPayload(BaseModel): | ||
| class DownloaderOnCompletePayload(BaseModel): | ||
| """qBittorrent 'run external program' 的資料模型。""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
Changes
CI/CD
builder-merge.yaml支援 linux/amd64 和 linux/arm64 並行建置BT 下載器整合
scripts/Transmission- 支援 Transmission 環境變數scripts/Deluge- 支援 Execute 插件scripts/rTorrent- 支援.rtorrent.rc設定scripts/Aria2- 支援on-download-completehookscripts/qBittorrentJSON 格式錯誤API 重構
/webhook/on-complete通用端點QBittorrentPayload更名為DownloaderOnCompletePayload文檔