Skip to content

Conversation

@ThanatosDi
Copy link
Owner

Summary

  • 新增 GitHub Actions 多架構 Docker image 建置 workflow (amd64/arm64)
  • 新增多種 BT 下載器整合腳本 (Transmission, Deluge, rTorrent, Aria2)
  • 重構 webhook API 支援通用下載器端點
  • 重寫 README 文檔

Changes

CI/CD

  • 新增 builder-merge.yaml 支援 linux/amd64 和 linux/arm64 並行建置
  • 使用 GitHub Actions artifact 傳遞 digest 並合併為 multi-arch image

BT 下載器整合

  • 新增 scripts/Transmission - 支援 Transmission 環境變數
  • 新增 scripts/Deluge - 支援 Execute 插件
  • 新增 scripts/rTorrent - 支援 .rtorrent.rc 設定
  • 新增 scripts/Aria2 - 支援 on-download-complete hook
  • 修正 scripts/qBittorrent JSON 格式錯誤

API 重構

  • 新增 /webhook/on-complete 通用端點
  • QBittorrentPayload 更名為 DownloaderOnCompletePayload

文檔

  • 重寫 README 說明專案功能、Docker 部署和開發指南
  • 新增各 BT 下載器設定說明

支援 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
@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • 多架構 Docker 支援: 新增 GitHub Actions workflow,支援 amd64arm64 架構的 Docker 映像建置,提升部署彈性。
  • 通用 BT 下載器整合: 引入多個主流 BT 下載器(Transmission, Deluge, rTorrent, Aria2)的整合腳本,並重構 webhook API 以支援通用的下載完成事件處理。
  • 全面更新文檔: 徹底重寫 README.md,提供詳細的專案功能、Docker 部署、開發指南及各下載器設定說明,大幅提升使用者和開發者的入門體驗。

🧠 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
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/builder-merge.yaml
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ThanatosDi ThanatosDi merged commit bf0a9d4 into main Jan 3, 2026
5 checks passed
@ThanatosDi ThanatosDi deleted the refactor/v3 branch January 3, 2026 09:03
Copy link

@gemini-code-assist gemini-code-assist bot left a 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,整體方向很棒。我主要針對以下幾點提供一些回饋:

  1. 文件準確性README.md 中的 Webhook URL 範例似乎不正確,這會導致使用者設定失敗。
  2. API 文件一致性:後端 API 的 docstring 與實際回應的資料格式有些微出入。
  3. Shell 腳本安全性:新增的下載器腳本在處理傳入參數時,手動拼接 JSON 字串存在安全風險,可能導致 JSON 格式錯誤或命令注入。

詳細的修改建議請參考各個檔案的 review comments。再次感謝您的努力!

Comment on lines +31 to +36
CATEGORY=""
TAGS=""

curl -sS -X POST "$URL" \
-H "Content-Type: application/json" \
-d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATH 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。

建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq

Suggested change
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"

Comment on lines +32 to +38
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\"}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATH 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。

建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq

Suggested change
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"

Comment on lines +29 to +35
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\"}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATHTAGS 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。

建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq

Suggested change
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"

Comment on lines +19 to +21
curl -sS -X POST "$URL" \
-H "Content-Type: application/json" \
-d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}" No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATH, CATEGORY, 或 TAGS 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。

建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq

另外,此檔案結尾缺少換行符,建議補上以符合 shell 腳本的最佳實踐。

Suggested change
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"

Comment on lines +27 to +31
TAGS=""

curl -sS -X POST "$URL" \
-H "Content-Type: application/json" \
-d "{\"filepath\": \"$FILE_PATH\", \"category\": \"$CATEGORY\", \"tags\": \"$TAGS\"}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

手動建立 JSON 字串容易出錯,且有安全風險。如果 FILE_PATHCATEGORY 變數包含雙引號 (") 或其他特殊字元,會導致 JSON 格式錯誤,甚至可能造成命令注入。

建議使用 jq 工具來安全地建立 JSON。jq 會自動處理特殊字元的跳脫。這需要執行環境安裝 jq

Suggested change
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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

文件中的 Webhook URL 不正確。根據後端路由的變更,通用端點應為 http://movera:8000/webhook/on-complete。目前範例中使用的 http://movera:8000/webhook/qbittorrent 是一個不存在的路徑,會導致整合失敗。

請將此處以及其他所有下載器範例中的 URL 更新為正確的通用端點。

Suggested change
/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"

Comment on lines 61 to +62
- `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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

API 文件與實作不一致。文件說明 status 的值為 "success",但程式碼返回的是 "ok"。另外,文件說明 code 的值為字串 "200",但程式碼返回的是數字 200

建議更新文件以符合實際的回應內容,確保 API 的使用者不會被誤導。

Suggested change
- `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' 的資料模型。"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

這個類別已經被重構成為通用的下載器 payload,但 docstring 仍然是 qBittorrent 'run external program' 的資料模型。建議更新 docstring 以反映其通用性,例如:「下載器『on download complete』事件的通用資料模型。」

Suggested change
"""qBittorrent 'run external program' 的資料模型。"""
"""下載器 'on download complete' 事件的通用資料模型。"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants