dsh-cookie-cleaner 0.6.4 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,118 +1,138 @@
1
- /**
2
- * 卡片的数据臂:三条 POST 路由。
3
- *
4
- * URL 与宿主侧 `src/api-routes.js` 的派生式**必须逐字符一致**——两半各写一份是事实,
5
- * 但一致性由 `tests/api-routes.test.js` 读两份源码比对钉住(漂移表现为卡片永远 404)。
6
- *
7
- * 没有 port:本插件只改 cookie 有效期,端口写入能力已整体删除(面板与命令面都不做)。
8
- */
9
-
10
- export const NS = 'dsh-cookie-cleaner'
11
-
12
- export const routes = {
13
- check: '/api/dsh-cookie-cleaner/patch/check',
14
- fix: '/api/dsh-cookie-cleaner/patch/fix',
15
- revert: '/api/dsh-cookie-cleaner/patch/revert',
16
- guardGet: '/api/dsh-cookie-cleaner/guard/get',
17
- guardSet: '/api/dsh-cookie-cleaner/guard/set',
18
- } as const
19
-
20
- /** 运行期守护当前生效值(面板开关 + 两个阈值)。 */
21
- export interface GuardView {
22
- available?: boolean
23
- runtimeGuard: boolean
24
- maxHeaderBytes: number
25
- keep: number
26
- retireAbove: number
27
- kind?: string
28
- changed?: string[]
29
- message?: string
30
- }
31
-
32
- /** 宿主统一信封:`{ok, value}` 或 `{ok:false, code, message}`。 */
33
- export interface BridgeReply<T> {
34
- ok?: boolean
35
- code?: string
36
- message?: string
37
- value?: T
38
- }
39
-
40
- export interface Finding {
41
- code: string
42
- level: 'ok' | 'warn' | 'fail' | 'skipped'
43
- params?: Record<string, unknown>
44
- }
45
-
46
- export interface RowView {
47
- rowId: string
48
- writable?: boolean
49
- level: 'ok' | 'warn' | 'fail' | 'skipped'
50
- actionable?: boolean
51
- /** 写了也没用的硬闸(P2/P4/P6/P10/P11):面板据此禁用动作 */
52
- blocked?: boolean
53
- /** 表达式被抄成字面量(或根本没写)的键:不进档位,只在处方里提 */
54
- exprFrozen?: string[]
55
- findings?: Finding[]
56
- }
57
-
58
- export interface CheckView {
59
- level: 'ok' | 'warn' | 'fail' | 'skipped'
60
- reason?: string
61
- rows?: RowView[]
62
- documentPath?: string
63
- checkedAt?: string
64
- offline?: boolean
65
- /** 修复按钮要写入的目标寿命(宿主设置里那个值,跟结果同屏回显) */
66
- targetDays?: number
67
- /** 上次成功修复的留痕(面板重开也看得到,不只在这一瞬) */
68
- lastFix?: { at?: string | null; beforeDays?: number; targetDays?: number }
69
- /** 上次端口动作的留痕(写前值/目标值) */
70
- lastPort?: { at?: string | null; before?: unknown; port?: number }
71
- /** cookie 库现状:读得到就给条数与占用折算,读不到才给 reason */
72
- cookie?: {
73
- verdict?: string
74
- reason?: string
75
- path?: string
76
- authCookies?: number
77
- totalCookies?: number
78
- bytes?: number
79
- /** 读数来源:普通只读打开还是借句柄快照 */
80
- source?: string
81
- snapshot?: boolean
82
- liveUnavailable?: boolean
83
- liveReason?: string
84
- header?: {
85
- bytes: number
86
- pct: number
87
- rawPct: number
88
- maxHeaderBytes: number
89
- basis: string
90
- threshold: number
91
- remaining: number
92
- over: boolean
93
- }
94
- }
95
- }
96
-
97
- export interface ActionView {
98
- kind: string
99
- changed?: string[]
100
- codes?: string[]
101
- message?: string
102
- effective?: number
103
- result?: CheckView
104
- }
105
-
106
- /** POST 一跳;网络/解析失败都归成结构化错误,不让卡片白屏。 */
107
- export async function postJson<T>(path: string, body: Record<string, unknown> = {}): Promise<T> {
108
- const response = await fetch(path, {
109
- method: 'POST',
110
- headers: { 'content-type': 'application/json' },
111
- body: JSON.stringify(body),
112
- })
113
- if (!response.ok) throw new Error(`HTTP ${String(response.status)}`)
114
- const reply = (await response.json()) as BridgeReply<T>
115
- if (reply.ok !== true) throw new Error(`${reply.code ?? 'unknown'} ${reply.message ?? ''}`.trim())
116
- if (reply.value === undefined) throw new Error('empty reply value')
117
- return reply.value
118
- }
1
+ /**
2
+ * 卡片的数据臂:三条 POST 路由。
3
+ *
4
+ * URL 与宿主侧 `src/api-routes.js` 的派生式**必须逐字符一致**——两半各写一份是事实,
5
+ * 但一致性由 `tests/api-routes.test.js` 读两份源码比对钉住(漂移表现为卡片永远 404)。
6
+ *
7
+ * 没有 port:本插件只改 cookie 有效期,端口写入能力已整体删除(面板与命令面都不做)。
8
+ */
9
+
10
+ export const NS = 'dsh-cookie-cleaner'
11
+
12
+ export const routes = {
13
+ check: '/api/dsh-cookie-cleaner/patch/check',
14
+ fix: '/api/dsh-cookie-cleaner/patch/fix',
15
+ revert: '/api/dsh-cookie-cleaner/patch/revert',
16
+ guardGet: '/api/dsh-cookie-cleaner/guard/get',
17
+ guardSet: '/api/dsh-cookie-cleaner/guard/set',
18
+ legacyGet: '/api/dsh-cookie-cleaner/legacy/get',
19
+ legacyClean: '/api/dsh-cookie-cleaner/legacy/clean',
20
+ } as const
21
+
22
+ /** 历史注入残留现状(旧版写进 profile 的 port 表达式)。v0.7.1 */
23
+ export interface LegacyView {
24
+ available?: boolean
25
+ rowFound?: boolean
26
+ found: boolean
27
+ expression?: string
28
+ fallback?: number
29
+ cleanupSupported?: boolean
30
+ kind?: string
31
+ changed?: string[]
32
+ removed?: string
33
+ message?: string
34
+ /** 清理后重新读到的现状(cleanLegacy 回传,用于就地刷新面板) */
35
+ state?: LegacyView
36
+ }
37
+
38
+ /** 运行期守护当前生效值(面板开关 + 两个阈值)。v0.7.0:开关拆成 retireStale / raiseHeaderBudget。 */
39
+ export interface GuardView {
40
+ available?: boolean
41
+ retireStale: boolean
42
+ raiseHeaderBudget: boolean
43
+ runtimeGuard: boolean
44
+ maxHeaderBytes: number
45
+ keep: number
46
+ retireAbove: number
47
+ kind?: string
48
+ changed?: string[]
49
+ message?: string
50
+ }
51
+
52
+ /** 宿主统一信封:`{ok, value}` 或 `{ok:false, code, message}`。 */
53
+ export interface BridgeReply<T> {
54
+ ok?: boolean
55
+ code?: string
56
+ message?: string
57
+ value?: T
58
+ }
59
+
60
+ export interface Finding {
61
+ code: string
62
+ level: 'ok' | 'warn' | 'fail' | 'skipped'
63
+ params?: Record<string, unknown>
64
+ }
65
+
66
+ export interface RowView {
67
+ rowId: string
68
+ writable?: boolean
69
+ level: 'ok' | 'warn' | 'fail' | 'skipped'
70
+ actionable?: boolean
71
+ /** 写了也没用的硬闸(P2/P4/P6/P10/P11):面板据此禁用动作 */
72
+ blocked?: boolean
73
+ /** 表达式被抄成字面量(或根本没写)的键:不进档位,只在处方里提 */
74
+ exprFrozen?: string[]
75
+ findings?: Finding[]
76
+ }
77
+
78
+ export interface CheckView {
79
+ level: 'ok' | 'warn' | 'fail' | 'skipped'
80
+ reason?: string
81
+ rows?: RowView[]
82
+ documentPath?: string
83
+ checkedAt?: string
84
+ offline?: boolean
85
+ /** 修复按钮要写入的目标寿命(宿主设置里那个值,跟结果同屏回显) */
86
+ targetDays?: number
87
+ /** 上次成功修复的留痕(面板重开也看得到,不只在这一瞬) */
88
+ lastFix?: { at?: string | null; beforeDays?: number; targetDays?: number }
89
+ /** 上次端口动作的留痕(写前值/目标值) */
90
+ lastPort?: { at?: string | null; before?: unknown; port?: number }
91
+ /** cookie 库现状:读得到就给条数与占用折算,读不到才给 reason */
92
+ cookie?: {
93
+ verdict?: string
94
+ reason?: string
95
+ path?: string
96
+ authCookies?: number
97
+ totalCookies?: number
98
+ bytes?: number
99
+ /** 读数来源:普通只读打开还是借句柄快照 */
100
+ source?: string
101
+ snapshot?: boolean
102
+ liveUnavailable?: boolean
103
+ liveReason?: string
104
+ header?: {
105
+ bytes: number
106
+ pct: number
107
+ rawPct: number
108
+ maxHeaderBytes: number
109
+ basis: string
110
+ threshold: number
111
+ remaining: number
112
+ over: boolean
113
+ }
114
+ }
115
+ }
116
+
117
+ export interface ActionView {
118
+ kind: string
119
+ changed?: string[]
120
+ codes?: string[]
121
+ message?: string
122
+ effective?: number
123
+ result?: CheckView
124
+ }
125
+
126
+ /** POST 一跳;网络/解析失败都归成结构化错误,不让卡片白屏。 */
127
+ export async function postJson<T>(path: string, body: Record<string, unknown> = {}): Promise<T> {
128
+ const response = await fetch(path, {
129
+ method: 'POST',
130
+ headers: { 'content-type': 'application/json' },
131
+ body: JSON.stringify(body),
132
+ })
133
+ if (!response.ok) throw new Error(`HTTP ${String(response.status)}`)
134
+ const reply = (await response.json()) as BridgeReply<T>
135
+ if (reply.ok !== true) throw new Error(`${reply.code ?? 'unknown'} ${reply.message ?? ''}`.trim())
136
+ if (reply.value === undefined) throw new Error('empty reply value')
137
+ return reply.value
138
+ }
@@ -0,0 +1,256 @@
1
+ /**
2
+ * star-row 真源(面板 star 快车道行,v1)——纯 DOM 实现,零依赖。
3
+ *
4
+ * 副本约束:生成文件名 star-row-copy.ts,头部须保留 /** 块注释,单行 ≤140
5
+ * 字宽(sidebar-fold 仓 lint 门禁:max-line + file-header)。
6
+ *
7
+ * 契约(对齐 panel-star-row spec):
8
+ * - 渲染一行 <a>:GitHub 单色 SVG + `owner/name`;variant A 追加一句工程话术;
9
+ * - 整行即链接(A/L 档),新标签页打开;不做弹窗、不做按钮交互;
10
+ * - 文案内嵌 10 语,按 `document.documentElement.lang` 前缀自选
11
+ * (同 sidebar-fold `pickDictionary` 口径),不依赖宿主 locale 服务,
12
+ * 避免逐仓动字典文件;
13
+ * - 样式一次性注入 <style data-dsh-star-row>,色随 currentColor,深浅主题自适应;
14
+ * - 副本由 _tools/star-row/sync.mjs 生成到各仓 `src/client/star-row-copy.ts`
15
+ * (文件名含 copy,locale 守卫豁免规则命中),改副本无效,改真源后重跑 sync。
16
+ *
17
+ * 每仓生成时在文件头部烘焙 REPO_URL / STAR_NS / STAR_VARIANT 三个常量。
18
+ */
19
+
20
+ /** 生成段:REPO_URL / STAR_NS / STAR_VARIANT 由 sync 注入。 */
21
+ // STAR-CONSTS:BEGIN — generated by _tools/star-row/sync.mjs; edit the real source instead
22
+ const REPO_URL = "https://github.com/drscrewdriver/dsh-cookie-cleaner";
23
+ const STAR_NS = "cookie-cleaner";
24
+ const STAR_VARIANT = "S" as "S" | "A" | "L";
25
+ // STAR-CONSTS:END
26
+
27
+ /** zh 为键集真理源;10 语与 sidebar-fold/manage-session 同集合。 */
28
+ const STAR_COPY: Record<string, { ask: string }> = {
29
+ zh: { ask: "觉得省事了?一颗 Star 让工具被更多人看见" },
30
+ en: { ask: "Finding it handy? A star helps more people discover this tool" },
31
+ ja: { ask: "便利でしたら⭐で、このツールがもっと届きます" },
32
+ ko: { ask: "유용했다면 ⭐ 하나로 더 많은 사용자에게 닿습니다" },
33
+ fr: { ask: "Utile ? Une étoile aide cet outil à être découvert" },
34
+ de: { ask: "Nützlich? Ein Stern hilft dem Tool, gesehen zu werden" },
35
+ it: { ask: "Ti è utile? Una stella aiuta questo tool a farsi scoprire" },
36
+ ru: { ask: "Пригодилось? Звезда поможет большему числу людей узнать о tool" },
37
+ es: { ask: "¿Te resulta útil? Una estrella ayuda a que más gente lo descubra" },
38
+ pt: { ask: "Achou útil? Uma estrela ajuda mais pessoas a descobrir a ferramenta" },
39
+ };
40
+ const STAR_LANGS = ["zh", "en", "ja", "ko", "fr", "de", "it", "ru", "es", "pt"];
41
+
42
+ /** GitHub mark(Simple Icons / octicon 轮廓,24 视口),fill 随 currentColor。 */
43
+ const GITHUB_MARK_PATH =
44
+ "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577" +
45
+ " 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7" +
46
+ " 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07" +
47
+ " 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332" +
48
+ " -5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0" +
49
+ " 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552" +
50
+ " 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0" +
51
+ " 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015" +
52
+ " 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12";
53
+
54
+ const STYLE_ID = "dsh-star-row-style";
55
+ const STYLE_CSS = [
56
+ ".dsh-star-row{display:flex;align-items:center;gap:7px;font-size:12px;",
57
+ "line-height:1.5;color:inherit;text-decoration:none;opacity:.72;padding:3px 0;",
58
+ "margin-top:6px;min-width:0;flex-wrap:wrap}",
59
+ ".dsh-star-row:hover{opacity:1;text-decoration:underline}",
60
+ ".dsh-star-row svg{width:14px;height:14px;flex:none;display:block}",
61
+ ".dsh-star-row .dsh-star-ask{opacity:.85;font-weight:400}",
62
+ ].join("");
63
+
64
+ function pickLang(): { ask: string } {
65
+ const tag = (typeof document !== "undefined" && document.documentElement.lang) || "";
66
+ const low = tag.toLowerCase();
67
+ for (const cand of STAR_LANGS) {
68
+ if (low.startsWith(cand)) return STAR_COPY[cand]!;
69
+ }
70
+ return STAR_COPY.en!;
71
+ }
72
+
73
+ // STAR:EXTENDED:BEGIN — S 档专用段(话术 + ★ CTA + 隐藏钮)。sync 对 A/L 副本整段剥除,
74
+ // 所以本段怎么改都不会波及已发布的 A/L 副本。S 档渲染:GitHub SVG + owner/repo 链接 |
75
+ // star.ask | ★ star.cta(打开仓库页)| × star.hide(收话术与两钮)。★ 是「去点星」的
76
+ // 动作,隐藏才是「别打扰我」;两者绝不合流——旧版把点星写成隐藏,用户点 ★ 只落个静默收起,
77
+ // 仓库页一次都没打开过(2.0.25 实测缺陷)。隐藏写 localStorage `dsh.star.<ns>.dismissed=1`,
78
+ // 链接段永留。文案 10 语随 documentElement.lang。
79
+ const STAR_CTA: Record<string, string> = {
80
+ zh: "留颗 Star",
81
+ en: "Star",
82
+ ja: "スター",
83
+ ko: "스타",
84
+ fr: "Star",
85
+ de: "Stern",
86
+ it: "Stella",
87
+ ru: "Звезда",
88
+ es: "Estrella",
89
+ pt: "Estrela",
90
+ };
91
+
92
+ /** 隐藏钮的可读名(★ 之外的独立动作,10 语同集)。 */
93
+ const STAR_HIDE: Record<string, string> = {
94
+ zh: "不再提示",
95
+ en: "Dismiss",
96
+ ja: "今後表示しない",
97
+ ko: "다시 보지 않기",
98
+ fr: "Masquer",
99
+ de: "Ausblenden",
100
+ it: "Nascondi",
101
+ ru: "Скрыть",
102
+ es: "Ocultar",
103
+ pt: "Ocultar",
104
+ };
105
+
106
+ const STAR_S_STYLE_ID = "dsh-star-row-s-style";
107
+ const STAR_S_STYLE = [
108
+ ".dsh-star-row-s{display:flex;align-items:center;gap:8px;flex-wrap:wrap;",
109
+ "font-size:12px;line-height:1.5;color:inherit;opacity:.75;margin-top:10px;",
110
+ "padding-top:8px;border-top:1px solid var(--dsw-alias-border-l2,currentColor)}",
111
+ ".dsh-star-row-s:hover{opacity:1}",
112
+ ".dsh-star-link{display:inline-flex;align-items:center;gap:6px;",
113
+ "color:inherit;text-decoration:none}",
114
+ ".dsh-star-link:hover{text-decoration:underline}",
115
+ ".dsh-star-link svg{width:14px;height:14px;flex:none;display:block}",
116
+ ".dsh-star-row-s .dsh-star-ask{opacity:.85;font-weight:400}",
117
+ ".dsh-star-cta,.dsh-star-hide{font:inherit;font-size:11px;line-height:1;",
118
+ "padding:4px 9px;border-radius:999px;border:1px solid currentColor;",
119
+ "background:transparent;color:inherit;cursor:pointer;flex:none;opacity:.7}",
120
+ ".dsh-star-hide{padding:4px 7px}",
121
+ ".dsh-star-cta:hover,.dsh-star-hide:hover{opacity:1}",
122
+ ].join("");
123
+
124
+ /** 宿主语言标签归一:取 `documentElement.lang` 的前缀,命中 STAR_LANGS 即用。 */
125
+ function starLang(): string {
126
+ const tag = (typeof document !== "undefined" && document.documentElement.lang) || "";
127
+ const low = tag.toLowerCase();
128
+ for (const cand of STAR_LANGS) if (low.startsWith(cand)) return cand;
129
+ return "en";
130
+ }
131
+
132
+ /** 是否已被用户点掉话术(隐私模式下读失败按未关闭处理,只影响本次会话)。 */
133
+ function starDismissed(): boolean {
134
+ try {
135
+ return localStorage.getItem("dsh.star." + STAR_NS + ".dismissed") === "1";
136
+ } catch {
137
+ return false;
138
+ }
139
+ }
140
+
141
+ /** 记住关闭态(隐私模式写失败不报错,话术本次隐藏、刷新复活)。 */
142
+ function starDismiss(): void {
143
+ try {
144
+ localStorage.setItem("dsh.star." + STAR_NS + ".dismissed", "1");
145
+ } catch {
146
+ /* noop */
147
+ }
148
+ }
149
+
150
+ /** 一次性注入 S 档样式。 */
151
+ function injectStarSStyle(d: Document): void {
152
+ if (d.getElementById(STAR_S_STYLE_ID)) return;
153
+ const style = d.createElement("style");
154
+ style.id = STAR_S_STYLE_ID;
155
+ style.textContent = STAR_S_STYLE;
156
+ d.head.appendChild(style);
157
+ }
158
+
159
+ /** 打开仓库页:桌面壳里 window.open 可能被拦,锚点 click 才是两条路径都通的写法。 */
160
+ function openRepo(d: Document): void {
161
+ const a = d.createElement("a");
162
+ a.href = REPO_URL;
163
+ a.target = "_blank";
164
+ a.rel = "noopener noreferrer";
165
+ a.click();
166
+ }
167
+
168
+ /** S 档扩充:把裸链接行升级成「链接 | 话术 | ★ CTA | × 隐藏」,非 S 档返回 null 走原路径。 */
169
+ function extendedStarRow(link: HTMLElement, d: Document): HTMLElement | null {
170
+ if (STAR_VARIANT !== "S") return null;
171
+ if (starDismissed()) return link;
172
+ injectStarSStyle(d);
173
+ link.className = "dsh-star-link";
174
+ const lang = starLang();
175
+ const row = d.createElement("div");
176
+ row.className = "dsh-star-row-s";
177
+ row.appendChild(link);
178
+ const ask = d.createElement("span");
179
+ ask.className = "dsh-star-ask";
180
+ ask.textContent = STAR_COPY[lang]!.ask;
181
+ row.appendChild(ask);
182
+ const cta = d.createElement("button");
183
+ cta.type = "button";
184
+ cta.className = "dsh-star-cta";
185
+ cta.textContent = "★ " + STAR_CTA[lang];
186
+ cta.addEventListener("click", (event: Event) => {
187
+ // 行内的 ★ 是「去点星」:打开仓库页,不隐藏。
188
+ event.preventDefault();
189
+ event.stopPropagation();
190
+ openRepo(d);
191
+ });
192
+ row.appendChild(cta);
193
+ const hide = d.createElement("button");
194
+ hide.type = "button";
195
+ hide.className = "dsh-star-hide";
196
+ hide.textContent = "×";
197
+ hide.title = STAR_HIDE[lang]!;
198
+ hide.setAttribute("aria-label", STAR_HIDE[lang]!);
199
+ hide.addEventListener("click", (event: Event) => {
200
+ // 隐藏才是「别打扰我」:收话术与两钮,链接段永留。
201
+ event.preventDefault();
202
+ event.stopPropagation();
203
+ starDismiss();
204
+ if (row.parentNode) {
205
+ row.parentNode.replaceChild(link, row);
206
+ link.className = "dsh-star-row";
207
+ }
208
+ });
209
+ row.appendChild(hide);
210
+ return row;
211
+ }
212
+ // STAR:EXTENDED:END
213
+ /** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
214
+ export function mountStarRow(doc?: Document): HTMLElement {
215
+ const d = doc ?? document;
216
+ if (!d.getElementById(STYLE_ID)) {
217
+ const tag = d.createElement("style");
218
+ tag.id = STYLE_ID;
219
+ tag.textContent = STYLE_CSS;
220
+ d.head.appendChild(tag);
221
+ }
222
+ const match = REPO_URL.match(/github\.com\/([^/]+\/[^/#?]+)/);
223
+ const repo = match ? match[1]! : "drscrewdriver";
224
+ const a = d.createElement("a");
225
+ a.className = "dsh-star-row";
226
+ a.href = REPO_URL;
227
+ a.target = "_blank";
228
+ a.rel = "noreferrer";
229
+ a.dataset.starNs = STAR_NS;
230
+
231
+ const svg = d.createElementNS("http://www.w3.org/2000/svg", "svg");
232
+ svg.setAttribute("viewBox", "0 0 24 24");
233
+ svg.setAttribute("aria-hidden", "true");
234
+ const path = d.createElementNS("http://www.w3.org/2000/svg", "path");
235
+ path.setAttribute("fill", "currentColor");
236
+ path.setAttribute("d", GITHUB_MARK_PATH);
237
+ svg.appendChild(path);
238
+ a.appendChild(svg);
239
+
240
+ const label = d.createElement("span");
241
+ label.textContent = repo;
242
+ a.appendChild(label);
243
+ // STAR:EXTENDED:BEGIN — S 档在此接管(A/L 副本由 sync 剥除本段)
244
+ const row = extendedStarRow(a, d);
245
+ if (row) return row;
246
+ // STAR:EXTENDED:END
247
+
248
+ if (STAR_VARIANT === "A") {
249
+ const ask = d.createElement("span");
250
+ ask.className = "dsh-star-ask";
251
+ ask.textContent = pickLang().ask;
252
+ a.appendChild(ask);
253
+ }
254
+ // L 档:仅中性仓库链接,无话术。S 档细条在后续批次扩展。
255
+ return a;
256
+ }