diff --git a/docs/SOURCE_CATALOG_LIVE_ROUTING_ACCEPTANCE.md b/docs/SOURCE_CATALOG_LIVE_ROUTING_ACCEPTANCE.md index 33ec98d..0831886 100644 --- a/docs/SOURCE_CATALOG_LIVE_ROUTING_ACCEPTANCE.md +++ b/docs/SOURCE_CATALOG_LIVE_ROUTING_ACCEPTANCE.md @@ -28,7 +28,7 @@ API只返回两个范围是否启用,不把目标知识库ID交给浏览器。 真实验收: - 钉钉公司级技术支持知识库:浏览器捕获会话有效;扫描1080个文件夹;新快照4524节点、1079目录、3444文件;原快照3468文件,证明读取的是实时来源变化;新快照原子激活,旧快照保留。 - PP:当前凭据文件可读取且网络可达,但登录返回无Token;网页显示“PP登录失败,请在来源链接更新凭据;旧快照仍然保留”。 -- AList直连:保留各来源原地址,仅向`POST /api/fs/list`添加`x-api-token`;拒绝所有重定向,不依赖钉钉SSO Cookie。2026-09-10 实测四个来源均完成只读全量快照并原子激活:国内工业1718目录/4942文件、海外工业1486目录/4463文件、国内教育3566目录/9067文件、海外教育1742目录/5015文件。 +- AList直连:保留各来源原地址,仅向`POST /api/fs/list`添加`X-Gateway-Token`(2026-09-28 网关鉴权头由`x-api-token`改名,旧头已401失效;下载直链`/p/?sign=…`为签名鉴权,不受请求头影响);拒绝所有重定向,不依赖钉钉SSO Cookie。2026-09-10 实测四个来源均完成只读全量快照并原子激活:国内工业1718目录/4942文件、海外工业1486目录/4463文件、国内教育3566目录/9067文件、海外教育1742目录/5015文件。 Worker只读挂载源脚本和来源目录;DingTalk/PP/AList凭据副本位于治理`secrets/`、权限0600,仅普通Worker挂载,API/Web/Release Worker不挂载。AList直连令牌从`secrets/alist_api_token`读取,不进入来源地址表、任务载荷、数据库或日志。 diff --git a/scripts/artifact_fetch.py b/scripts/artifact_fetch.py index 8a832e5..aa6bdf7 100644 --- a/scripts/artifact_fetch.py +++ b/scripts/artifact_fetch.py @@ -190,7 +190,7 @@ def alist_download(manifest, max_bytes): path = "/" + manifest["relative_path"].lstrip("/") payload = json.dumps({"path": path, "password": ""}).encode("utf-8") request = urllib.request.Request(base_url + "/api/fs/get", data=payload, method="POST", headers={ - "x-api-token": token, "Content-Type": "application/json", "Accept": "application/json", + "X-Gateway-Token": token, "Content-Type": "application/json", "Accept": "application/json", "User-Agent": "governance-artifact-fetch/1.0", }) try: @@ -209,11 +209,11 @@ def alist_download(manifest, max_bytes): if manifest.get("size_bytes") in (None, 0) and data.get("size"): manifest["size_bytes"] = int(data["size"]) download_url = urllib.parse.urljoin(base_url + "/", raw_url.lstrip("/")) - # This AList deployment gates the download route with x-api-token (the - # Authorization header is NOT recognized there): wrong auth yields a 302 - # to the DingTalk login page instead of bytes. + # 2026-09-28 实测:该网关的下载直链 /p/?sign=... 由签名鉴权,请求头带 + # 什么都不影响(无头也是 206);真正需要凭证的是 /api/fs/* 路由。这里仍带上 + # 网关头,Authorization 兜底保留用于旧网关形态。 try: - return http_get(download_url, {"x-api-token": token}, 180, max_bytes) + return http_get(download_url, {"X-Gateway-Token": token}, 180, max_bytes) except FetchError as error: if error.code == "source_auth_required": try: