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.
package/cordis.patch.yml CHANGED
@@ -1,5 +1,5 @@
1
- # Official bundle layer. `dsh plugin add` applies this into the profile.
2
- # Rows resolve by package name so the installed copy is what boots.
3
- - insert:
4
- - id: cookie-cleaner
5
- name: "dsh-cookie-cleaner"
1
+ # Official bundle layer. `dsh plugin add` applies this into the profile.
2
+ # Rows resolve by package name so the installed copy is what boots.
3
+ - insert:
4
+ - id: cookie-cleaner
5
+ name: "dsh-cookie-cleaner"
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-cookie-cleaner",
3
- "version": "0.6.4",
3
+ "version": "0.7.2",
4
4
  "main": "./src/index.js",
5
5
  "description": "Cookie 清理器:解决桌面客户端启动报 `desktop welcome: Web authentication failed`(HTTP 431,随机端口致 dsh-auth-* cookie 堆积溢出请求头上限)的现象。只读播报 cookie 库里残留的本地登录凭据(dsh-auth-*,含请求头占用水位与距 431 阈值余量),随包分发「客户端完全退出后」可执行的清理命令(独占写锁 + .bak 备份,账号凭据/会话/插件配置不受影响);设置面可体检 profile 的 cordis.patch.yml 并一键修复 `connection.cookieMaxAgeDays`(cookie 有效期,可回滚)。",
