playcanvas-agent-bridge-cli 0.2.2 → 0.3.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.
@@ -15,10 +15,56 @@
15
15
 
16
16
  let ws = null;
17
17
  let reconnectTimer = null;
18
+ let heartbeatTimer = null;
19
+ let stopped = false;
18
20
  let config = DEFAULT_CONFIG;
19
21
  let tabInfo = {};
22
+ let extensionVersion = null;
20
23
  const pending = new Map();
21
24
 
25
+ function isExtensionContextInvalidated(error) {
26
+ return String((error && error.message) || error)
27
+ .toLowerCase()
28
+ .includes("extension context invalidated");
29
+ }
30
+
31
+ function stopBridge() {
32
+ if (stopped) return;
33
+ stopped = true;
34
+ if (reconnectTimer) {
35
+ clearTimeout(reconnectTimer);
36
+ reconnectTimer = null;
37
+ }
38
+ if (heartbeatTimer) {
39
+ clearInterval(heartbeatTimer);
40
+ heartbeatTimer = null;
41
+ }
42
+ for (const waiter of pending.values()) {
43
+ clearTimeout(waiter.timer);
44
+ waiter.reject(new Error("Extension context invalidated."));
45
+ }
46
+ pending.clear();
47
+ if (ws) {
48
+ try {
49
+ ws.close();
50
+ } catch {
51
+ // The extension context is already gone.
52
+ }
53
+ ws = null;
54
+ }
55
+ }
56
+
57
+ function getExtensionVersion() {
58
+ if (extensionVersion) return extensionVersion;
59
+ try {
60
+ extensionVersion = chrome.runtime.getManifest().version;
61
+ return extensionVersion;
62
+ } catch (error) {
63
+ if (isExtensionContextInvalidated(error)) stopBridge();
64
+ return null;
65
+ }
66
+ }
67
+
22
68
  function requestId() {
23
69
  if (crypto && crypto.randomUUID) return crypto.randomUUID();
24
70
  return "req-" + Date.now().toString(36) + "-" + Math.random().toString(36).slice(2);
@@ -36,11 +82,28 @@
36
82
 
37
83
  function requestRuntime(message) {
38
84
  return new Promise((resolve) => {
85
+ if (stopped) {
86
+ resolve(null);
87
+ return;
88
+ }
39
89
  try {
40
90
  chrome.runtime.sendMessage(message, (response) => {
91
+ try {
92
+ const lastError = chrome.runtime.lastError;
93
+ if (lastError) {
94
+ if (isExtensionContextInvalidated(lastError)) stopBridge();
95
+ resolve(null);
96
+ return;
97
+ }
98
+ } catch (error) {
99
+ if (isExtensionContextInvalidated(error)) stopBridge();
100
+ resolve(null);
101
+ return;
102
+ }
41
103
  resolve(response || null);
42
104
  });
43
- } catch {
105
+ } catch (error) {
106
+ if (isExtensionContextInvalidated(error)) stopBridge();
44
107
  resolve(null);
45
108
  }
46
109
  });
@@ -76,6 +139,13 @@
76
139
  const message = event.data;
77
140
  if (!message || message.channel !== CHANNEL || message.side !== "main") return;
78
141
 
142
+ if (message.type === "ready") {
143
+ sendTargetUpdate().catch((error) => {
144
+ if (isExtensionContextInvalidated(error)) stopBridge();
145
+ });
146
+ return;
147
+ }
148
+
79
149
  if (message.type === "response" && message.id) {
80
150
  const waiter = pending.get(message.id);
81
151
  if (!waiter) return;
@@ -111,7 +181,7 @@
111
181
  clientId,
112
182
  tabId: tabInfo.tabId,
113
183
  windowId: tabInfo.windowId,
114
- extensionVersion: chrome.runtime.getManifest().version,
184
+ extensionVersion: getExtensionVersion(),
115
185
  ...(response.data || {}),
116
186
  url: (response.data && response.data.url) || location.href,
117
187
  title: (response.data && response.data.title) || document.title || "",
@@ -122,7 +192,7 @@
122
192
  clientId,
123
193
  tabId: tabInfo.tabId,
124
194
  windowId: tabInfo.windowId,
125
- extensionVersion: chrome.runtime.getManifest().version,
195
+ extensionVersion: getExtensionVersion(),
126
196
  url: location.href,
127
197
  title: document.title || "",
128
198
  ready: false
@@ -131,16 +201,21 @@
131
201
  }
132
202
 
133
203
  async function sendTargetUpdate() {
134
- if (!ws || ws.readyState !== WebSocket.OPEN) return;
135
- ws.send(
136
- JSON.stringify({
137
- type: "target:update",
138
- target: await describeTarget()
139
- })
140
- );
204
+ if (stopped || !ws || ws.readyState !== WebSocket.OPEN) return;
205
+ try {
206
+ ws.send(
207
+ JSON.stringify({
208
+ type: "target:update",
209
+ target: await describeTarget()
210
+ })
211
+ );
212
+ } catch (error) {
213
+ if (isExtensionContextInvalidated(error)) stopBridge();
214
+ }
141
215
  }
142
216
 
143
217
  function scheduleReconnect() {
218
+ if (stopped) return;
144
219
  if (reconnectTimer) return;
145
220
  reconnectTimer = setTimeout(() => {
146
221
  reconnectTimer = null;
@@ -149,6 +224,7 @@
149
224
  }
150
225
 
151
226
  function connect() {
227
+ if (stopped) return;
152
228
  if (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING)) {
153
229
  return;
154
230
  }
@@ -166,7 +242,9 @@
166
242
 
167
243
  ws.addEventListener("open", () => {
168
244
  console.info("[pcbridge] connected to local daemon");
169
- sendTargetUpdate();
245
+ sendTargetUpdate().catch((error) => {
246
+ if (isExtensionContextInvalidated(error)) stopBridge();
247
+ });
170
248
  });
171
249
 
172
250
  ws.addEventListener("message", async (event) => {
@@ -181,24 +259,32 @@
181
259
 
182
260
  try {
183
261
  const response = await callMain(message.method, message.params || {}, message.timeoutMs);
184
- ws.send(
185
- JSON.stringify({
186
- type: "response",
187
- id: message.id,
188
- ok: true,
189
- data: response.data,
190
- meta: response.meta || {}
191
- })
192
- );
262
+ if (!stopped && ws && ws.readyState === WebSocket.OPEN) {
263
+ ws.send(
264
+ JSON.stringify({
265
+ type: "response",
266
+ id: message.id,
267
+ ok: true,
268
+ data: response.data,
269
+ meta: response.meta || {}
270
+ })
271
+ );
272
+ }
193
273
  } catch (error) {
194
- ws.send(
195
- JSON.stringify({
196
- type: "response",
197
- id: message.id,
198
- ok: false,
199
- error: serializeError(error)
200
- })
201
- );
274
+ if (isExtensionContextInvalidated(error)) {
275
+ stopBridge();
276
+ return;
277
+ }
278
+ if (!stopped && ws && ws.readyState === WebSocket.OPEN) {
279
+ ws.send(
280
+ JSON.stringify({
281
+ type: "response",
282
+ id: message.id,
283
+ ok: false,
284
+ error: serializeError(error)
285
+ })
286
+ );
287
+ }
202
288
  }
203
289
  });
204
290
 
@@ -217,10 +303,20 @@
217
303
 
218
304
  async function start() {
219
305
  config = await loadConfig();
306
+ if (stopped) return;
307
+ extensionVersion = getExtensionVersion();
308
+ if (stopped) return;
220
309
  tabInfo = await getTabInfo();
310
+ if (stopped) return;
221
311
  connect();
222
- setInterval(sendTargetUpdate, 2000);
312
+ heartbeatTimer = setInterval(() => {
313
+ sendTargetUpdate().catch((error) => {
314
+ if (isExtensionContextInvalidated(error)) stopBridge();
315
+ });
316
+ }, 2000);
223
317
  }
224
318
 
225
- start();
319
+ start().catch((error) => {
320
+ if (isExtensionContextInvalidated(error)) stopBridge();
321
+ });
226
322
  })();
package/extension/main.js CHANGED
@@ -5,6 +5,80 @@
5
5
  if (window.__pcbridgeMainWorld) return;
6
6
  window.__pcbridgeMainWorld = true;
7
7
 
8
+ const MAX_LOGS = 500;
9
+ const capturedLogs = [];
10
+ let nextLogSeq = 1;
11
+
12
+ function formatLogArg(value) {
13
+ if (typeof value === "string") return value;
14
+ if (value instanceof Error) return value.stack || value.message;
15
+ try {
16
+ return JSON.stringify(serialize(value, {
17
+ maxDepth: 3,
18
+ maxArray: 20,
19
+ maxKeys: 30,
20
+ maxString: 1000
21
+ }));
22
+ } catch {
23
+ return String(value);
24
+ }
25
+ }
26
+
27
+ function pushLog(level, args, source) {
28
+ const list = Array.from(args || []);
29
+ const entry = {
30
+ seq: nextLogSeq,
31
+ time: new Date().toISOString(),
32
+ level,
33
+ source,
34
+ text: list.map(formatLogArg).join(" "),
35
+ args: list.map((item) => serialize(item, {
36
+ maxDepth: 3,
37
+ maxArray: 20,
38
+ maxKeys: 30,
39
+ maxString: 1000
40
+ }))
41
+ };
42
+ nextLogSeq += 1;
43
+ capturedLogs.push(entry);
44
+ while (capturedLogs.length > MAX_LOGS) capturedLogs.shift();
45
+ }
46
+
47
+ function patchConsoleCapture() {
48
+ if (window.__pcbridgeConsoleCapture) return;
49
+ window.__pcbridgeConsoleCapture = true;
50
+
51
+ const methods = ["debug", "log", "info", "warn", "error"];
52
+ for (const method of methods) {
53
+ const original = window.console && window.console[method];
54
+ if (typeof original !== "function") continue;
55
+ window.console[method] = function pcbridgeConsoleProxy(...args) {
56
+ try {
57
+ pushLog(method === "log" ? "info" : method, args, "console");
58
+ } catch {
59
+ // Preserve page console behavior even if log serialization fails.
60
+ }
61
+ return original.apply(this, args);
62
+ };
63
+ }
64
+
65
+ window.addEventListener("error", (event) => {
66
+ pushLog("error", [
67
+ event.message || "Uncaught error",
68
+ event.filename || "",
69
+ event.lineno || 0,
70
+ event.colno || 0,
71
+ event.error || null
72
+ ], "window.error");
73
+ });
74
+
75
+ window.addEventListener("unhandledrejection", (event) => {
76
+ pushLog("error", ["Unhandled promise rejection", event.reason || null], "unhandledrejection");
77
+ });
78
+ }
79
+
80
+ patchConsoleCapture();
81
+
8
82
  function safeGetEditorValue(value, path) {
9
83
  try {
10
84
  return value && typeof value.get === "function" ? value.get(path) : undefined;
@@ -108,18 +182,72 @@
108
182
  return normalize(value, 0);
109
183
  }
110
184
 
185
+ function getTargetKind() {
186
+ if (location.hostname === "launch.playcanvas.com") return "launch";
187
+ if (location.pathname.startsWith("/editor")) return "editor";
188
+ return "playcanvas";
189
+ }
190
+
191
+ function getRuntimeApp() {
192
+ try {
193
+ if (
194
+ window.pc &&
195
+ window.pc.Application &&
196
+ typeof window.pc.Application.getApplication === "function"
197
+ ) {
198
+ const app = window.pc.Application.getApplication();
199
+ if (app) return app;
200
+ }
201
+ } catch {
202
+ // Fall through to common global app locations.
203
+ }
204
+
205
+ if (window.app && window.app.graphicsDevice) return window.app;
206
+ if (window.pc && window.pc.app && window.pc.app.graphicsDevice) return window.pc.app;
207
+ return null;
208
+ }
209
+
210
+ function getPrimaryCanvas(app) {
211
+ return (
212
+ (app && app.graphicsDevice && app.graphicsDevice.canvas) ||
213
+ (app && app.canvas) ||
214
+ document.querySelector("canvas")
215
+ );
216
+ }
217
+
218
+ function getSceneIdFromUrl() {
219
+ const editorMatch = location.href.match(/\/editor\/scene\/([^/?#]+)/);
220
+ if (editorMatch) return editorMatch[1];
221
+
222
+ if (location.hostname === "launch.playcanvas.com") {
223
+ const launchMatch = location.pathname.match(/^\/([^/?#]+)/);
224
+ if (launchMatch) return launchMatch[1];
225
+ }
226
+
227
+ return undefined;
228
+ }
229
+
111
230
  function describeTarget() {
112
231
  const config = window.config || {};
113
- const ready = Boolean(window.editor && window.editor.api && window.editor.api.globals);
114
- const matchScene = location.href.match(/\/editor\/scene\/([^/?#]+)/);
232
+ const kind = getTargetKind();
233
+ const editorReady = Boolean(window.editor && window.editor.api && window.editor.api.globals);
234
+ const app = getRuntimeApp();
235
+ const canvasCount = document.querySelectorAll("canvas").length;
236
+ const launchReady = kind === "launch" && document.readyState !== "loading";
237
+ const ready = editorReady || launchReady;
115
238
  return {
239
+ kind,
116
240
  url: location.href,
117
241
  title: document.title || "",
118
242
  ready,
243
+ hasEditor: Boolean(window.editor),
244
+ hasPc: Boolean(window.pc),
245
+ hasRuntimeApp: Boolean(app),
246
+ canvasCount,
119
247
  projectId: config.project && config.project.id ? String(config.project.id) : undefined,
120
248
  sceneId:
121
249
  (config.scene && config.scene.id ? String(config.scene.id) : undefined) ||
122
- (matchScene ? matchScene[1] : undefined),
250
+ getSceneIdFromUrl(),
123
251
  branchId:
124
252
  (config.self && config.self.branch && config.self.branch.id
125
253
  ? String(config.self.branch.id)
@@ -257,18 +385,32 @@
257
385
  return serialize(await withTimeout(fn(context), timeoutMs));
258
386
  }
259
387
 
260
- function captureViewport(params) {
261
- const app = window.editor.call("viewport:app");
262
- if (!app) throw new Error("Viewport app not found.");
263
- const device = app.graphicsDevice;
264
- const gl = device && device.gl;
265
- if (!gl) throw new Error("WebGL context not found.");
388
+ function encodeCanvas(canvas, params, source) {
389
+ const maxWidth = Number(params.maxWidth || 1200);
390
+ let outWidth = canvas.width;
391
+ let outHeight = canvas.height;
392
+ if (maxWidth > 0 && canvas.width > maxWidth) {
393
+ outWidth = maxWidth;
394
+ outHeight = Math.round(canvas.height * (maxWidth / canvas.width));
395
+ }
266
396
 
267
- window.editor.call("viewport:render");
268
- app.tick();
397
+ const dstCanvas = document.createElement("canvas");
398
+ dstCanvas.width = outWidth;
399
+ dstCanvas.height = outHeight;
400
+ dstCanvas.getContext("2d").drawImage(canvas, 0, 0, outWidth, outHeight);
269
401
 
270
- const width = device.width;
271
- const height = device.height;
402
+ const mime = params.format === "webp" ? "image/webp" : "image/png";
403
+ const dataUrl = dstCanvas.toDataURL(mime, Number(params.quality || 0.85));
404
+ return {
405
+ mime,
406
+ width: outWidth,
407
+ height: outHeight,
408
+ source,
409
+ base64: dataUrl.split(",")[1]
410
+ };
411
+ }
412
+
413
+ function canvasFromWebglPixels(gl, width, height) {
272
414
  const pixels = new Uint8Array(width * height * 4);
273
415
  gl.bindFramebuffer(gl.FRAMEBUFFER, null);
274
416
  gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
@@ -288,30 +430,114 @@
288
430
  srcCanvas
289
431
  .getContext("2d")
290
432
  .putImageData(new ImageData(new Uint8ClampedArray(flipped.buffer), width, height), 0, 0);
433
+ return srcCanvas;
434
+ }
291
435
 
292
- const maxWidth = Number(params.maxWidth || 1200);
293
- let outWidth = width;
294
- let outHeight = height;
295
- if (maxWidth > 0 && width > maxWidth) {
296
- outWidth = maxWidth;
297
- outHeight = Math.round(height * (maxWidth / width));
436
+ function captureEditorViewport(params) {
437
+ const app = window.editor.call("viewport:app");
438
+ if (!app) throw new Error("Viewport app not found.");
439
+ const device = app.graphicsDevice;
440
+ const gl = device && device.gl;
441
+ if (!gl) throw new Error("WebGL context not found.");
442
+
443
+ window.editor.call("viewport:render");
444
+ app.tick();
445
+
446
+ const width = device.width;
447
+ const height = device.height;
448
+ const srcCanvas = canvasFromWebglPixels(gl, width, height);
449
+ return encodeCanvas(srcCanvas, params, "editor-viewport");
450
+ }
451
+
452
+ function getCanvasWebglContext(canvas) {
453
+ const app = getRuntimeApp();
454
+ const appCanvas = getPrimaryCanvas(app);
455
+ if (appCanvas === canvas && app && app.graphicsDevice && app.graphicsDevice.gl) {
456
+ return app.graphicsDevice.gl;
298
457
  }
299
458
 
300
- const dstCanvas = document.createElement("canvas");
301
- dstCanvas.width = outWidth;
302
- dstCanvas.height = outHeight;
303
- dstCanvas.getContext("2d").drawImage(srcCanvas, 0, 0, outWidth, outHeight);
459
+ return (
460
+ canvas.getContext("webgl2") ||
461
+ canvas.getContext("webgl") ||
462
+ canvas.getContext("experimental-webgl")
463
+ );
464
+ }
465
+
466
+ function captureRuntimeCanvas(params) {
467
+ const app = getRuntimeApp();
468
+ const canvas = getPrimaryCanvas(app);
469
+ if (!canvas) {
470
+ throw new Error("PlayCanvas launch canvas not found.");
471
+ }
472
+
473
+ try {
474
+ const gl = getCanvasWebglContext(canvas);
475
+ if (gl && typeof gl.readPixels === "function") {
476
+ const width =
477
+ (app && app.graphicsDevice && app.graphicsDevice.width) ||
478
+ gl.drawingBufferWidth ||
479
+ canvas.width;
480
+ const height =
481
+ (app && app.graphicsDevice && app.graphicsDevice.height) ||
482
+ gl.drawingBufferHeight ||
483
+ canvas.height;
484
+ const srcCanvas = canvasFromWebglPixels(gl, width, height);
485
+ return encodeCanvas(srcCanvas, params, "launch-webgl");
486
+ }
487
+ } catch (error) {
488
+ pushLog("warn", ["WebGL capture failed; falling back to canvas capture.", error], "pcbridge");
489
+ }
490
+
491
+ return encodeCanvas(canvas, params, "launch-canvas");
492
+ }
493
+
494
+ function captureViewport(params) {
495
+ if (window.editor && typeof window.editor.call === "function") {
496
+ return captureEditorViewport(params);
497
+ }
498
+
499
+ return captureRuntimeCanvas(params);
500
+ }
501
+
502
+ function getLogs(params) {
503
+ const level = params.level ? String(params.level).toLowerCase() : null;
504
+ const since = params.since === undefined || params.since === null || params.since === ""
505
+ ? null
506
+ : Number(params.since);
507
+ const limit = Math.max(1, Math.min(Number(params.limit || 100), 500));
508
+ let items = capturedLogs;
509
+
510
+ if (level) {
511
+ items = items.filter((entry) => entry.level === level);
512
+ }
513
+ if (since !== null && Number.isFinite(since)) {
514
+ items = items.filter((entry) => entry.seq > since);
515
+ }
516
+
517
+ const total = items.length;
518
+ const hasExplicitOffset =
519
+ params.offset !== undefined && params.offset !== null && params.offset !== "";
520
+ const offset = hasExplicitOffset
521
+ ? Math.max(0, Number(params.offset || 0))
522
+ : Math.max(0, total - limit);
523
+ const page = items.slice(offset, offset + limit);
304
524
 
305
- const mime = params.format === "webp" ? "image/webp" : "image/png";
306
- const dataUrl = dstCanvas.toDataURL(mime, Number(params.quality || 0.85));
307
525
  return {
308
- mime,
309
- width: outWidth,
310
- height: outHeight,
311
- base64: dataUrl.split(",")[1]
526
+ items: page,
527
+ total,
528
+ offset,
529
+ limit,
530
+ hasMore: offset + page.length < total,
531
+ nextSince: page.length ? page[page.length - 1].seq : since
312
532
  };
313
533
  }
314
534
 
535
+ function clearLogs() {
536
+ const affected = capturedLogs.length;
537
+ capturedLogs.length = 0;
538
+ return { affected };
539
+ }
540
+
315
541
  async function uploadAsset(params) {
316
542
  if (!params.base64) throw new Error("base64 file content is required.");
317
543
  if (!params.name) throw new Error("name is required.");
@@ -399,6 +625,8 @@
399
625
  if (method === "bridge:describeTarget") return describeTarget();
400
626
  if (method === "bridge:eval") return evalInPage(params || {}, requestId);
401
627
  if (method === "bridge:captureViewport") return captureViewport(params || {});
628
+ if (method === "bridge:getLogs") return getLogs(params || {});
629
+ if (method === "bridge:clearLogs") return clearLogs();
402
630
  if (method === "bridge:uploadAsset") return uploadAsset(params || {});
403
631
  if (method === "bridge:focusViewport") return focusViewport(params || {});
404
632
  throw new Error(`Unknown bridge method: ${method}`);
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "PlayCanvas Agent Bridge",
4
- "description": "Connects open PlayCanvas Editor tabs to the local pcbridge daemon.",
5
- "version": "0.2.2",
4
+ "description": "Connects open PlayCanvas Editor and Launch tabs to the local pcbridge daemon.",
5
+ "version": "0.3.0",
6
6
  "permissions": ["activeTab", "storage"],
7
7
  "host_permissions": [
8
8
  "http://playcanvas.com/*",
@@ -21,16 +21,26 @@
21
21
  },
22
22
  "content_scripts": [
23
23
  {
24
- "matches": ["http://playcanvas.com/editor*", "https://playcanvas.com/editor*"],
24
+ "matches": [
25
+ "http://playcanvas.com/editor*",
26
+ "https://playcanvas.com/editor*",
27
+ "http://launch.playcanvas.com/*",
28
+ "https://launch.playcanvas.com/*"
29
+ ],
25
30
  "js": ["main.js"],
26
31
  "world": "MAIN",
27
- "run_at": "document_idle"
32
+ "run_at": "document_start"
28
33
  },
29
34
  {
30
- "matches": ["http://playcanvas.com/editor*", "https://playcanvas.com/editor*"],
35
+ "matches": [
36
+ "http://playcanvas.com/editor*",
37
+ "https://playcanvas.com/editor*",
38
+ "http://launch.playcanvas.com/*",
39
+ "https://launch.playcanvas.com/*"
40
+ ],
31
41
  "js": ["isolated.js"],
32
42
  "world": "ISOLATED",
33
- "run_at": "document_idle"
43
+ "run_at": "document_start"
34
44
  }
35
45
  ],
36
46
  "content_security_policy": {
@@ -8,7 +8,7 @@
8
8
  color: #1f2937;
9
9
  font: 13px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
10
10
  margin: 0;
11
- min-width: 280px;
11
+ min-width: 320px;
12
12
  padding: 14px;
13
13
  }
14
14
 
@@ -32,6 +32,38 @@
32
32
  margin: 0;
33
33
  word-break: break-all;
34
34
  }
35
+
36
+ .actions {
37
+ display: grid;
38
+ gap: 8px;
39
+ grid-template-columns: 1fr 1fr;
40
+ margin-top: 14px;
41
+ }
42
+
43
+ button {
44
+ background: #2563eb;
45
+ border: 0;
46
+ border-radius: 5px;
47
+ color: white;
48
+ cursor: pointer;
49
+ font: inherit;
50
+ padding: 8px;
51
+ }
52
+
53
+ button.secondary {
54
+ background: #4b5563;
55
+ }
56
+
57
+ button:disabled {
58
+ cursor: not-allowed;
59
+ opacity: 0.45;
60
+ }
61
+
62
+ #message {
63
+ color: #6b7280;
64
+ line-height: 1.4;
65
+ margin: 10px 0 0;
66
+ }
35
67
  </style>
36
68
  </head>
37
69
  <body>
@@ -41,7 +73,16 @@
41
73
  <dd id="daemon">Loading</dd>
42
74
  <dt>Tab</dt>
43
75
  <dd id="tab">Loading</dd>
76
+ <dt>Frontend</dt>
77
+ <dd id="frontend">Loading</dd>
78
+ <dt>Mode</dt>
79
+ <dd id="mode">Loading</dd>
44
80
  </dl>
81
+ <div class="actions">
82
+ <button id="use-custom" type="button">Use custom frontend</button>
83
+ <button id="use-official" class="secondary" type="button">Use official frontend</button>
84
+ </div>
85
+ <p id="message"></p>
45
86
  <script src="popup.js"></script>
46
87
  </body>
47
88
  </html>