diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index f58d9cf2..71ae1ddd 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -1642,7 +1642,7 @@ const I18N = { "It said: {error}": "原话:{error}", "WorkBuddy refuses chats from Codex and Claude Code (their system prompt); use it from Hermes, OpenCode or Pi, or add another provider to this group": "WorkBuddy 会拒绝来自 Codex 和 Claude Code 的对话(因为它们的系统提示词);请在 Hermes、OpenCode 或 Pi 里使用它,或在这个分组里再加一个供应商", "the provider's network firewall blocked requests from this IP; wait a while, or switch to another network or proxy": "供应商的网络防火墙拦截了来自这个 IP 的请求;请稍等一会儿,或换个网络或代理", - "ZCode's Start Plan turns away requests that don't come from the ZCode app itself, and magpie doesn't pretend to be it; it can also be a network block of this IP. Use an account with a GLM Coding Plan, or add another provider to this group": "ZCode 体验套餐会拒绝不是来自 ZCode 客户端本身的请求,magpie 不会冒充它;也可能是网络拦截了这个 IP。请改用有 GLM Coding Plan 的账号,或在这个分组里加上其他供应商", + "ZCode's Start Plan still turned this request away, though magpie sends it as the ZCode app does; it can be a network block of this IP, or ZCode checking for something new. Use an account with a GLM Coding Plan, or add another provider to this group": "ZCode 体验套餐仍拒绝了这个请求(magpie 已按 ZCode 客户端的方式发送);可能是网络拦截了这个 IP,或 ZCode 又加了新的校验。请改用有 GLM Coding Plan 的账号,或在这个分组里加上其他供应商", "Show the latest request that failed": "查看最近一个失败的请求", "rate limited": "限流", "out of credit": "余额不足", diff --git a/internal/gui/assets/routing.js b/internal/gui/assets/routing.js index 060123e5..52aa5f91 100644 --- a/internal/gui/assets/routing.js +++ b/internal/gui/assets/routing.js @@ -507,7 +507,7 @@ const BLOCKED = "the provider's network firewall blocked requests from this IP; wait a while, or switch to another network or proxy"; // what it says of ZCode's Start Plan turning a request away (#425, // provider.ZCodeStartBlockedHint), in place of BLOCKED - const ZCODE_BLOCKED = "ZCode's Start Plan turns away requests that don't come from the ZCode app itself, and magpie doesn't pretend to be it; it can also be a network block of this IP. Use an account with a GLM Coding Plan, or add another provider to this group"; + const ZCODE_BLOCKED = "ZCode's Start Plan still turned this request away, though magpie sends it as the ZCode app does; it can be a network block of this IP, or ZCode checking for something new. Use an account with a GLM Coding Plan, or add another provider to this group"; const HINTS = [WB_REFUSED, BLOCKED, ZCODE_BLOCKED]; function trySaid(r, i) { diff --git a/internal/gui/tests/README.md b/internal/gui/tests/README.md index e7c07232..304ff976 100644 --- a/internal/gui/tests/README.md +++ b/internal/gui/tests/README.md @@ -840,9 +840,9 @@ leaves the page where it is. Chromium and WebKit, API faked. `routing-zcode-blocked.test.cjs` opens a request ZCode's Start Plan turned away (#425: 405 "request has been blocked due to unusual activity") on the Routing page: what the gateway made of it is given without the hint it adds, -and the hint (ZCode takes only its own app's requests and magpie doesn't -pretend to be it, or the network blocked this IP; use a GLM Coding Plan or -another provider in the group) is on its own line in English and Chinese; +and the hint (ZCode still turned it away though magpie sends it as the ZCode +app does: the network blocked this IP, or ZCode checks something new; use a +GLM Coding Plan or another provider in the group) is on its own line in English and Chinese; another 405 gets none, and picking the request leaves the page where it is. Chromium and WebKit, API faked. diff --git a/internal/gui/tests/routing-zcode-blocked.test.cjs b/internal/gui/tests/routing-zcode-blocked.test.cjs index 38ea177e..2616a803 100644 --- a/internal/gui/tests/routing-zcode-blocked.test.cjs +++ b/internal/gui/tests/routing-zcode-blocked.test.cjs @@ -1,9 +1,10 @@ // Run with Node's test runner and Playwright on the module path; see README.md. // ZCode's Start Plan turning a request away (#425: 405 "request has been // blocked due to unusual activity", code 3012): the Routing page gives -// what the gateway made of it, and apart from that what it means (ZCode -// takes only its own app's requests, or the network blocked the address, -// and what to use instead), in the page's language. +// what the gateway made of it, and apart from that what it means (it was +// sent as the ZCode app sends it, so the network blocked the address or +// ZCode checks something new, and what to use instead), in the page's +// language. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); const path = require("node:path"); @@ -14,7 +15,7 @@ const assets = path.resolve(__dirname, "../assets"); const now = new Date(); const day = [now.getFullYear(), now.getMonth() + 1, now.getDate()].map((n) => String(n).padStart(2, "0")).join("-"); const at = (i) => new Date(now.getTime() - (i + 1) * 60e3).toISOString(); -const hint = "ZCode's Start Plan turns away requests that don't come from the ZCode app itself, and magpie doesn't pretend to be it; it can also be a network block of this IP. Use an account with a GLM Coding Plan, or add another provider to this group"; +const hint = "ZCode's Start Plan still turned this request away, though magpie sends it as the ZCode app does; it can be a network block of this IP, or ZCode checking for something new. Use an account with a GLM Coding Plan, or add another provider to this group"; const vendor = "ZCode: 405 Method Not Allowed"; const key = { id: "zcode", provider: "zcode", name: "ZCode", kind: "provider", model: "GLM-5.3-Flash" }; // newest first: the block, then another 405 with nothing to add @@ -56,7 +57,7 @@ function serve(lang) { const want = { en: { said: "It said: " + vendor, hint }, - zh: { said: "原话:" + vendor, hint: "ZCode 体验套餐会拒绝不是来自 ZCode 客户端本身的请求,magpie 不会冒充它;也可能是网络拦截了这个 IP。请改用有 GLM Coding Plan 的账号,或在这个分组里加上其他供应商" }, + zh: { said: "原话:" + vendor, hint: "ZCode 体验套餐仍拒绝了这个请求(magpie 已按 ZCode 客户端的方式发送);可能是网络拦截了这个 IP,或 ZCode 又加了新的校验。请改用有 GLM Coding Plan 的账号,或在这个分组里加上其他供应商" }, }; for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { diff --git a/internal/provider/zcode.go b/internal/provider/zcode.go index 1a2b070e..a928f7bb 100644 --- a/internal/provider/zcode.go +++ b/internal/provider/zcode.go @@ -318,7 +318,7 @@ func zcodeProvider(who, plan string, k zcodeKey) Provider { return errZCodeExpired } key = k.JWT - zcodeSourceHeaders(req) + zcodeStartRequest(req, body) } req.Header.Del("Authorization") req.Header.Set("x-api-key", key) diff --git a/internal/provider/zcode_blocked_test.go b/internal/provider/zcode_blocked_test.go index df69cf05..776ccf1c 100644 --- a/internal/provider/zcode_blocked_test.go +++ b/internal/provider/zcode_blocked_test.go @@ -12,9 +12,9 @@ const zcodeBlockPage = `