feat(browser): unify site credentials with browser profiles (BR-2)

- Inject the site account Cookie (manual + auto-login session, session wins)
  into the camofox profile before the first tab opens; password accounts
  without a session run refresh-login first; API Key sites are skipped.
- Cookie expired after injection -> credential.status=expired; cookie
  accounts go to waiting/login_required ("log in once, applies site-wide").
- Write back site-domain cookies from the browser on handover, session close,
  every 10 min of activity, and from refresh-login when the stored cookie is
  invalid (verified before saving). user_info.cookieOrigin records
  source=browser; source shown as manual/login/browser in the origin view.
- New camofox plugin umt-cookies (GET/POST /umt/sessions/:userId/cookies
  under the access key); profile dir 0700/files 0600 in the desktop image.
- Single entry: sources-identity/service/credentials.ts.
- Real check: HHClub cookie injected into a fresh profile -> home page
  logged in (logout link present), 5 cookies read back.

Requires rebuilding umt-browser-desktop (docker compose build camofox &&
docker compose up -d camofox) to take effect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 15:25:07 +08:00
1 parent 901b01d1a1
commit 28974d1e1a
58 files changed
+2843 -1112

No files matched your search

@@ -121,21 +121,6 @@ export interface IndexerDefinition {
umt: UmtSiteExtension;
}
export interface SiteAccessDefaults {
/** 定时快照周期(秒) */
snapshotIntervalSec?: number;
/** 快照(定时 / 手动)最多抓几页列表 */
snapshotMaxPages?: number;
/** 健康检测最短间隔(秒) */
healthCheckIntervalSec?: number;
/** 用户数据刷新间隔(秒;定时任务 sites.user_data 的周期,仅作说明与校验) */
userDataIntervalSec?: number;
/** 同站实时搜索并发 */
searchConcurrency?: number;
/** 详情页结果缓存(秒):期内不重复抓详情 */
detailCacheSec?: number;
}
export interface UmtSiteExtension {
/** 定义版本,入 site_snapshot */
version: string;
@@ -166,11 +151,6 @@ export interface UmtSiteExtension {
/** 站点时间时区偏移,如 "+08:00";pubdate/freedate 按此转 UTC */
timezone: string;
rateLimit: { minIntervalMs: number; burst: number };
/**
* 站点级访问默认(本项目扩展):按站点实测给出的保守下限。运行时与 settings.sites 取更保守的一方
* (周期 / 缓存取较长,页数 / 并发取较小);站点行自己设了快照周期时以站点行为准。
*/
defaults?: SiteAccessDefaults;
capabilities: { list: boolean; search: boolean; detail: boolean; download: boolean; rss: boolean };
/** 原始分类 ID → 站点分类名(列表只有 ID 时补名称;不做投影) */
categoryNames?: Record<string, string>;