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:
1 parent
901b01d1a1
commit
28974d1e1a
58 files changed
+2843
-1112
No files matched your search
@@ -1,48 +0,0 @@
|
||||
import type { SiteRelease } from "@umt/adapters";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { mergeDetailOverList } from "../../src/modules/sources-identity/service/snapshot.ts";
|
||||
|
||||
// HHClub 2026-09-29 实测:div 详情页没有做种 / 完成数 / 分类名,刷新详情后这些列被 null 冲掉。
|
||||
describe("详情刷新沿用列表字段", () => {
|
||||
const detail: SiteRelease = {
|
||||
siteId: "hhanclub",
|
||||
siteReleaseId: "91001",
|
||||
title: "示例短剧 1080p WEB-DL H265 AAC-HHWEB",
|
||||
category: { id: "412", name: null },
|
||||
sizeBytes: 194385019,
|
||||
seeders: null,
|
||||
leechers: null,
|
||||
snatched: null,
|
||||
promotion: { type: "none", downloadFactor: 1, uploadFactor: 1, expiresAt: null },
|
||||
hr: "unknown",
|
||||
uploadedAt: "2026-09-29T06:07:03.000Z",
|
||||
detailUrl: "https://hhanclub.net/details.php?id=91001",
|
||||
downloadUrl: "https://hhanclub.net/download.php?id=91001",
|
||||
tags: [],
|
||||
raw: {},
|
||||
observedAt: "2026-09-29T06:19:28.000Z",
|
||||
};
|
||||
const rel = {
|
||||
seeders: 1,
|
||||
leechers: 58,
|
||||
category_raw: "412",
|
||||
tags_raw: ["官方"],
|
||||
raw: { _site: { hr: false, snatched: 0, categoryName: "短剧" } },
|
||||
};
|
||||
|
||||
it("详情缺的做种 / 下载 / 完成 / 分类名 / H&R / 标签取列表快照值", () => {
|
||||
expect(mergeDetailOverList(detail, rel)).toMatchObject({
|
||||
seeders: 1,
|
||||
leechers: 58,
|
||||
snatched: 0,
|
||||
category: { id: "412", name: "短剧" },
|
||||
hr: false,
|
||||
tags: ["官方"],
|
||||
});
|
||||
});
|
||||
|
||||
it("详情有值时以详情为准", () => {
|
||||
const m = mergeDetailOverList({ ...detail, seeders: 9, hr: true, category: { id: "402", name: "电视剧" } }, rel);
|
||||
expect(m).toMatchObject({ seeders: 9, hr: true, category: { id: "402", name: "电视剧" } });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user