The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
feat(sources): 将 gitcode raw 从 jsDelivr 换到 CNB
XiaoYouChRe107ea301bd3
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 2fc5f613..c4316764 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -704,6 +704,17 @@ jobs:git diff --staged --quiet || git commit -m "chore: update versions.json for v${VERSION} [skip ci]"git push+ - name: Push to CNB+ continue-on-error: true+ env:+ CNB_TOKEN: ${{ secrets.CNB_TOKEN }}+ VERSION: ${{ needs.prepare.outputs.version }}+ run: |+ if [ -z "$CNB_TOKEN" ]; then echo "No CNB_TOKEN, skipping"; exit 0; fi+ git fetch origin tag "v${VERSION}"+ REMOTE="https://cnb:${CNB_TOKEN}@cnb.cool/XiaoYouChR/Ghost-Downloader-3"+ git push "$REMOTE" main 2>&1 | sed "s/${CNB_TOKEN}/****/g" || true+- name: Push to GitCodecontinue-on-error: trueenv:@@ -763,8 +774,3 @@ jobs:donewait- - name: Purge jsDelivr cache- run: |- for f in versions.json dist/packs/*.zip; do- curl -s "https://purge.jsdelivr.net/gh/XiaoYouChR/Ghost-Downloader-3@main/${f}" || true- donediff --git a/CONTEXT.md b/CONTEXT.mdindex 6406e28a..71e9072c 100644--- a/CONTEXT.md+++ b/CONTEXT.md@@ -126,6 +126,18 @@ _Avoid_: group、tag、type应用级用户配置。_Avoid_: options(options 是每个 Task 的输入,不是应用配置)++### 更新分发++**Origin**:+应用更新与附属二进制的权威托管方。构建、打 tag、发布资产以 Origin 为准。当前是 GitHub。+_Avoid_: source of truth 单独当术语;不叫 primary / 主镜像++**Source**:+客户端竞速拉取更新元数据和资产的一个托管端点。当前集合是 github 与 gitcode。+_Avoid_: Mirror、CDN、channel;CNB 不是 Source++## Example dialogue> **Dev:** "用户按暂停时,我们删除 Task 吗?"diff --git a/app/sources.py b/app/sources.pyindex 1108ad0b..52d166de 100644--- a/app/sources.py+++ b/app/sources.py@@ -31,8 +31,8 @@ SOURCES = {"gitcode": SourceEndpoints(api="https://api.gitcode.com/api/v5/repos",download="https://gitcode.com",- raw="https://cdn.jsdelivr.net/gh",- rawInfix="@",+ raw="https://cnb.cool",+ rawInfix="/-/git/raw/",),"github": SourceEndpoints(api="https://api.github.com/repos",@@ -43,7 +43,7 @@ SOURCES = {}SOURCE_ORDER = ("github", "gitcode")-STAGGER_DELAY = 0.3+STAGGER_DELAY = 0@dataclass(frozen=True)diff --git a/docs/adr/0009-gitcode-raw-via-cnb.md b/docs/adr/0009-gitcode-raw-via-cnb.mdnew file mode 100644index 00000000..c57675f2--- /dev/null+++ b/docs/adr/0009-gitcode-raw-via-cnb.md@@ -0,0 +1,7 @@+# gitcode 的 raw 走 CNB,不走 jsDelivr++`SOURCES["gitcode"].raw` 曾经是 `cdn.jsdelivr.net/gh`。jsDelivr 的 `/gh/` 读的是 GitHub,在大陆 DNS 污染后不稳定;GitCode 本身又屏蔽访客 raw 二进制,才被迫挂这层 CDN。++CNB(`cnb.cool/{repo}/-/git/raw/{ref}/{path}`)对公开仓匿名可读,不挡二进制。应用更新只把 raw(`versions.json`、`dist/packs/*.zip`)改到 CNB。`gitcode` 的 API / release 下载、四个附属仓、BT tracker 列表里别人的 jsDelivr 地址都不动。++key 仍叫 `gitcode`:China Source 没换,换的是它的 raw 宿主。竞速仍是先 200 的赢;过期但 200 的 CNB 可能在大陆赢过 GitHub,靠 `sha256` 和同一 job 里 `git push` CNB 把窗口压短。