6
6
  "engines": {
package/lib/client.js CHANGED
@@ -162,11 +162,18 @@ window.__ModuleLoader__.load({
162
162
  "revert.none": t("没有可回滚的快照(修复一次才会留一份)", "no snapshot to roll back (a successful fix keeps one)", "回滚用スナップショット無し(修復成功時に 1 件保存)", "롤백 스냅샷 없음(복구 성공 시 1개 보관)", "aucun instantané à restaurer (une réparation réussie en garde un)", "kein Snapshot zum Zurückrollen (ein erfolgreicher Fix hinterlässt einen)", "nessuno snapshot da ripristinare (una correzione riuscita ne conserva uno)", "нет снимка для отката (успешное исправление сохраняет один)", "no hay instantánea a la que volver (una reparación correcta guarda una)"),
163
163
  "lastCheck": t("最近体检:{at}", "last check: {at}", "最近の点検:{at}", "마지막 점검: {at}", "dernier contrôle : {at}", "letzte Prüfung: {at}", "ultimo controllo: {at}", "последняя проверка: {at}", "última revisión: {at}"),
164
164
  "guard.title": t("运行期守护(Set-Cookie 退休旧 cookie)", "Runtime guard (retire stale cookies via Set-Cookie)", "ランタイム守護(Set-Cookie で古い cookie を引退)", "런타임 가드 (Set-Cookie 로 오래된 cookie 정리)", "Garde en direct (retirer les vieux cookies via Set-Cookie)", "Laufzeit-Wächter (alte Cookies via Set-Cookie entfernen)", "Guardia runtime (ritira i cookie vecchi via Set-Cookie)", "Страж (удаление старых cookie через Set-Cookie)", "Guardia en ejecución (retirar cookies viejas vía Set-Cookie)"),
165
- "guard.enable": t("启用运行期守护", "Enable runtime guard", "ランタイム守護を有効化", "런타임 가드 켜기", "Activer la garde en direct", "Laufzeit-Wächter aktivieren", "Abilita la guardia runtime", "Включить стража", "Activar guardia en ejecución"),
166
165
  "guard.retireAbove": t("触发阈值(条数 > 此值才退休,0=不设阈值)", "Trigger threshold (retire only when count > this; 0 = no threshold)", "発動しきい値(件数 > この値で引退、0=なし)", "발동 임계값(개수 > 이 값이면 정리, 0=없음)", "Seuil de déclenchement (retirer si nombre > cette valeur ; 0 = aucun)", "Auslöseschwelle (erst wenn Anzahl > dieser Wert; 0 = keine)", "Soglia di attivazione (ritira se conteggio > valore; 0 = nessuna)", "Порог срабатывания (удалять если число > значения; 0 = нет)", "Umbral de disparo (retirar si cantidad > valor; 0 = ninguno)"),
167
166
  "guard.keep": t("保留尾部条数(keep)", "Keep tail count (keep)", "末尾保持件数(keep)", "꼬리 유지 개수(keep)", "Nombre conservé en queue (keep)", "Anzahl am Ende behalten (keep)", "Numero mantenuto in coda (keep)", "Держать в хвосте (keep)", "Cantidad retenida en cola (keep)"),
168
167
  "guard.saved": t("已写入守护设置(HMR 热生效)", "guard settings written (applies via HMR)", "守護設定を書き込みました(HMR で反映)", "가드 설정 기록됨(HMR 적용)", "réglages de la garde écrits (appliqués par HMR)", "Wächter-Einstellungen geschrieben (via HMR)", "impostazioni della guardia scritte (via HMR)", "настройки стража записаны (через HMR)", "ajustes de la guardia escritos (vía HMR)"),
169
168
  "guard.noop": t("无变化,未写入", "no change, nothing written", "変更なし、書き込みなし", "변경 없음, 기록 안 함", "aucun changement", "keine Änderung", "nessun cambiamento", "без изменений", "sin cambios"),
169
+ "guard.enableRetire": t("退休陈旧 cookie(推荐开启)", "Retire stale cookies (recommended)", "古い cookie を引退(推奨)", "오래된 cookie 정리 (권장)", "Retirer les vieux cookies (recommandé)", "Alte Cookies entfernen (empfohlen)", "Ritira i cookie vecchi (consigliato)", "Удалять старые cookie (рекомендуется)", "Retirar cookies viejos (recomendado)"),
170
+ "legacy.title": t("历史注入残留", "Legacy injection residue", "過去の注入残り", "과거 주입 잔여물", "Résidu d'injection historique", "Alt-Injektionsrest", "Residuo di iniezione storica", "Остаток старой инъекции", "Residuo de inyección histórica"),
171
+ "legacy.found": t("旧版「应用端口」写进 profile 的表达式:{expr}", "written into the profile by the old \"apply port\" action: {expr}", "旧版「ポート適用」が profile に書いた式:{expr}", "구버전 \"포트 적용\"이 profile 에 쓴 식: {expr}", "écrit dans le profil par l'ancienne action « appliquer le port » : {expr}", "vom alten \"Port anwenden\" ins Profil geschrieben: {expr}", "scritto nel profilo dalla vecchia azione \"applica porta\": {expr}", "записано в profile старым действием «применить порт»: {expr}", "escrito en el perfil por la antigua acción \"aplicar puerto\": {expr}"),
172
+ "legacy.clean": t("清理这一行", "Clean this row", "この行を整理", "이 행 정리", "Nettoyer cette ligne", "Diese Zeile bereinigen", "Pulisci questa riga", "Очистить эту строку", "Limpiar esta fila"),
173
+ "legacy.cleaned": t("已清理:该键回落到宿主默认", "cleaned: the key falls back to the host default", "整理しました:ホスト既定に戻ります", "정리됨: 호스트 기본값으로 복귀", "nettoyé : la clé revient à la valeur par défaut", "bereinigt: der Schlüssel fällt auf den Host-Standard zurück", "pulito: la chiave torna al valore predefinito", "очищено: ключ возвращается к значению хоста", "limpiado: la clave vuelve al valor del host"),
174
+ "legacy.noop": t("没有可清理的内容", "nothing to clean", "整理するものはありません", "정리할 항목 없음", "rien à nettoyer", "nichts zu bereinigen", "niente da pulire", "нечего очищать", "nada que limpiar"),
175
+ "legacy.unsupported": t("当前宿主(<0.2.2-rc.2)仍需要钉端口这条缓解,只报告不清理", "this host (<0.2.2-rc.2) still relies on the pinned port; reporting only", "このホスト(<0.2.2-rc.2)はポート固定が必要なため報告のみ", "이 호스트(<0.2.2-rc.2)는 포트 고정이 필요해 보고만 합니다", "cet hôte (<0.2.2-rc.2) dépend encore du port fixé ; rapport seulement", "dieser Host (<0.2.2-rc.2) braucht den festen Port noch; nur Bericht", "questo host (<0.2.2-rc.2) richiede ancora la porta fissata; solo segnalazione", "этот хост (<0.2.2-rc.2) ещё полагается на фиксированный порт; только отчёт", "este host (<0.2.2-rc.2) aún depende del puerto fijo; solo informe"),
176
+ "guard.enableBudget": t("抬高请求头预算(默认关,放宽 431 触发线)", "Raise the header budget (off by default; loosens the 431 threshold)", "ヘッダー予算を引き上げ(既定オフ。431 の閾値を緩める)", "헤더 예산 올리기 (기본 꺼짐, 431 임계값 완화)", "Relever le budget d'en-têtes (désactivé par défaut ; assouplit le seuil 431)", "Header-Budget anheben (standardmäßig aus; lockert die 431-Schwelle)", "Alza il budget header (disattivato; allenta la soglia 431)", "Поднять лимит заголовков (по умолчанию выкл.; ослабляет порог 431)", "Elevar el presupuesto de cabeceras (desactivado; relaja el umbral 431)"),
170
177
  "guard.unavailable": t("当前宿主拿不到本插件配置行(无 config-editor),无法在面板改守护设置", "the host exposes no editable row for this plugin; cannot change guard settings here", "このホストでは本プラグインの設定行を取得できず、パネルでは変更不可", "이 호스트에서 플러그인 설정 행을 얻을 수 없어 패널에서 변경 불가", "cet hôte n'expose pas de ligne éditable pour ce plugin", "dieser Host hat keine editierbare Zeile für dieses Plugin", "questo host non espone una riga modificabile per il plugin", "этот хост не даёт редактируемую строку плагина", "este host no expone una fila editable para este plugin")
171
178
  };
172
179
  /** 把共享判定表压平成 `p.P5` 形态的键(宿主只回 code,语言由界面决定)。 */
@@ -198,7 +205,9 @@ window.__ModuleLoader__.load({
198
205
  fix: "/api/dsh-cookie-cleaner/patch/fix",
199
206
  revert: "/api/dsh-cookie-cleaner/patch/revert",
200
207
  guardGet: "/api/dsh-cookie-cleaner/guard/get",
201
- guardSet: "/api/dsh-cookie-cleaner/guard/set"
208
+ guardSet: "/api/dsh-cookie-cleaner/guard/set",
209
+ legacyGet: "/api/dsh-cookie-cleaner/legacy/get",
210
+ legacyClean: "/api/dsh-cookie-cleaner/legacy/clean"
202
211
  };
203
212
  /** POST 一跳;网络/解析失败都归成结构化错误,不让卡片白屏。 */
204
213
  async function postJson(path, body = {}) {
@@ -213,6 +222,215 @@ window.__ModuleLoader__.load({
213
222
  if (reply.value === void 0) throw new Error("empty reply value");
214
223
  return reply.value;
215
224
  }
225
+ // src/client/star-row-copy.ts
226
+ /**
227
+ * star-row 真源(面板 star 快车道行,v1)——纯 DOM 实现,零依赖。
228
+ *
229
+ * 副本约束:生成文件名 star-row-copy.ts,头部须保留 /** 块注释,单行 ≤140
230
+ * 字宽(sidebar-fold 仓 lint 门禁:max-line + file-header)。
231
+ *
232
+ * 契约(对齐 panel-star-row spec):
233
+ * - 渲染一行 <a>:GitHub 单色 SVG + `owner/name`;variant A 追加一句工程话术;
234
+ * - 整行即链接(A/L 档),新标签页打开;不做弹窗、不做按钮交互;
235
+ * - 文案内嵌 10 语,按 `document.documentElement.lang` 前缀自选
236
+ * (同 sidebar-fold `pickDictionary` 口径),不依赖宿主 locale 服务,
237
+ * 避免逐仓动字典文件;
238
+ * - 样式一次性注入 <style data-dsh-star-row>,色随 currentColor,深浅主题自适应;
239
+ * - 副本由 _tools/star-row/sync.mjs 生成到各仓 `src/client/star-row-copy.ts`
240
+ * (文件名含 copy,locale 守卫豁免规则命中),改副本无效,改真源后重跑 sync。
241
+ *
242
+ * 每仓生成时在文件头部烘焙 REPO_URL / STAR_NS / STAR_VARIANT 三个常量。
243
+ */
244
+ /** 生成段:REPO_URL / STAR_NS / STAR_VARIANT 由 sync 注入。 */
245
+ const REPO_URL = "https://github.com/drscrewdriver/dsh-cookie-cleaner";
246
+ const STAR_NS = "cookie-cleaner";
247
+ /** zh 为键集真理源;10 语与 sidebar-fold/manage-session 同集合。 */
248
+ const STAR_COPY = {
249
+ zh: { ask: "觉得省事了?一颗 Star 让工具被更多人看见" },
250
+ en: { ask: "Finding it handy? A star helps more people discover this tool" },
251
+ ja: { ask: "便利でしたら⭐で、このツールがもっと届きます" },
252
+ ko: { ask: "유용했다면 ⭐ 하나로 더 많은 사용자에게 닿습니다" },
253
+ fr: { ask: "Utile ? Une étoile aide cet outil à être découvert" },
254
+ de: { ask: "Nützlich? Ein Stern hilft dem Tool, gesehen zu werden" },
255
+ it: { ask: "Ti è utile? Una stella aiuta questo tool a farsi scoprire" },
256
+ ru: { ask: "Пригодилось? Звезда поможет большему числу людей узнать о tool" },
257
+ es: { ask: "¿Te resulta útil? Una estrella ayuda a que más gente lo descubra" },
258
+ pt: { ask: "Achou útil? Uma estrela ajuda mais pessoas a descobrir a ferramenta" }
259
+ };
260
+ const STAR_LANGS = [
261
+ "zh",
262
+ "en",
263
+ "ja",
264
+ "ko",
265
+ "fr",
266
+ "de",
267
+ "it",
268
+ "ru",
269
+ "es",
270
+ "pt"
271
+ ];
272
+ /** GitHub mark(Simple Icons / octicon 轮廓,24 视口),fill 随 currentColor。 */
273
+ const GITHUB_MARK_PATH = "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 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 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332 -5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 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 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 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 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12";
274
+ const STYLE_ID = "dsh-star-row-style";
275
+ const STYLE_CSS = [
276
+ ".dsh-star-row{display:flex;align-items:center;gap:7px;font-size:12px;",
277
+ "line-height:1.5;color:inherit;text-decoration:none;opacity:.72;padding:3px 0;",
278
+ "margin-top:6px;min-width:0;flex-wrap:wrap}",
279
+ ".dsh-star-row:hover{opacity:1;text-decoration:underline}",
280
+ ".dsh-star-row svg{width:14px;height:14px;flex:none;display:block}",
281
+ ".dsh-star-row .dsh-star-ask{opacity:.85;font-weight:400}"
282
+ ].join("");
283
+ const STAR_CTA = {
284
+ zh: "留颗 Star",
285
+ en: "Star",
286
+ ja: "スター",
287
+ ko: "스타",
288
+ fr: "Star",
289
+ de: "Stern",
290
+ it: "Stella",
291
+ ru: "Звезда",
292
+ es: "Estrella",
293
+ pt: "Estrela"
294
+ };
295
+ /** 隐藏钮的可读名(★ 之外的独立动作,10 语同集)。 */
296
+ const STAR_HIDE = {
297
+ zh: "不再提示",
298
+ en: "Dismiss",
299
+ ja: "今後表示しない",
300
+ ko: "다시 보지 않기",
301
+ fr: "Masquer",
302
+ de: "Ausblenden",
303
+ it: "Nascondi",
304
+ ru: "Скрыть",
305
+ es: "Ocultar",
306
+ pt: "Ocultar"
307
+ };
308
+ const STAR_S_STYLE_ID = "dsh-star-row-s-style";
309
+ const STAR_S_STYLE = [
310
+ ".dsh-star-row-s{display:flex;align-items:center;gap:8px;flex-wrap:wrap;",
311
+ "font-size:12px;line-height:1.5;color:inherit;opacity:.75;margin-top:10px;",
312
+ "padding-top:8px;border-top:1px solid var(--dsw-alias-border-l2,currentColor)}",
313
+ ".dsh-star-row-s:hover{opacity:1}",
314
+ ".dsh-star-link{display:inline-flex;align-items:center;gap:6px;",
315
+ "color:inherit;text-decoration:none}",
316
+ ".dsh-star-link:hover{text-decoration:underline}",
317
+ ".dsh-star-link svg{width:14px;height:14px;flex:none;display:block}",
318
+ ".dsh-star-row-s .dsh-star-ask{opacity:.85;font-weight:400}",
319
+ ".dsh-star-cta,.dsh-star-hide{font:inherit;font-size:11px;line-height:1;",
320
+ "padding:4px 9px;border-radius:999px;border:1px solid currentColor;",
321
+ "background:transparent;color:inherit;cursor:pointer;flex:none;opacity:.7}",
322
+ ".dsh-star-hide{padding:4px 7px}",
323
+ ".dsh-star-cta:hover,.dsh-star-hide:hover{opacity:1}"
324
+ ].join("");
325
+ /** 宿主语言标签归一:取 `documentElement.lang` 的前缀,命中 STAR_LANGS 即用。 */
326
+ function starLang() {
327
+ const low = (typeof document !== "undefined" && document.documentElement.lang || "").toLowerCase();
328
+ for (const cand of STAR_LANGS) if (low.startsWith(cand)) return cand;
329
+ return "en";
330
+ }
331
+ /** 是否已被用户点掉话术(隐私模式下读失败按未关闭处理,只影响本次会话)。 */
332
+ function starDismissed() {
333
+ try {
334
+ return localStorage.getItem("dsh.star." + STAR_NS + ".dismissed") === "1";
335
+ } catch {
336
+ return false;
337
+ }
338
+ }
339
+ /** 记住关闭态(隐私模式写失败不报错,话术本次隐藏、刷新复活)。 */
340
+ function starDismiss() {
341
+ try {
342
+ localStorage.setItem("dsh.star." + STAR_NS + ".dismissed", "1");
343
+ } catch {}
344
+ }
345
+ /** 一次性注入 S 档样式。 */
346
+ function injectStarSStyle(d) {
347
+ if (d.getElementById(STAR_S_STYLE_ID)) return;
348
+ const style = d.createElement("style");
349
+ style.id = STAR_S_STYLE_ID;
350
+ style.textContent = STAR_S_STYLE;
351
+ d.head.appendChild(style);
352
+ }
353
+ /** 打开仓库页:桌面壳里 window.open 可能被拦,锚点 click 才是两条路径都通的写法。 */
354
+ function openRepo(d) {
355
+ const a = d.createElement("a");
356
+ a.href = REPO_URL;
357
+ a.target = "_blank";
358
+ a.rel = "noopener noreferrer";
359
+ a.click();
360
+ }
361
+ /** S 档扩充:把裸链接行升级成「链接 | 话术 | ★ CTA | × 隐藏」,非 S 档返回 null 走原路径。 */
362
+ function extendedStarRow(link, d) {
363
+ if (starDismissed()) return link;
364
+ injectStarSStyle(d);
365
+ link.className = "dsh-star-link";
366
+ const lang = starLang();
367
+ const row = d.createElement("div");
368
+ row.className = "dsh-star-row-s";
369
+ row.appendChild(link);
370
+ const ask = d.createElement("span");
371
+ ask.className = "dsh-star-ask";
372
+ ask.textContent = STAR_COPY[lang].ask;
373
+ row.appendChild(ask);
374
+ const cta = d.createElement("button");
375
+ cta.type = "button";
376
+ cta.className = "dsh-star-cta";
377
+ cta.textContent = "★ " + STAR_CTA[lang];
378
+ cta.addEventListener("click", (event) => {
379
+ event.preventDefault();
380
+ event.stopPropagation();
381
+ openRepo(d);
382
+ });
383
+ row.appendChild(cta);
384
+ const hide = d.createElement("button");
385
+ hide.type = "button";
386
+ hide.className = "dsh-star-hide";
387
+ hide.textContent = "×";
388
+ hide.title = STAR_HIDE[lang];
389
+ hide.setAttribute("aria-label", STAR_HIDE[lang]);
390
+ hide.addEventListener("click", (event) => {
391
+ event.preventDefault();
392
+ event.stopPropagation();
393
+ starDismiss();
394
+ if (row.parentNode) {
395
+ row.parentNode.replaceChild(link, row);
396
+ link.className = "dsh-star-row";
397
+ }
398
+ });
399
+ row.appendChild(hide);
400
+ return row;
401
+ }
402
+ /** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
403
+ function mountStarRow(doc) {
404
+ const d = doc ?? document;
405
+ if (!d.getElementById(STYLE_ID)) {
406
+ const tag = d.createElement("style");
407
+ tag.id = STYLE_ID;
408
+ tag.textContent = STYLE_CSS;
409
+ d.head.appendChild(tag);
410
+ }
411
+ const match = REPO_URL.match(/github\.com\/([^/]+\/[^/#?]+)/);
412
+ const repo = match ? match[1] : "drscrewdriver";
413
+ const a = d.createElement("a");
414
+ a.className = "dsh-star-row";
415
+ a.href = REPO_URL;
416
+ a.target = "_blank";
417
+ a.rel = "noreferrer";
418
+ a.dataset.starNs = STAR_NS;
419
+ const svg = d.createElementNS("http://www.w3.org/2000/svg", "svg");
420
+ svg.setAttribute("viewBox", "0 0 24 24");
421
+ svg.setAttribute("aria-hidden", "true");
422
+ const path = d.createElementNS("http://www.w3.org/2000/svg", "path");
423
+ path.setAttribute("fill", "currentColor");
424
+ path.setAttribute("d", GITHUB_MARK_PATH);
425
+ svg.appendChild(path);
426
+ a.appendChild(svg);
427
+ const label = d.createElement("span");
428
+ label.textContent = repo;
429
+ a.appendChild(label);
430
+ const row = extendedStarRow(a, d);
431
+ if (row) return row;
432
+ return a;
433
+ }
216
434
  // src/client/card.tsx
217
435
  /**
218
436
  * 面板卡片:体检 / 修复 / 回滚三个按钮 + P1-P12 明细。
@@ -313,9 +531,98 @@ window.__ModuleLoader__.load({
313
531
  });
314
532
  }
315
533
  /**
316
- * 运行期守护面板:一个开关(runtimeGuard)+ 两个阈值(retireAbove / keep)。
534
+ * 运行期守护面板:两个独立开关(retireStale 清理 / raiseHeaderBudget 抬预算)+ 两个阈值(retireAbove / keep)。
535
+ * v0.7.0 之前是一个 runtimeGuard 全包——用户为了清 cookie 被迫放宽 431 阈值,故拆开。
317
536
  * 读写都走后端桥(configEditor 写本插件自己那行),写后回显生效值——不凭手写 YAML。
318
537
  */
538
+ /**
539
+ * 历史注入残留面板(v0.7.1):旧版插件写进 profile 的 `port` 表达式还在不在。
540
+ *
541
+ * 为什么单独一块而不是塞进体检结果:这不是"配置对不对",是"插件自己留下的东西还在不在",
542
+ * 与 cookie 寿命无关。清理只在官方已接管 cookie 清理的宿主(0.2.2-rc.2+)上开放,
543
+ * 更早的宿主仍需要钉端口这条缓解,所以那里只显示不提供按钮。
544
+ */
545
+ function LegacyPanel({ t }) {
546
+ const [v, setV] = react.useState(void 0);
547
+ const [busy, setBusy] = react.useState(false);
548
+ const [note, setNote] = react.useState("");
549
+ const mounted = react.useRef(true);
550
+ react.useEffect(() => {
551
+ mounted.current = true;
552
+ postJson(routes.legacyGet, {}).then((next) => {
553
+ if (mounted.current) setV(next);
554
+ }).catch(() => {});
555
+ return () => {
556
+ mounted.current = false;
557
+ };
558
+ }, []);
559
+ if (v === void 0) return null;
560
+ if (v.available === false || v.found !== true) return null;
561
+ const clean = async () => {
562
+ setBusy(true);
563
+ setNote("");
564
+ try {
565
+ const next = await postJson(routes.legacyClean, {});
566
+ if (!mounted.current) return;
567
+ setV(next.state ?? v);
568
+ setNote(next.kind === "cleaned" ? t("legacy.cleaned") : t("legacy.noop"));
569
+ } catch (error) {
570
+ if (mounted.current) setNote(render(t("state.failed"), { message: String(error.message ?? error) }));
571
+ } finally {
572
+ if (mounted.current) setBusy(false);
573
+ }
574
+ };
575
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
576
+ style: {
577
+ display: "grid",
578
+ gap: 6,
579
+ marginTop: 8,
580
+ paddingTop: 8,
581
+ borderTop: "1px solid var(--dsw-color-border)"
582
+ },
583
+ children: [
584
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
585
+ style: { fontWeight: 600 },
586
+ children: t("legacy.title")
587
+ }),
588
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
589
+ style: {
590
+ fontSize: "0.85em",
591
+ color: "var(--dsw-color-muted)"
592
+ },
593
+ children: render(t("legacy.found"), { expr: v.expression ?? "?" })
594
+ }),
595
+ v.cleanupSupported === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
596
+ type: "button",
597
+ disabled: busy,
598
+ onClick: () => void clean(),
599
+ style: {
600
+ justifySelf: "start",
601
+ padding: "3px 10px",
602
+ borderRadius: 6,
603
+ border: "1px solid var(--dsw-color-border)",
604
+ background: "var(--dsw-color-surface)",
605
+ color: "var(--dsw-color-text)",
606
+ cursor: busy ? "default" : "pointer"
607
+ },
608
+ children: t("legacy.clean")
609
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
610
+ style: {
611
+ fontSize: "0.85em",
612
+ color: "var(--dsw-color-muted)"
613
+ },
614
+ children: t("legacy.unsupported")
615
+ }),
616
+ note !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
617
+ style: {
618
+ fontSize: "0.85em",
619
+ color: "var(--dsw-color-text)"
620
+ },
621
+ children: note
622
+ }) : null
623
+ ]
624
+ });
625
+ }
319
626
  function GuardPanel({ t }) {
320
627
  const [g, setG] = react.useState(void 0);
321
628
  const [busy, setBusy] = react.useState(false);
@@ -349,7 +656,8 @@ window.__ModuleLoader__.load({
349
656
  setNote("");
350
657
  try {
351
658
  const v = await postJson(routes.guardSet, {
352
- runtimeGuard: next.runtimeGuard,
659
+ retireStale: next.retireStale,
660
+ raiseHeaderBudget: next.raiseHeaderBudget,
353
661
  maxHeaderBytes: next.maxHeaderBytes,
354
662
  keep: next.keep,
355
663
  retireAbove: next.retireAbove
@@ -395,13 +703,29 @@ window.__ModuleLoader__.load({
395
703
  },
396
704
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
397
705
  type: "checkbox",
398
- checked: g.runtimeGuard,
706
+ checked: g.retireStale,
399
707
  disabled: busy,
400
708
  onChange: (e) => void commit({
401
709
  ...g,
402
- runtimeGuard: e.target.checked
710
+ retireStale: e.target.checked
403
711
  })
404
- }), t("guard.enable")]
712
+ }), t("guard.enableRetire")]
713
+ }),
714
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
715
+ style: {
716
+ display: "flex",
717
+ alignItems: "center",
718
+ gap: 6
719
+ },
720
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
721
+ type: "checkbox",
722
+ checked: g.raiseHeaderBudget,
723
+ disabled: busy,
724
+ onChange: (e) => void commit({
725
+ ...g,
726
+ raiseHeaderBudget: e.target.checked
727
+ })
728
+ }), t("guard.enableBudget")]
405
729
  }),
406
730
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
407
731
  style: {
@@ -578,6 +902,7 @@ window.__ModuleLoader__.load({
578
902
  t
579
903
  }),
580
904
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuardPanel, { t }),
905
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LegacyPanel, { t }),
581
906
  state?.lastFix ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
582
907
  style: {
583
908
  fontSize: "0.85em",
@@ -598,7 +923,10 @@ window.__ModuleLoader__.load({
598
923
  color: "var(--dsw-color-muted)"
599
924
  },
600
925
  children: render(t("lastCheck"), { at: state.checkedAt })
601
- }) : null
926
+ }) : null,
927
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { ref: (node) => {
928
+ if (node && !node.firstChild) node.appendChild(mountStarRow());
929
+ } })
602
930
  ]
603
931
  });
604
932
  }