dsh-wtq-pool 1.0.51 → 1.2.0

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/lib/client.js CHANGED
@@ -350,7 +350,7 @@ window.__ModuleLoader__.load({
350
350
  if (stopped) return;
351
351
  if (next.enabled === false) {
352
352
  setPoints(null);
353
- window.clearTimeout(timer);
353
+ schedule(null);
354
354
  return;
355
355
  }
356
356
  const shown = next.show === true ? next : null;
@@ -559,7 +559,8 @@ window.__ModuleLoader__.load({
559
559
  "card.hint": "下方是完整面板:账号、模型选择、签到与连接检查都在这一页里。",
560
560
  "card.open": "重新载入面板",
561
561
  "card.frameTitle": "账号池面板",
562
- "card.missing": "面板资源没有装好,重新安装这个插件即可。"
562
+ "card.missing": "面板资源没有装好,重新安装这个插件即可。",
563
+ "card.probeFailed": "面板没有打开:"
563
564
  };
564
565
  const en = {
565
566
  "row.title": "WTQ Pool",
@@ -568,7 +569,8 @@ window.__ModuleLoader__.load({
568
569
  "card.hint": "The full panel sits below: accounts, model selection, check-in and the connection check are all on this page.",
569
570
  "card.open": "Reload panel",
570
571
  "card.frameTitle": "Account pool panel",
571
- "card.missing": "The panel assets are missing; reinstalling this plugin restores them."
572
+ "card.missing": "The panel assets are missing; reinstalling this plugin restores them.",
573
+ "card.probeFailed": "The panel did not open:"
572
574
  };
573
575
  /**
574
576
  * The embedded panel.
@@ -584,6 +586,7 @@ window.__ModuleLoader__.load({
584
586
  const [generation, setGeneration] = react.useState(0);
585
587
  const [measured, setMeasured] = react.useState(0);
586
588
  const [missing, setMissing] = react.useState(false);
589
+ const [probeFailure, setProbeFailure] = react.useState(null);
587
590
  const frameRef = react.useRef(null);
588
591
  const appearance = react.useMemo(() => {
589
592
  if (typeof document === "undefined") return {
@@ -600,14 +603,43 @@ window.__ModuleLoader__.load({
600
603
  if (view === "summary") return void 0;
601
604
  let live = true;
602
605
  setMissing(false);
606
+ setProbeFailure(null);
603
607
  const attempts = 3;
604
608
  const probe = (remaining) => {
605
609
  fetch(`${PANEL_BASE}/panel.css`).then((response) => {
606
610
  if (!live) return;
607
- if (response.ok || remaining <= 1) setMissing(!response.ok);
608
- else setTimeout(() => probe(remaining - 1), 500);
611
+ if (response.ok) {
612
+ setMissing(false);
613
+ setProbeFailure(null);
614
+ return;
615
+ }
616
+ if (remaining > 1) {
617
+ setTimeout(() => probe(remaining - 1), 500);
618
+ return;
619
+ }
620
+ if (response.status === 404) {
621
+ setMissing(true);
622
+ setProbeFailure(null);
623
+ return;
624
+ }
625
+ response.text().then((body) => {
626
+ if (!live) return;
627
+ let detail = "";
628
+ try {
629
+ const parsed = JSON.parse(body);
630
+ detail = typeof parsed.error === "string" ? parsed.error : "";
631
+ } catch {}
632
+ setMissing(true);
633
+ setProbeFailure(detail === "" ? `HTTP ${response.status}` : `HTTP ${response.status}: ${detail}`);
634
+ }).catch(() => {
635
+ if (!live) return;
636
+ setMissing(true);
637
+ setProbeFailure(`HTTP ${response.status}`);
638
+ });
609
639
  }).catch(() => {
610
- if (live && remaining <= 1) setMissing(true);
640
+ if (!live || remaining > 1) return;
641
+ setMissing(true);
642
+ setProbeFailure(null);
611
643
  });
612
644
  };
613
645
  probe(attempts);
@@ -619,6 +651,7 @@ window.__ModuleLoader__.load({
619
651
  if (view === "summary") return void 0;
620
652
  const frame = frameRef.current;
621
653
  const measure = () => {
654
+ if (document.hidden === true) return;
622
655
  const doc = frame === null ? null : frame.contentDocument;
623
656
  if (doc === null || doc.body === null) return;
624
657
  const height = Math.min(FRAME_MAX_HEIGHT, doc.body.scrollHeight + FRAME_BORDER);
@@ -637,7 +670,7 @@ window.__ModuleLoader__.load({
637
670
  const frame = frameRef.current;
638
671
  if (frame !== null) frame.src = panelUrl(appearance);
639
672
  }
640
- }, t("card.open"))), missing ? react.createElement("div", { style: MISSING_STYLE }, t("card.missing")) : react.createElement("iframe", {
673
+ }, t("card.open"))), missing ? react.createElement("div", { style: MISSING_STYLE }, probeFailure === null ? t("card.missing") : `${t("card.probeFailed")} ${probeFailure}`) : react.createElement("iframe", {
641
674
  key: generation,
642
675
  ref: frameRef,
643
676
  title: t("card.frameTitle"),
@@ -721,7 +754,6 @@ window.__ModuleLoader__.load({
721
754
  ...composerEn
722
755
  }
723
756
  }), "dsh-wtq-pool: copy");
724
- ctx.locale.bind(NAMESPACE);
725
757
  } catch (error) {
726
758
  console.error("[dsh-wtq-pool] the copy did not register (the labels fall back to their keys):", error);
727
759
  }
package/lib/index.d.ts CHANGED
@@ -73,8 +73,6 @@ interface Config {
73
73
  removedAccounts?: unknown[];
74
74
  /** Whether the credits readout is shown beside the composer. */
75
75
  showComposerPoints?: boolean;
76
- /** Whether the client name is rewritten for the domestic host's channel check. */
77
- rewriteClientName?: boolean;
78
76
  /** How each Trae/Qoder region spreads requests. */
79
77
  sourceDistributions?: Record<string, string>;
80
78
  }