baa-conductor

git clone 

commit
a7ba96e
parent
ef2db49
author
im_wower
date
2026-03-23 08:06:27 +0800 CST
fix(firefox): restore tracked tab and credential panels
3 files changed,  +111, -1
M plugins/baa-firefox/controller.css
+1, -1
1@@ -109,7 +109,7 @@ button:hover {
2 
3 .grid {
4   display: grid;
5-  grid-template-columns: repeat(2, minmax(0, 1fr));
6+  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
7   gap: 14px;
8   margin-bottom: 18px;
9 }
M plugins/baa-firefox/controller.html
+39, -0
 1@@ -34,6 +34,45 @@
 2         <p id="control-mode" class="value off">连接中</p>
 3         <p id="control-meta" class="meta">等待同步</p>
 4       </article>
 5+
 6+      <article class="card">
 7+        <p class="label">追踪标签页</p>
 8+        <p id="tracked-count" class="value off">0</p>
 9+        <p id="tracked-meta" class="meta">等待平台扫描</p>
10+      </article>
11+
12+      <article class="card">
13+        <p class="label">有效凭证</p>
14+        <p id="credential-count" class="value off">0</p>
15+        <p id="credential-meta" class="meta">等待凭证快照</p>
16+      </article>
17+
18+      <article class="card">
19+        <p class="label">已发现端点</p>
20+        <p id="endpoint-count" class="value off">0</p>
21+        <p id="endpoint-meta" class="meta">等待端点发现</p>
22+      </article>
23+    </section>
24+
25+    <section class="panel">
26+      <div class="panel-head">
27+        <h2>平台状态</h2>
28+      </div>
29+      <pre id="platform-view" class="code"></pre>
30+    </section>
31+
32+    <section class="panel">
33+      <div class="panel-head">
34+        <h2>凭证快照</h2>
35+      </div>
36+      <pre id="credential-view" class="code"></pre>
37+    </section>
38+
39+    <section class="panel">
40+      <div class="panel-head">
41+        <h2>已发现端点</h2>
42+      </div>
43+      <pre id="endpoint-view" class="code"></pre>
44     </section>
45 
46     <section class="panel">
M plugins/baa-firefox/controller.js
+71, -0
 1@@ -1235,6 +1235,35 @@ function getTotalEndpointCount() {
 2   return PLATFORM_ORDER.reduce((sum, platform) => sum + getEndpointCount(platform), 0);
 3 }
 4 
 5+function formatTrackedMeta() {
 6+  const labels = PLATFORM_ORDER
 7+    .filter((platform) => Number.isInteger(state.trackedTabs[platform]))
 8+    .map((platform) => `${platformLabel(platform)}#${state.trackedTabs[platform]}`);
 9+  return labels.length > 0 ? labels.join(" · ") : "当前没有正在追踪的平台标签页";
10+}
11+
12+function formatCredentialMeta() {
13+  const labels = PLATFORM_ORDER
14+    .map((platform) => {
15+      const credential = getCredentialState(platform);
16+      if (!credential.valid) return null;
17+      return `${platformLabel(platform)}(${credential.headerCount})`;
18+    })
19+    .filter(Boolean);
20+  return labels.length > 0 ? labels.join(" · ") : "当前没有有效凭证";
21+}
22+
23+function formatEndpointMeta() {
24+  const labels = PLATFORM_ORDER
25+    .map((platform) => {
26+      const count = getEndpointCount(platform);
27+      if (count <= 0) return null;
28+      return `${platformLabel(platform)}(${count})`;
29+    })
30+    .filter(Boolean);
31+  return labels.length > 0 ? labels.join(" · ") : "当前没有发现端点";
32+}
33+
34 function renderPlatformStatus() {
35   const lines = [];
36   for (const platform of PLATFORM_ORDER) {
37@@ -1311,6 +1340,9 @@ function renderControlSnapshot() {
38 function render() {
39   const wsSnapshot = cloneWsState(state.wsState);
40   const controlSnapshot = cloneControlState(state.controlState);
41+  const trackedCount = getTrackedCount();
42+  const credentialCount = getCredentialCount();
43+  const endpointCount = getTotalEndpointCount();
44 
45   if (ui.wsStatus) {
46     ui.wsStatus.textContent = formatWsConnectionLabel(wsSnapshot);
47@@ -1326,6 +1358,36 @@ function render() {
48   if (ui.controlMeta) {
49     ui.controlMeta.textContent = formatControlMeta(controlSnapshot);
50   }
51+  if (ui.trackedCount) {
52+    ui.trackedCount.textContent = String(trackedCount);
53+    ui.trackedCount.className = `value ${trackedCount > 0 ? "on" : "off"}`;
54+  }
55+  if (ui.trackedMeta) {
56+    ui.trackedMeta.textContent = formatTrackedMeta();
57+  }
58+  if (ui.credentialCount) {
59+    ui.credentialCount.textContent = String(credentialCount);
60+    ui.credentialCount.className = `value ${credentialCount > 0 ? "on" : "off"}`;
61+  }
62+  if (ui.credentialMeta) {
63+    ui.credentialMeta.textContent = formatCredentialMeta();
64+  }
65+  if (ui.endpointCount) {
66+    ui.endpointCount.textContent = String(endpointCount);
67+    ui.endpointCount.className = `value ${endpointCount > 0 ? "on" : "off"}`;
68+  }
69+  if (ui.endpointMeta) {
70+    ui.endpointMeta.textContent = formatEndpointMeta();
71+  }
72+  if (ui.platformView) {
73+    ui.platformView.textContent = renderPlatformStatus();
74+  }
75+  if (ui.credentialView) {
76+    ui.credentialView.textContent = renderHeaderSnapshot();
77+  }
78+  if (ui.endpointView) {
79+    ui.endpointView.textContent = renderEndpointSnapshot();
80+  }
81   if (ui.wsView) {
82     ui.wsView.textContent = renderWsSnapshot();
83   }
84@@ -2492,6 +2554,15 @@ function bindUi() {
85   ui.controlMode = qs("control-mode");
86   ui.controlMeta = qs("control-meta");
87   ui.controlView = qs("control-view");
88+  ui.trackedCount = qs("tracked-count");
89+  ui.trackedMeta = qs("tracked-meta");
90+  ui.credentialCount = qs("credential-count");
91+  ui.credentialMeta = qs("credential-meta");
92+  ui.endpointCount = qs("endpoint-count");
93+  ui.endpointMeta = qs("endpoint-meta");
94+  ui.platformView = qs("platform-view");
95+  ui.credentialView = qs("credential-view");
96+  ui.endpointView = qs("endpoint-view");
97 
98   for (const action of ["pause", "resume", "drain"]) {
99     qs(`${action}-btn`).addEventListener("click", () => {