@wenathlan/extension 1.1.40 → 1.1.41
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/README.md +5 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +551 -5
- package/dist/index.js.map +4 -4
- package/dist/media.d.ts +96 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/memory.d.ts +24 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +12 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +18 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/types.d.ts +208 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +955 -11
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +194 -3
- package/extension/dist/pagebridge.js.map +3 -3
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +14 -2
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +253 -2
- package/extension/dist/sidepanel.js.map +3 -3
- package/extension/dist/style.css +2 -0
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Devthink review</title><link rel="stylesheet" href="style.css"></head>
|
|
4
|
-
<body><main class="wide"><header><p class="eyebrow">REVIEW GATE</p><h1>Plan before action</h1><p>Every browser operation remains blocked until the user reviews and approves it here.</p></header><label for="objective">Objective</label><textarea id="objective" rows="4" placeholder="Describe a browser task to turn into a reviewable plan."></textarea><div class="actions"><button id="localplan">Create local observation plan</button><button id="remoteplan" class="secondary">Ask configured endpoint</button><button id="diagnostic" class="secondary">Capture local diagnostics</button></div><p id="status" role="status">Loading session state.</p><p id="capabilitiestext" role="status" class="muted">Optional capabilities unknown.</p><section><h2>Current plan</h2><progress id="planprogress" max="1" value="0"></progress><div id="plan" class="panel"></div></section><section><h2>Clickable map</h2><ol id="map" class="audit maplist"></ol></section><section><h2>Navigation trail</h2><ol id="trail" class="audit"></ol></section><section><h2>Navigation state</h2><div id="navigation" class="panel"></div></section><section><h2>Tabs and windows</h2><div id="tabswindows" class="panel"></div></section><section><h2>Forms and data</h2><div id="forms" class="panel"></div></section><section><h2>Files and downloads</h2><div id="files" class="panel"></div></section><section><h2>Capture gallery</h2><div id="captures" class="panel"></div></section><section><h2>Datasets</h2><div id="datasets" class="panel"></div></section><section><h2>Consent banners</h2><div id="banners" class="panel"></div></section><section><h2>Accessibility tree</h2><div id="a11y" class="panel"></div></section><section><h2>Reader view</h2><div id="reader" class="panel"></div></section><section><h2>Detected shapes</h2><ol id="detections" class="audit maplist"></ol></section><section><h2>Watch stream</h2><ol id="stream" class="audit"></ol></section><section><h2>Snapshot diffs</h2><div id="diffs" class="panel"></div></section><section><h2>Derived selectors</h2><ol id="selectors" class="audit maplist"></ol></section><section><h2>Structured diagnostics</h2><ul id="diagnostics" class="audit"></ul></section><section><h2>Local audit</h2><ol id="audit" class="audit"></ol></section></main><script type="module" src="sidepanel.js"></script></body>
|
|
4
|
+
<body><main class="wide"><header><p class="eyebrow">REVIEW GATE</p><h1>Plan before action</h1><p>Every browser operation remains blocked until the user reviews and approves it here.</p></header><label for="objective">Objective</label><textarea id="objective" rows="4" placeholder="Describe a browser task to turn into a reviewable plan."></textarea><div class="actions"><button id="localplan">Create local observation plan</button><button id="remoteplan" class="secondary">Ask configured endpoint</button><button id="diagnostic" class="secondary">Capture local diagnostics</button></div><p id="status" role="status">Loading session state.</p><p id="capabilitiestext" role="status" class="muted">Optional capabilities unknown.</p><section><h2>Current plan</h2><progress id="planprogress" max="1" value="0"></progress><div id="plan" class="panel"></div></section><section><h2>Clickable map</h2><ol id="map" class="audit maplist"></ol></section><section><h2>Navigation trail</h2><ol id="trail" class="audit"></ol></section><section><h2>Navigation state</h2><div id="navigation" class="panel"></div></section><section><h2>Tabs and windows</h2><div id="tabswindows" class="panel"></div></section><section><h2>Forms and data</h2><div id="forms" class="panel"></div></section><section><h2>Files and downloads</h2><div id="files" class="panel"></div></section><section><h2>Capture gallery</h2><div id="captures" class="panel"></div></section><section><h2>Media</h2><div id="media" class="panel"></div></section><section><h2>Datasets</h2><div id="datasets" class="panel"></div></section><section><h2>Consent banners</h2><div id="banners" class="panel"></div></section><section><h2>Accessibility tree</h2><div id="a11y" class="panel"></div></section><section><h2>Reader view</h2><div id="reader" class="panel"></div></section><section><h2>Detected shapes</h2><ol id="detections" class="audit maplist"></ol></section><section><h2>Watch stream</h2><ol id="stream" class="audit"></ol></section><section><h2>Snapshot diffs</h2><div id="diffs" class="panel"></div></section><section><h2>Derived selectors</h2><ol id="selectors" class="audit maplist"></ol></section><section><h2>Structured diagnostics</h2><ul id="diagnostics" class="audit"></ul></section><section><h2>Local audit</h2><ol id="audit" class="audit"></ol></section></main><script type="module" src="sidepanel.js"></script></body>
|
|
5
5
|
</html>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// policy.ts
|
|
2
|
-
var sensitiveactions = /* @__PURE__ */ new Set(["click", "type", "navigate", "select", "presskey", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "reload", "back", "forward", "writestorage", "setattribute", "removeattribute", "evaluate", "tabcreate", "tabactivate", "tabclose", "tabreload", "windowcreate", "windowclose", "windowresize", "downloadfile", "clickpoint", "shiftclick", "dismissdialog", "enterframe", "typetime", "appendtext", "setvalue", "typeedit", "keyhold", "keyrelease", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "openlink", "openprivate", "reloadcache", "stopnav", "followlink", "spanav", "rewritequery", "setfragment", "navlist", "navprofile", "handleauth", "printpdf", "prefetch", "preconnect", "deeplink", "reopentab", "pausenav", "navrate", "openclipboard", "batchopen", "duplicatetab", "closepattern", "pintab", "mutetab", "movetab", "movetabwindow", "grouptabs", "colorgroup", "collapsegroup", "discardtab", "reloadtabs", "zoomin", "zoomout", "switchtab", "maximizewindow", "minimizewindow", "restorewindow", "focuswindow", "scratchwindow", "incognitowindow", "restoretab", "restorelayout", "reopenrun", "badgetab", "fillform", "filllabel", "fillplaceholder", "submitform", "retryform", "runwizard", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcard", "fillcode", "consentpassword", "exportcsv", "exportjson", "exportexcel", "copytable", "pushsheets", "streamdisk", "paginateextract", "resumeextract", "batchdownload", "pausedownload", "resumedownload", "interceptmime", "readclipboard", "writeclipboard", "copyscreen", "quarantinedownload", "scanvirus", "cleanupartifacts"]);
|
|
2
|
+
var sensitiveactions = /* @__PURE__ */ new Set(["click", "type", "navigate", "select", "presskey", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "reload", "back", "forward", "writestorage", "setattribute", "removeattribute", "evaluate", "tabcreate", "tabactivate", "tabclose", "tabreload", "windowcreate", "windowclose", "windowresize", "downloadfile", "clickpoint", "shiftclick", "dismissdialog", "enterframe", "typetime", "appendtext", "setvalue", "typeedit", "keyhold", "keyrelease", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "openlink", "openprivate", "reloadcache", "stopnav", "followlink", "spanav", "rewritequery", "setfragment", "navlist", "navprofile", "handleauth", "printpdf", "prefetch", "preconnect", "deeplink", "reopentab", "pausenav", "navrate", "openclipboard", "batchopen", "duplicatetab", "closepattern", "pintab", "mutetab", "movetab", "movetabwindow", "grouptabs", "colorgroup", "collapsegroup", "discardtab", "reloadtabs", "zoomin", "zoomout", "switchtab", "maximizewindow", "minimizewindow", "restorewindow", "focuswindow", "scratchwindow", "incognitowindow", "restoretab", "restorelayout", "reopenrun", "badgetab", "fillform", "filllabel", "fillplaceholder", "submitform", "retryform", "runwizard", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcard", "fillcode", "consentpassword", "exportcsv", "exportjson", "exportexcel", "copytable", "pushsheets", "streamdisk", "paginateextract", "resumeextract", "batchdownload", "pausedownload", "resumedownload", "interceptmime", "readclipboard", "writeclipboard", "copyscreen", "quarantinedownload", "scanvirus", "cleanupartifacts", "recordscreen", "captureaudio", "downloadimages"]);
|
|
3
3
|
var interactionactions = /* @__PURE__ */ new Set(["focus", "scroll", "hover", "clickdeep", "rightclick", "doubleclick", "scrollpage", "scrollby", "scrollend", "scrolltop", "fullscreen", "zoomset", "movepointer", "clicktext", "clickaria", "clickname", "expanddetails", "pierceshadow", "retryaction"]);
|
|
4
|
-
var readactions = /* @__PURE__ */ new Set(["observe", "inspect", "extract", "wait", "waitfor", "waittext", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "readlinks", "readimages", "readmeta", "readforms", "readstorage", "highlight", "tablist", "windowlist", "tabsnapshot", "mapclicks", "verifyvisible", "verifyenabled", "resolvexpath", "a11ytree", "readvisible", "readertree", "detectlists", "detecttables", "readjson", "watchmutate", "waitquiet", "watchbanner", "detectinfinitescroll", "detectvirtual", "detectlazy", "readscrollpos", "readlang", "readoutline", "countpages", "listshadow", "listframes", "classifypage", "fingerprintsection", "diffsnapshots", "readselection", "watchfocus", "detectsticky", "detectscrolllock", "readopengraph", "detectlanguage", "deriveselector", "waitload", "waiturl", "spawait", "detecthttp", "readredirects", "readfinalurl", "trailaudit", "navintent", "checksafe", "querytabs", "watchtab", "findclones", "searchtabs", "listaudio", "snapshotsession", "savelayout", "attachmeta", "detectfields", "generatevalues", "saveprofiles", "asksubmit", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "scrapetable", "importcsv", "looprows", "transformvalues", "deduperows", "mergepages", "stamplerows", "previewgrid", "logprovenance", "verifydownload", "exportnetlog", "namecaptures", "shotview", "shotfullpage", "shotelement", "shotregion", "contactsheet"]);
|
|
4
|
+
var readactions = /* @__PURE__ */ new Set(["observe", "inspect", "extract", "wait", "waitfor", "waittext", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "readlinks", "readimages", "readmeta", "readforms", "readstorage", "highlight", "tablist", "windowlist", "tabsnapshot", "mapclicks", "verifyvisible", "verifyenabled", "resolvexpath", "a11ytree", "readvisible", "readertree", "detectlists", "detecttables", "readjson", "watchmutate", "waitquiet", "watchbanner", "detectinfinitescroll", "detectvirtual", "detectlazy", "readscrollpos", "readlang", "readoutline", "countpages", "listshadow", "listframes", "classifypage", "fingerprintsection", "diffsnapshots", "readselection", "watchfocus", "detectsticky", "detectscrolllock", "readopengraph", "detectlanguage", "deriveselector", "waitload", "waiturl", "spawait", "detecthttp", "readredirects", "readfinalurl", "trailaudit", "navintent", "checksafe", "querytabs", "watchtab", "findclones", "searchtabs", "listaudio", "snapshotsession", "savelayout", "attachmeta", "detectfields", "generatevalues", "saveprofiles", "asksubmit", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "scrapetable", "importcsv", "looprows", "transformvalues", "deduperows", "mergepages", "stamplerows", "previewgrid", "logprovenance", "verifydownload", "exportnetlog", "namecaptures", "shotview", "shotfullpage", "shotelement", "shotregion", "contactsheet", "capturepdf", "captureframe", "readmedia", "readassets", "probestream", "timelapse", "shotcanvas", "convertimage", "makethumbs"]);
|
|
5
5
|
var allowedactions = /* @__PURE__ */ new Set([...sensitiveactions, ...interactionactions, ...readactions]);
|
|
6
6
|
|
|
7
7
|
// extension/tabscommand.ts
|
|
@@ -64,6 +64,7 @@ var formsroot = document.querySelector("#forms");
|
|
|
64
64
|
var datasetsroot = document.querySelector("#datasets");
|
|
65
65
|
var filesroot = document.querySelector("#files");
|
|
66
66
|
var capturesroot = document.querySelector("#captures");
|
|
67
|
+
var mediaroot = document.querySelector("#media");
|
|
67
68
|
var statusnode = document.querySelector("#status");
|
|
68
69
|
var progressnode = document.querySelector("#planprogress");
|
|
69
70
|
var capabilitiestext = document.querySelector("#capabilitiestext");
|
|
@@ -1333,6 +1334,255 @@ function opencapture(record) {
|
|
|
1333
1334
|
viewer.append(actions);
|
|
1334
1335
|
capturesroot.append(viewer);
|
|
1335
1336
|
}
|
|
1337
|
+
async function mediabytes(id) {
|
|
1338
|
+
try {
|
|
1339
|
+
const record = await request({ kind: "mediabytes", id });
|
|
1340
|
+
return record.bytes;
|
|
1341
|
+
} catch {
|
|
1342
|
+
return void 0;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
function playframes(frameids, interval, label) {
|
|
1346
|
+
if (!mediaroot) return;
|
|
1347
|
+
const viewer = document.createElement("div");
|
|
1348
|
+
viewer.className = "panel captureviewer";
|
|
1349
|
+
const head = document.createElement("p");
|
|
1350
|
+
head.textContent = `${label}: ${frameids.length} frames at ${interval} millisecond intervals`;
|
|
1351
|
+
viewer.append(head);
|
|
1352
|
+
const image = document.createElement("img");
|
|
1353
|
+
image.alt = "Lapse frame";
|
|
1354
|
+
viewer.append(image);
|
|
1355
|
+
let index = 0;
|
|
1356
|
+
let stopped = false;
|
|
1357
|
+
const show = async () => {
|
|
1358
|
+
if (stopped) return;
|
|
1359
|
+
const bytes = await capturebytes(frameids[index] ?? "");
|
|
1360
|
+
if (bytes) image.src = bytes;
|
|
1361
|
+
index = (index + 1) % Math.max(1, frameids.length);
|
|
1362
|
+
};
|
|
1363
|
+
void show();
|
|
1364
|
+
const timer = window.setInterval(() => {
|
|
1365
|
+
void show();
|
|
1366
|
+
}, Math.max(100, interval));
|
|
1367
|
+
const actions = document.createElement("div");
|
|
1368
|
+
actions.className = "actions";
|
|
1369
|
+
actions.append(button("Stop", async () => {
|
|
1370
|
+
stopped = true;
|
|
1371
|
+
window.clearInterval(timer);
|
|
1372
|
+
viewer.remove();
|
|
1373
|
+
}));
|
|
1374
|
+
viewer.append(actions);
|
|
1375
|
+
mediaroot.append(viewer);
|
|
1376
|
+
}
|
|
1377
|
+
function rendermedia(context) {
|
|
1378
|
+
if (!mediaroot) return;
|
|
1379
|
+
mediaroot.replaceChildren();
|
|
1380
|
+
const active = context.session && !context.session.stoppedat && context.session.expiresat > Date.now();
|
|
1381
|
+
if ((context.recordingactive ?? []).length > 0) {
|
|
1382
|
+
const indicator = document.createElement("p");
|
|
1383
|
+
indicator.className = "recordingindicator";
|
|
1384
|
+
indicator.textContent = `\u25CF recording in progress: ${context.recordingactive?.map((item) => `${item.kind} of ${item.scope} scope`).join(", ")}`;
|
|
1385
|
+
mediaroot.append(indicator);
|
|
1386
|
+
}
|
|
1387
|
+
for (const consent of (context.recordingconsents ?? []).filter((item) => item.approved === void 0)) {
|
|
1388
|
+
const card = document.createElement("div");
|
|
1389
|
+
card.className = "panel recordingcard";
|
|
1390
|
+
const head = document.createElement("p");
|
|
1391
|
+
head.textContent = `Recording consent ${consent.id} for step ${consent.stepid} on ${consent.origin}: ${consent.prompt}`;
|
|
1392
|
+
card.append(head);
|
|
1393
|
+
const actions = document.createElement("div");
|
|
1394
|
+
actions.className = "actions";
|
|
1395
|
+
actions.append(button("Approve recording", () => request({ kind: "approverecordingconsent", id: consent.id, approved: true }).then(() => status(`Recording consent ${consent.id} approved; rerun the recording step.`)).then(refresh)));
|
|
1396
|
+
actions.append(button("Decline", () => request({ kind: "approverecordingconsent", id: consent.id, approved: false }).then(() => status(`Recording consent ${consent.id} declined.`)).then(refresh)));
|
|
1397
|
+
card.append(actions);
|
|
1398
|
+
mediaroot.append(card);
|
|
1399
|
+
}
|
|
1400
|
+
const records = context.media ?? [];
|
|
1401
|
+
const pdfs = records.filter((record) => record.pages !== void 0);
|
|
1402
|
+
const recordings = records.filter((record) => record.startedat !== void 0);
|
|
1403
|
+
const frames = records.filter((record) => record.timestamp !== void 0);
|
|
1404
|
+
const canvases = records.filter((record) => record.context !== void 0);
|
|
1405
|
+
const streams = records.filter((record) => record.tracks !== void 0);
|
|
1406
|
+
const assets = records.filter((record) => record.url !== void 0 && record.kind !== void 0 && (record.kind === "favicon" || record.kind === "logo"));
|
|
1407
|
+
if (pdfs.length > 0) {
|
|
1408
|
+
const card = document.createElement("div");
|
|
1409
|
+
card.className = "panel";
|
|
1410
|
+
const head = document.createElement("p");
|
|
1411
|
+
head.textContent = `pdf reports: ${pdfs.length}`;
|
|
1412
|
+
card.append(head);
|
|
1413
|
+
for (const pdf of pdfs) {
|
|
1414
|
+
const row = document.createElement("p");
|
|
1415
|
+
row.textContent = `${String(pdf.name ?? pdf.id)} \xB7 ${String(pdf.pages)} page${String(pdf.pages) === "1" ? "" : "s"} \xB7 ${String(pdf.pagewidth)}\xD7${String(pdf.pageheight)} pt${pdf.landscape === true ? " \xB7 landscape" : ""} \xB7 ${String(pdf.bytes)} bytes${pdf.bytesexpired === true ? " \xB7 bytes expired" : ""}`;
|
|
1416
|
+
card.append(row);
|
|
1417
|
+
const actions = document.createElement("div");
|
|
1418
|
+
actions.className = "actions";
|
|
1419
|
+
actions.append(button("Download pdf", () => request({ kind: "downloadmedia", id: String(pdf.id) }).then(() => status(`Downloaded the pdf report ${String(pdf.name ?? pdf.id)} through the reviewed download flow.`)), !active || pdf.bytesexpired === true));
|
|
1420
|
+
card.append(actions);
|
|
1421
|
+
}
|
|
1422
|
+
mediaroot.append(card);
|
|
1423
|
+
}
|
|
1424
|
+
for (const batch of context.imagebatches ?? []) {
|
|
1425
|
+
const card = document.createElement("div");
|
|
1426
|
+
card.className = "panel";
|
|
1427
|
+
const head = document.createElement("p");
|
|
1428
|
+
head.textContent = `image batch of step ${batch.stepid}: ${batch.matched} of ${batch.images.length} observed images matched, ${batch.downloaded} downloaded`;
|
|
1429
|
+
card.append(head);
|
|
1430
|
+
const list = document.createElement("ol");
|
|
1431
|
+
list.className = "audit";
|
|
1432
|
+
for (const image of batch.images.slice(0, 12)) {
|
|
1433
|
+
const entry = document.createElement("li");
|
|
1434
|
+
entry.textContent = `${image.url}${image.alt ? ` \xB7 ${image.alt}` : ""} \xB7 ${image.width}\xD7${image.height} \xB7 ${image.bytes} bytes \xB7 ${image.mime}`;
|
|
1435
|
+
list.append(entry);
|
|
1436
|
+
}
|
|
1437
|
+
card.append(list);
|
|
1438
|
+
mediaroot.append(card);
|
|
1439
|
+
}
|
|
1440
|
+
if (frames.length > 0) {
|
|
1441
|
+
const card = document.createElement("div");
|
|
1442
|
+
card.className = "panel";
|
|
1443
|
+
const head = document.createElement("p");
|
|
1444
|
+
head.textContent = `video frames: ${frames.length}`;
|
|
1445
|
+
card.append(head);
|
|
1446
|
+
const grid = document.createElement("div");
|
|
1447
|
+
grid.className = "capturegrid";
|
|
1448
|
+
for (const frame of frames) {
|
|
1449
|
+
const cell = document.createElement("button");
|
|
1450
|
+
cell.type = "button";
|
|
1451
|
+
cell.className = "capturecard";
|
|
1452
|
+
const label = document.createElement("span");
|
|
1453
|
+
label.textContent = `${String(frame.source)} \xB7 ${String(frame.timestamp)}s${frame.poster === true ? " \xB7 poster" : ""}${frame.bytesexpired === true ? " \xB7 bytes expired" : ""}`;
|
|
1454
|
+
cell.append(label);
|
|
1455
|
+
const image = document.createElement("img");
|
|
1456
|
+
image.alt = `Video frame ${String(frame.id)}`;
|
|
1457
|
+
if (frame.bytesexpired !== true) void mediabytes(String(frame.id)).then((bytes) => {
|
|
1458
|
+
if (bytes) image.src = bytes;
|
|
1459
|
+
});
|
|
1460
|
+
cell.append(image);
|
|
1461
|
+
grid.append(cell);
|
|
1462
|
+
}
|
|
1463
|
+
card.append(grid);
|
|
1464
|
+
mediaroot.append(card);
|
|
1465
|
+
}
|
|
1466
|
+
const timelapse = (context.captures ?? []).filter((record) => record.kind === "timelapse");
|
|
1467
|
+
if (timelapse.length > 1) {
|
|
1468
|
+
const card = document.createElement("div");
|
|
1469
|
+
card.className = "panel";
|
|
1470
|
+
const head = document.createElement("p");
|
|
1471
|
+
head.textContent = `time lapse sequences: ${timelapse.length} frames`;
|
|
1472
|
+
card.append(head);
|
|
1473
|
+
card.append(button("Play lapse sequence", async () => {
|
|
1474
|
+
const ordered = await request({ kind: "capturereport" });
|
|
1475
|
+
const ids = ordered.records.filter((record) => record.kind === "timelapse").sort((left, right) => left.capturedat - right.capturedat).map((record) => record.id);
|
|
1476
|
+
playframes(ids, 800, "time lapse");
|
|
1477
|
+
}));
|
|
1478
|
+
mediaroot.append(card);
|
|
1479
|
+
}
|
|
1480
|
+
if (canvases.length > 0) {
|
|
1481
|
+
const card = document.createElement("div");
|
|
1482
|
+
card.className = "panel";
|
|
1483
|
+
const head = document.createElement("p");
|
|
1484
|
+
head.textContent = `canvas captures: ${canvases.length}`;
|
|
1485
|
+
card.append(head);
|
|
1486
|
+
const grid = document.createElement("div");
|
|
1487
|
+
grid.className = "capturegrid";
|
|
1488
|
+
for (const canvas of canvases) {
|
|
1489
|
+
const cell = document.createElement("button");
|
|
1490
|
+
cell.type = "button";
|
|
1491
|
+
cell.className = "capturecard";
|
|
1492
|
+
const label = document.createElement("span");
|
|
1493
|
+
label.textContent = `${String(canvas.element)} \xB7 ${String(canvas.context)} \xB7 ${String(canvas.width)}\xD7${String(canvas.height)}${canvas.bytesexpired === true ? " \xB7 bytes expired" : ""}`;
|
|
1494
|
+
cell.append(label);
|
|
1495
|
+
const image = document.createElement("img");
|
|
1496
|
+
image.alt = `Canvas capture ${String(canvas.id)}`;
|
|
1497
|
+
if (canvas.bytesexpired !== true) void mediabytes(String(canvas.id)).then((bytes) => {
|
|
1498
|
+
if (bytes) image.src = bytes;
|
|
1499
|
+
});
|
|
1500
|
+
cell.append(image);
|
|
1501
|
+
grid.append(cell);
|
|
1502
|
+
}
|
|
1503
|
+
card.append(grid);
|
|
1504
|
+
mediaroot.append(card);
|
|
1505
|
+
}
|
|
1506
|
+
for (const stream of streams) {
|
|
1507
|
+
const card = document.createElement("div");
|
|
1508
|
+
card.className = "panel";
|
|
1509
|
+
const head = document.createElement("p");
|
|
1510
|
+
head.textContent = `stream probe ${String(stream.label || stream.id)}: ${String(stream.tracks)} track${String(stream.tracks) === "1" ? "" : "s"} \xB7 ${stream.live === true ? "live" : "ended"}`;
|
|
1511
|
+
card.append(head);
|
|
1512
|
+
const detail = stream.detail;
|
|
1513
|
+
if (Array.isArray(detail)) {
|
|
1514
|
+
const list = document.createElement("ul");
|
|
1515
|
+
list.className = "audit";
|
|
1516
|
+
for (const track of detail) {
|
|
1517
|
+
const entry = document.createElement("li");
|
|
1518
|
+
entry.textContent = `${track.kind} track${track.label ? ` ${track.label}` : ""}${track.width !== void 0 ? ` \xB7 ${track.width}\xD7${track.height}` : ""}${track.framerate !== void 0 ? ` \xB7 ${Math.round(track.framerate)} fps` : ""} \xB7 ${track.state}`;
|
|
1519
|
+
list.append(entry);
|
|
1520
|
+
}
|
|
1521
|
+
card.append(list);
|
|
1522
|
+
}
|
|
1523
|
+
mediaroot.append(card);
|
|
1524
|
+
}
|
|
1525
|
+
if (assets.length > 0) {
|
|
1526
|
+
const card = document.createElement("div");
|
|
1527
|
+
card.className = "panel";
|
|
1528
|
+
const head = document.createElement("p");
|
|
1529
|
+
head.textContent = `page assets: ${assets.filter((asset) => asset.kind === "favicon").length} favicon and ${assets.filter((asset) => asset.kind === "logo").length} logo entries`;
|
|
1530
|
+
card.append(head);
|
|
1531
|
+
const list = document.createElement("ul");
|
|
1532
|
+
list.className = "audit";
|
|
1533
|
+
for (const asset of assets.slice(0, 12)) {
|
|
1534
|
+
const entry = document.createElement("li");
|
|
1535
|
+
entry.textContent = `${String(asset.kind)} \xB7 ${String(asset.url)}${asset.sizes !== void 0 ? ` \xB7 ${String(asset.sizes)}` : ""}`;
|
|
1536
|
+
list.append(entry);
|
|
1537
|
+
}
|
|
1538
|
+
card.append(list);
|
|
1539
|
+
mediaroot.append(card);
|
|
1540
|
+
}
|
|
1541
|
+
for (const recording of recordings) {
|
|
1542
|
+
const card = document.createElement("div");
|
|
1543
|
+
card.className = "panel recordingcard";
|
|
1544
|
+
const head = document.createElement("p");
|
|
1545
|
+
head.textContent = `${String(recording.kind)} recording ${String(recording.id)} \xB7 ${String(recording.scope)} scope \xB7 ${String(recording.duration ?? 0)} ms \xB7 ${Array.isArray(recording.frames) ? String(recording.frames.length) : "0"} frames \xB7 manifest ${String(recording.bytes ?? 0)} bytes${recording.bytesexpired === true ? " \xB7 bytes expired" : ""}`;
|
|
1546
|
+
card.append(head);
|
|
1547
|
+
const actions = document.createElement("div");
|
|
1548
|
+
actions.className = "actions";
|
|
1549
|
+
const frames2 = Array.isArray(recording.frames) ? recording.frames : [];
|
|
1550
|
+
if (String(recording.kind) === "screen" && frames2.length > 0) {
|
|
1551
|
+
actions.append(button("Play frames", async () => {
|
|
1552
|
+
const state = await request({ kind: "recordingframes", id: String(recording.id) });
|
|
1553
|
+
playframes(state.frames, state.interval, `screen recording ${String(recording.id)}`);
|
|
1554
|
+
}));
|
|
1555
|
+
}
|
|
1556
|
+
actions.append(button("Download manifest", () => request({ kind: "downloadrecording", id: String(recording.id) }).then(() => status(`Downloaded the recording manifest ${String(recording.id)} through the reviewed download flow.`)), !active));
|
|
1557
|
+
actions.append(button("Delete", () => request({ kind: "deleterecording", id: String(recording.id) }).then(() => status(`Deleted the recording ${String(recording.id)}.`)).then(refresh), !active));
|
|
1558
|
+
card.append(actions);
|
|
1559
|
+
mediaroot.append(card);
|
|
1560
|
+
}
|
|
1561
|
+
const stored = (context.captures ?? []).filter((record) => record.bytesexpired !== true).slice(0, 12);
|
|
1562
|
+
if (stored.length > 0) {
|
|
1563
|
+
const card = document.createElement("div");
|
|
1564
|
+
card.className = "panel";
|
|
1565
|
+
const head = document.createElement("p");
|
|
1566
|
+
head.textContent = "capture transforms: convertimage and makethumbs actions on stored captures";
|
|
1567
|
+
card.append(head);
|
|
1568
|
+
for (const record of stored) {
|
|
1569
|
+
const row = document.createElement("div");
|
|
1570
|
+
row.className = "actions";
|
|
1571
|
+
const label = document.createElement("p");
|
|
1572
|
+
label.textContent = `${record.kind} ${record.id} (${record.format})`;
|
|
1573
|
+
row.append(label);
|
|
1574
|
+
for (const target of ["png", "jpeg", "webp"]) {
|
|
1575
|
+
if (target !== record.format) row.append(button(`\u2192 ${target}`, () => request({ kind: "convertcapture", id: record.id, target }).then(() => status(`Converted capture ${record.id} to ${target}.`)).then(refresh), !active));
|
|
1576
|
+
}
|
|
1577
|
+
row.append(button("thumbnail", () => request({ kind: "thumbcapture", id: record.id, size: 240, fit: "cover", suffix: "thumb" }).then(() => status(`Thumbnailed capture ${record.id}.`)).then(refresh), !active));
|
|
1578
|
+
card.append(row);
|
|
1579
|
+
}
|
|
1580
|
+
mediaroot.append(card);
|
|
1581
|
+
}
|
|
1582
|
+
if (records.length === 0 && (context.imagebatches ?? []).length === 0 && (context.recordingactive ?? []).length === 0) {
|
|
1583
|
+
mediaroot.append(Object.assign(document.createElement("p"), { textContent: "No media stored yet; run a capturepdf, recordscreen, captureaudio, captureframe, downloadimages, shotcanvas, probestream, readmedia, readassets, timelapse, convertimage or makethumbs step." }));
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1336
1586
|
function rendercaptures(context) {
|
|
1337
1587
|
if (!capturesroot) return;
|
|
1338
1588
|
capturesroot.replaceChildren();
|
|
@@ -1487,6 +1737,7 @@ async function refresh() {
|
|
|
1487
1737
|
renderdatasets(context);
|
|
1488
1738
|
renderfiles(context);
|
|
1489
1739
|
rendercaptures(context);
|
|
1740
|
+
rendermedia(context);
|
|
1490
1741
|
renderaudit(context.audit);
|
|
1491
1742
|
rendercapabilities(context.capabilities);
|
|
1492
1743
|
if (context.session?.pausedat) status("Session paused. Reviewed actions are blocked until resume.");
|