feat(sites): site requests follow browser UA, smooth UA switch, CF cookies browser-only (BR-4)
- every outbound site request (adapter list/search/detail/download/health, RSS, login, user data) carries the account UA via SourcesRuntime.siteFetch; no more Deno default UA - priority: account manual > pending > global setting > browser identity (fallback: same-shape Windows Firefox UA); settings UA default is empty - migration 0056: existing cookie/password accounts keep their old UA as ua_pending until re-login or browser cookie write-back switches cookie+UA in one transaction; browser_provider.identity caches the browser identity - cf_clearance/__cf_bm stripped on browser write-back (names kept only) - browser sessions get per-site egress (same proxy as HTTP, or direct) - site account page shows UA source; raw UA in tech info Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ebd07c9230
commit
adc853aa64
21 files changed
+955
-72
No files matched your search
@@ -254,8 +254,15 @@ export const MetadataSettings = z.object({
|
||||
});
|
||||
export type MetadataSettings = z.infer<typeof MetadataSettings>;
|
||||
|
||||
/** 固定桌面 Chrome UA(账号未设 UA 时使用) */
|
||||
export const DEFAULT_SITE_USER_AGENT =
|
||||
/**
|
||||
* 读不到浏览器身份(没有浏览器服务 / 旧镜像 / 暂时连不上)时站点请求用的 UA:与浏览器身份同型的 Windows Firefox
|
||||
* (camofox 1.17.0 = Camoufox 152;升级浏览器镜像时同步改这里,BR-4)。
|
||||
*/
|
||||
export const FALLBACK_SITE_USER_AGENT =
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0";
|
||||
|
||||
/** BR-4 之前的缺省 UA(Windows Chrome 140):迁移时据此把存量账号标"待切换",设置里的旧缺省值清空改为跟随浏览器 */
|
||||
export const LEGACY_SITE_USER_AGENT =
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36";
|
||||
|
||||
/** 站点默认(site-center §8):站点行的限流 / 快照周期为空时继承;站点和凭证在站点页管理 */
|
||||
@@ -268,8 +275,10 @@ export const SitesSettings = z.object({
|
||||
.int()
|
||||
.min(300)
|
||||
.max(7 * 24 * 3600),
|
||||
/** 账号未设 UA 时使用 */
|
||||
userAgent: z.string().min(1).max(500),
|
||||
/**
|
||||
* 全局 UA 覆盖:空串 = 跟随浏览器(缺省,BR-4);填了则账号没有手动 UA 时都用它(浏览器仍是自己的 UA,两端会不一致)
|
||||
*/
|
||||
userAgent: z.string().trim().max(500),
|
||||
/** 站点开"使用代理"时生效;null = 不用代理 */
|
||||
proxyUrl: z.url().nullable(),
|
||||
/** 用户数据做种分页上限 */
|
||||
@@ -645,7 +654,7 @@ export const DEFAULT_SETTINGS: GlobalSettings = {
|
||||
sites: {
|
||||
defaultRateLimit: { requestsPerMinute: 20, concurrency: 2 },
|
||||
defaultSnapshotIntervalSec: 3600,
|
||||
userAgent: DEFAULT_SITE_USER_AGENT,
|
||||
userAgent: "",
|
||||
proxyUrl: null,
|
||||
userDataMaxSeedingPages: 10,
|
||||
defaultSnapshotMaxPages: 1,
|
||||
|
||||
Reference in new issue
Block a user