livedesk 0.1.658 → 0.1.660
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/hub/src/console-direct.js +35 -2
- package/hub/src/console-direct.test.mjs +51 -0
- package/package.json +1 -1
- package/web/dist/app.html +1 -1
- package/web/dist/app.webmanifest +1 -1
- package/web/dist/assets/{AgentSettingsTab-8WnOGkVa.js → AgentSettingsTab-B8ZEn4V9.js} +1 -1
- package/web/dist/assets/{AgentsPage-CCO7AwAO.js → AgentsPage-N341lZ1r.js} +1 -1
- package/web/dist/assets/{CaptureGallery-7NXD-vaQ.js → CaptureGallery-WIjAQfH3.js} +1 -1
- package/web/dist/assets/{HubApp-AhKLyz3K.js → HubApp-5FvyiOsk.js} +3 -3
- package/web/dist/assets/MonitorStackIcon-DxbiAfTW.js +8 -0
- package/web/dist/assets/{SettingsPage-DnOdy3MQ.js → SettingsPage-DAqgs4sp.js} +1 -1
- package/web/dist/assets/{ShareFilesPage-C3Jv7EII.js → ShareFilesPage-BiUCy9-i.js} +1 -1
- package/web/dist/assets/{SupportPage-B16Jl8Jq.js → SupportPage-CRJA6FYz.js} +1 -1
- package/web/dist/assets/{VuvoDeskApp-CU4N6t3c.js → VuvoDeskApp-DtGy1omT.js} +1 -1
- package/web/dist/assets/{app--miKlon3.js → app-BRSahPig.js} +2 -2
- package/web/dist/assets/{main-DVNv6hc-.js → main-CbGLhjJX.js} +2 -2
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +46 -28
- package/web/dist/vuvodesk-build-evidence.json +41 -41
- package/web/dist/assets/MonitorStackIcon-DBuXI_Oa.js +0 -8
|
@@ -29,6 +29,7 @@ const MAX_SHARED_ASSEMBLY_BYTES = 12 * 1024 * 1024;
|
|
|
29
29
|
const MAX_FRAME_MESSAGE_BYTES = (8 * 1024 * 1024) + DIRECT_CONSOLE_WIRE_CHUNK_BYTES;
|
|
30
30
|
const MAX_PENDING_MEDIA_WIRE_MESSAGES = 8;
|
|
31
31
|
const MAX_DATA_CHANNEL_BUFFERED_BYTES = 12 * 1024 * 1024;
|
|
32
|
+
const CONTROL_HEADROOM_BUFFERED_BYTES = 4 * 1024 * 1024;
|
|
32
33
|
const MAX_LOCAL_WS_BUFFERED_BYTES = 4 * 1024 * 1024;
|
|
33
34
|
const HTTP_TIMEOUT_MS = 15_000;
|
|
34
35
|
const ICE_CONNECT_TIMEOUT_MS = 10_000;
|
|
@@ -652,7 +653,7 @@ export function createHubConsoleDirect(options = {}) {
|
|
|
652
653
|
|| channelBufferedAmount(right) - channelBufferedAmount(left)
|
|
653
654
|
));
|
|
654
655
|
for (const state of candidates) {
|
|
655
|
-
if (ownerBufferedAmount(owner) + requiredBytes <=
|
|
656
|
+
if (ownerBufferedAmount(owner) + requiredBytes <= CONTROL_HEADROOM_BUFFERED_BYTES) break;
|
|
656
657
|
dataChannelBackpressureCloses += 1;
|
|
657
658
|
closeLogicalChannel(owner, state, {
|
|
658
659
|
code: 1013,
|
|
@@ -681,8 +682,39 @@ export function createHubConsoleDirect(options = {}) {
|
|
|
681
682
|
return false;
|
|
682
683
|
}
|
|
683
684
|
const wireBytes = chunks.reduce((total, chunk) => total + chunk.byteLength, 0);
|
|
685
|
+
const partialMedia = channelState.purpose === 'frame' || channelState.purpose === 'atlas';
|
|
686
|
+
if (partialMedia
|
|
687
|
+
&& (wireBytes > MAX_DATA_CHANNEL_BUFFERED_BYTES
|
|
688
|
+
|| ownerBufferedAmount(owner) + wireBytes > MAX_DATA_CHANNEL_BUFFERED_BYTES)) {
|
|
689
|
+
dataChannelBackpressureCloses += 1;
|
|
690
|
+
if (options.closeOnFailure !== false) {
|
|
691
|
+
closeLogicalChannel(owner, channelState, {
|
|
692
|
+
code: 1013,
|
|
693
|
+
reason: 'console-direct-datachannel-backpressure',
|
|
694
|
+
notify: false
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
return false;
|
|
698
|
+
}
|
|
699
|
+
const mediaBufferedBytes = partialMedia ? channelBufferedAmount(channelState) : 0;
|
|
700
|
+
if (partialMedia
|
|
701
|
+
&& mediaBufferedBytes > 0
|
|
702
|
+
&& mediaBufferedBytes + wireBytes > CONTROL_HEADROOM_BUFFERED_BYTES) {
|
|
703
|
+
// Retire only the media lane that owns the stale SCTP backlog. Its
|
|
704
|
+
// browser socket recovery requests a current key frame while the
|
|
705
|
+
// reliable peer and every healthy lane keep their own owners.
|
|
706
|
+
dataChannelBackpressureCloses += 1;
|
|
707
|
+
if (options.closeOnFailure !== false) {
|
|
708
|
+
closeLogicalChannel(owner, channelState, {
|
|
709
|
+
code: 1013,
|
|
710
|
+
reason: 'console-direct-media-headroom',
|
|
711
|
+
notify: false
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
return false;
|
|
715
|
+
}
|
|
684
716
|
if (channelState === owner.control
|
|
685
|
-
&& ownerBufferedAmount(owner) + wireBytes >
|
|
717
|
+
&& ownerBufferedAmount(owner) + wireBytes > CONTROL_HEADROOM_BUFFERED_BYTES) {
|
|
686
718
|
releaseLogicalBacklogForControl(owner, wireBytes);
|
|
687
719
|
}
|
|
688
720
|
if (wireBytes > MAX_DATA_CHANNEL_BUFFERED_BYTES
|
|
@@ -1983,6 +2015,7 @@ export const consoleDirectContract = Object.freeze({
|
|
|
1983
2015
|
maxFrameMessageBytes: MAX_FRAME_MESSAGE_BYTES,
|
|
1984
2016
|
maxPendingMediaWireMessages: MAX_PENDING_MEDIA_WIRE_MESSAGES,
|
|
1985
2017
|
maxBufferedBytes: MAX_DATA_CHANNEL_BUFFERED_BYTES,
|
|
2018
|
+
controlHeadroomBufferedBytes: CONTROL_HEADROOM_BUFFERED_BYTES,
|
|
1986
2019
|
maxLocalWebSocketBufferedBytes: MAX_LOCAL_WS_BUFFERED_BYTES,
|
|
1987
2020
|
maxDefaultRetryDelayMs: DEFAULT_RETRY_DELAYS_MS.at(-1),
|
|
1988
2021
|
accessTokenTimeoutMs: ACCESS_TOKEN_TIMEOUT_MS,
|
|
@@ -23,6 +23,7 @@ const CONSOLE_ID = '22222222-2222-4222-8222-222222222222';
|
|
|
23
23
|
const CONNECTION_ONE = '33333333-3333-4333-8333-333333333333';
|
|
24
24
|
const CONNECTION_TWO = '44444444-4444-4444-8444-444444444444';
|
|
25
25
|
const CHANNEL_ID = '55555555-5555-4555-8555-555555555555';
|
|
26
|
+
const CHANNEL_ID_TWO = '55555555-5555-4555-8555-555555555556';
|
|
26
27
|
const REQUEST_ID = '66666666-6666-4666-8666-666666666666';
|
|
27
28
|
const TEAM_WORKSPACE_ID = '88888888-8888-4888-8888-888888888888';
|
|
28
29
|
const TEAM_OWNER_USER_ID = '99999999-9999-4999-8999-999999999999';
|
|
@@ -1226,6 +1227,56 @@ test('the peer-wide DataChannel buffer cap closes only the overflowing logical l
|
|
|
1226
1227
|
direct.close();
|
|
1227
1228
|
});
|
|
1228
1229
|
|
|
1230
|
+
test('media pressure retires only its stale logical lane while preserving the control peer and a healthy lane', async () => {
|
|
1231
|
+
const { direct, signal } = await connectedDirect();
|
|
1232
|
+
const peer = offer(signal);
|
|
1233
|
+
const control = new FakeDataChannel('livedesk-control-v1');
|
|
1234
|
+
peer.emitDataChannel(control);
|
|
1235
|
+
control.open();
|
|
1236
|
+
const lane = new FakeDataChannel(`livedesk-ws-v1:${CHANNEL_ID}:frame`);
|
|
1237
|
+
peer.emitDataChannel(lane);
|
|
1238
|
+
lane.open();
|
|
1239
|
+
sendWire(control, {
|
|
1240
|
+
type: 'ws-open',
|
|
1241
|
+
connectionId: CONNECTION_ONE,
|
|
1242
|
+
hubEpoch: HUB_EPOCH,
|
|
1243
|
+
channelId: CHANNEL_ID,
|
|
1244
|
+
purpose: 'frame',
|
|
1245
|
+
path: '/api/remote/frames/ws'
|
|
1246
|
+
});
|
|
1247
|
+
const local = FakeLocalSocket.instances[0];
|
|
1248
|
+
local.open();
|
|
1249
|
+
const healthyLane = new FakeDataChannel(`livedesk-ws-v1:${CHANNEL_ID_TWO}:frame`);
|
|
1250
|
+
peer.emitDataChannel(healthyLane);
|
|
1251
|
+
healthyLane.open();
|
|
1252
|
+
sendWire(control, {
|
|
1253
|
+
type: 'ws-open',
|
|
1254
|
+
connectionId: CONNECTION_ONE,
|
|
1255
|
+
hubEpoch: HUB_EPOCH,
|
|
1256
|
+
channelId: CHANNEL_ID_TWO,
|
|
1257
|
+
purpose: 'frame',
|
|
1258
|
+
path: '/api/remote/frames/ws'
|
|
1259
|
+
});
|
|
1260
|
+
const healthyLocal = FakeLocalSocket.instances[1];
|
|
1261
|
+
healthyLocal.open();
|
|
1262
|
+
lane.buffered = consoleDirectContract.controlHeadroomBufferedBytes;
|
|
1263
|
+
|
|
1264
|
+
healthyLocal.receive('healthy-frame');
|
|
1265
|
+
assert.ok(healthyLane.sent.length > 0);
|
|
1266
|
+
assert.equal(healthyLane.closed, false);
|
|
1267
|
+
assert.equal(lane.closed, false);
|
|
1268
|
+
|
|
1269
|
+
local.receive('newest-frame');
|
|
1270
|
+
|
|
1271
|
+
assert.equal(lane.sent.length, 0);
|
|
1272
|
+
assert.equal(lane.closed, true);
|
|
1273
|
+
assert.equal(healthyLane.closed, false);
|
|
1274
|
+
assert.equal(control.closed, false);
|
|
1275
|
+
assert.equal(peer.closed, false);
|
|
1276
|
+
assert.equal(direct.inspect().dataChannelBackpressureCloses, 1);
|
|
1277
|
+
direct.close();
|
|
1278
|
+
});
|
|
1279
|
+
|
|
1229
1280
|
test('a reliable control response drops stale media backlog without retiring the peer', async () => {
|
|
1230
1281
|
const { direct, signal } = await connectedDirect({
|
|
1231
1282
|
fetchImpl: async () => new Response('{"online":true}', {
|
package/package.json
CHANGED
package/web/dist/app.html
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
.vuvodesk-static-boot [hidden] { display: none; }
|
|
53
53
|
@keyframes vuvodesk-static-boot-spin { to { transform: rotate(360deg); } }
|
|
54
54
|
</style>
|
|
55
|
-
<script type="module" crossorigin src="/assets/app
|
|
55
|
+
<script type="module" crossorigin src="/assets/app-BRSahPig.js" data-vuvodesk-entry></script>
|
|
56
56
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DD1OZmLC.js">
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/pwa-bootstrap-BCid3CYk.js">
|
|
58
58
|
</head>
|
package/web/dist/app.webmanifest
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./pwa-startup-xxamnV7P.js";import{r as c,d as A,S as q,T as I,e as z}from"./icons-CuXJn-Hz.js";import{h as x}from"./MonitorStackIcon-
|
|
1
|
+
import{j as t}from"./pwa-startup-xxamnV7P.js";import{r as c,d as A,S as q,T as I,e as z}from"./icons-CuXJn-Hz.js";import{h as x}from"./MonitorStackIcon-DxbiAfTW.js";import"./pwa-bootstrap-BCid3CYk.js";const E={enabled:!0};function w(i){return{enabled:i?.enabled===!0}}async function L(i,p,f){let l=null;for(let s=0;s<2;s+=1){const g=await x("/api/settings",{signal:f},p);if(g.settings.agent?.enabled===i)return;try{await x("/api/settings",{method:"PATCH",signal:f,body:JSON.stringify({revision:g.revision,agent:{enabled:i}})},p);return}catch(a){if(l=a,s!==0||!String(a instanceof Error?a.message:a).startsWith("409 "))throw a}}throw l}function H({hubUrl:i,showToast:p}){const[f,l]=c.useState(E),[s,g]=c.useState(null),[a,m]=c.useState(""),[j,v]=c.useState(""),[y,d]=c.useState(""),b=c.useRef(0),u=c.useRef(null);c.useEffect(()=>{let e=!0;u.current?.abort();const n=new AbortController;u.current=n;const h=++b.current;return g(null),l(E),m(""),d(""),v(""),x("/api/settings/agent",{signal:n.signal},i).then(o=>{!e||n.signal.aborted||h!==b.current||(g(o.settings),l(w(o.settings)))}).catch(o=>{e&&!n.signal.aborted&&h===b.current&&d(o instanceof Error?o.message:String(o))}),()=>{e=!1,n.abort(),u.current===n&&(u.current=null)}},[i]);const k=(e,n)=>l(h=>({...h,[e]:n})),C=e=>{g(e),l(w(e))},S=()=>({generation:b.current,controller:u.current}),r=e=>e.generation===b.current&&e.controller!==null&&e.controller===u.current&&!e.controller.signal.aborted,R=async()=>{if(!s){d("Agent settings are not available yet.");return}const e=S();if(r(e)){m("save"),d(""),v("");try{if(await L(f.enabled,i,e.controller.signal),!r(e))return;const n=await x("/api/settings/agent",{signal:e.controller.signal},i);if(!r(e))return;C(n.settings),v("Codex Agent settings saved.")}catch(n){r(e)&&d(n instanceof Error?n.message:String(n))}finally{r(e)&&m("")}}},T=async()=>{const e=S();if(r(e)){m("test"),d(""),v("");try{const n=await x("/api/settings/agent/test",{method:"POST",signal:e.controller.signal,body:JSON.stringify({})},i);if(!r(e))return;const h=await x("/api/settings/agent",{signal:e.controller.signal},i);if(!r(e))return;C(h.settings);const o=Number.isFinite(n.connection?.latencyMs)?Math.max(0,Math.round(n.connection.latencyMs)):null;p(`Codex Agent connection verified${o!==null?` in ${o} ms.`:"."}`,"success")}catch(n){r(e)&&d(n instanceof Error?n.message:String(n))}finally{r(e)&&m("")}}},D=s?.codexInstallation==="installed"&&s.codexAuth==="signed-in",N=s!==null;return t.jsxs("div",{className:"settings-tab-content agent-settings-content",children:[t.jsxs("section",{className:"settings-section-card agent-enable-card",children:[t.jsxs("label",{className:"settings-toggle agent-enable-toggle",children:[t.jsx("input",{type:"checkbox",checked:f.enabled,onChange:e=>k("enabled",e.target.checked),disabled:!N||a!==""}),t.jsx("span",{children:"Enable Codex Agent"})]}),t.jsxs("p",{className:"settings-help",children:[t.jsx(A,{size:12})," Enabled by default. Agent commands use only the Codex account signed in on this Hub."]})]}),y&&t.jsx("div",{className:"agent-settings-alert error",role:"alert",children:y}),j&&t.jsx("div",{className:"agent-settings-alert success",role:"status",children:j}),t.jsxs("section",{className:"settings-section-card",children:[t.jsxs("div",{className:"settings-section-heading",children:[t.jsxs("div",{children:[t.jsx("span",{children:"Connection"}),t.jsx("h3",{children:"Codex SDK / CLI"})]}),t.jsx(q,{size:20})]}),t.jsxs("div",{className:"agent-connection-row",children:[t.jsx("span",{className:`agent-connection-dot ${D?"connected":s?.codexAuth==="not-signed-in"?"unavailable":""}`}),t.jsx("span",{children:s?.codexInstallation==="not-installed"?"Codex SDK not installed":s?.codexAuth==="signed-in"?"Codex CLI signed in":s?.codexAuth==="not-signed-in"?"Codex CLI sign-in required":"Codex status not tested"}),t.jsxs("button",{className:"settings-reset",onClick:()=>{T()},disabled:a!=="",type:"button",children:[t.jsx(I,{size:15})," ",a==="test"?"Testing":"Test connection"]})]}),t.jsxs("p",{className:"settings-help",children:[t.jsx(A,{size:12})," The Hub uses the installed Codex SDK / CLI to plan approved commands and run them through VuvoDesk Agent tools on selected computers. VuvoDesk never asks for separate credentials."]})]}),t.jsx("div",{className:"settings-action-row agent-settings-actions",children:t.jsxs("button",{className:"text-button primary",onClick:()=>{R()},disabled:!N||a!=="",type:"button",children:[t.jsx(z,{size:15})," ",a==="save"?"Saving":"Save Agent settings"]})})]})}export{H as AgentSettingsTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t}from"./pwa-startup-xxamnV7P.js";import{r as d,ae as ht,af as Ce,z as yt,G as ee,X as xe,ag as vt,ah as wt,ai as Ze,aj as kt,ak as bt,al as Se,b as H,am as Ct,p as xt,an as _e,o as St,ao as jt,S as Je,ap as At,a9 as Rt,c as Nt,aq as Pt,ar as It,A as Tt,as as ue,M as Xe}from"./icons-CuXJn-Hz.js";import{r as Et,h as F}from"./MonitorStackIcon-
|
|
1
|
+
import{j as t}from"./pwa-startup-xxamnV7P.js";import{r as d,ae as ht,af as Ce,z as yt,G as ee,X as xe,ag as vt,ah as wt,ai as Ze,aj as kt,ak as bt,al as Se,b as H,am as Ct,p as xt,an as _e,o as St,ao as jt,S as Je,ap as At,a9 as Rt,c as Nt,aq as Pt,ar as It,A as Tt,as as ue,M as Xe}from"./icons-CuXJn-Hz.js";import{r as Et,h as F}from"./MonitorStackIcon-DxbiAfTW.js";import"./pwa-bootstrap-BCid3CYk.js";const Ot=d.forwardRef(function({value:s,onChange:n,onSubmit:r,onOpenSuggestedTasks:i,suggestedOpen:f=!1,suggestedTaskCount:c,disabled:v=!1,placeholder:S="Ask VuvoDesk to work across your machines...",compact:g=!1},x){return t.jsxs("form",{className:"agents-composer",onSubmit:w=>{w.preventDefault(),r()},children:[t.jsx("button",{className:`agents-suggested-trigger ${f?"active":""}`,type:"button","aria-label":c===void 0?"Open Suggested tasks":`Open Suggested tasks (${c} available)`,"aria-expanded":f,onClick:i,disabled:v,children:t.jsx(ht,{size:17})}),t.jsx("textarea",{ref:x,value:s,onChange:w=>n(w.target.value.slice(0,4e3)),placeholder:S,"aria-label":"Ask VuvoDesk",rows:g?1:2,disabled:v}),t.jsxs("button",{className:"agents-run-button",type:"submit",disabled:v||!s.trim(),children:[v?t.jsx(Ce,{className:"spin",size:16}):t.jsx(yt,{size:16}),v?"Running":"Run"]})]})}),$t=["read","processControl","serviceControl","applicationControl","fileRead","fileWrite","fileDelete","shell","script","softwareInstall","network","systemPower","systemConfiguration","userAccount"];function de(e){return e.deviceName?.trim()||e.hostname?.trim()||e.deviceId}function pe(e){return e.connected!==!0?!1:e.synthetic===!0?!0:!e.channels||e.channels.control===!0}function Dt(e){return e==="running"||e==="completed"||e==="failed"||e==="cancelled"?e:"queued"}function _t(e){switch(e){case"process.list":return"Process list";case"system.health":return"System health";case"gpu.status":return"GPU status";case"disk.status":return"Disk status";case"service.status":return"Service status";case"diagnostics.collect":return"Diagnostics";case"process.control":return"Process control";case"service.control":return"Service control";case"application.launch":return"Launch application";case"application.close":return"Close application";case"file.read":return"Read file";case"file.write":return"Write file";case"file.delete":return"Delete file";case"file.list":return"List directory";case"command.run":return"Run command";case"script.run":return"Run script";case"software.install":return"Install software";case"network.status":return"Network status";case"system.power":return"Power action";case"system.configure":return"System configuration";case"logs.collect":return"Collect logs"}}const Mt=64*1024,Me="[Earlier log output hidden by PWA display limit.]",Qe=new TextEncoder,zt=new TextDecoder("utf-8",{fatal:!0}),ze=16*1024,Lt=200,Le="(?:access[_-]?(?:token|key)|refresh[_-]?token|id[_-]?token|pair[_-]?(?:token|key)|authorization|api[_-]?key|private[_-]?key|connection[_-]?string|credential|password|passwd|secret|cookie|set-cookie)",Ft="(?:access[_-]?(?:token|key)|refresh[_-]?token|id[_-]?token|pair[_-]?(?:token|key)|token|authorization|api[_-]?key|private[_-]?key|connection[_-]?string|credential|password|passwd|secret|cookie|set-cookie)",Bt="(?:access[_-]?(?:token|key)|refresh[_-]?token|id[_-]?token|pair[_-]?(?:token|key)|token|authorization|api[_-]?key|credential|password|secret|cookie)",qt=/\b(?:sk-(?:proj-|ant-)?[A-Za-z0-9_-]{8,}|gh[pousr]_[A-Za-z0-9]{8,}|github_pat_[A-Za-z0-9_]{8,}|(?:AKIA|ASIA)[A-Z0-9]{16}|AIza[A-Za-z0-9_-]{35}|npm_[A-Za-z0-9]{8,}|xox[a-z]-[A-Za-z0-9-]{8,}|(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{8,})\b/g;function Ut(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Fe(e){return Qe.encode(e).byteLength}function Be(e,s){const n=Qe.encode(e);if(n.byteLength<=s)return{value:e,truncated:!1};let r=n.byteLength-s;for(;r<n.byteLength&&(n[r]&192)===128;)r+=1;let i=zt.decode(n.subarray(r));const f=i.indexOf(`
|
|
2
2
|
`);return f>=0&&f<i.length-1&&(i=i.slice(f+1)),{value:i,truncated:!0}}function et(e){return e.replace(/-----BEGIN [^-\r\n]*PRIVATE KEY-----[\s\S]*?-----END [^-\r\n]*PRIVATE KEY-----/gi,"[REDACTED PRIVATE KEY]").replace(/\b(?:proxy-)?authorization\s*[:=]\s*[^\r\n]*|\b(?:set-)?cookie\s*[:=]\s*[^\r\n]*/gi,"credential-header=[REDACTED]").replace(/\bBearer\s+(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi,"Bearer [REDACTED]").replace(new RegExp(`("${Le}"\\s*:\\s*")[^"\\r\\n]*(")`,"gi"),"$1[REDACTED]$2").replace(new RegExp(`('${Le}'\\s*:\\s*')[^'\\r\\n]*(')`,"gi"),"$1[REDACTED]$2").replace(new RegExp(`((?:[A-Za-z0-9.-]+[_-])?${Ft}\\s*[:=]\\s*)(?!\\[REDACTED\\])[^\\s,;&]+`,"gi"),"$1[REDACTED]").replace(new RegExp(`([?&]${Bt}=)[^&\\s]+`,"gi"),"$1[REDACTED]").replace(/\b(?:eyJ|[A-Za-z0-9_-]{8,}\.)[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g,"[REDACTED TOKEN]").replace(qt,"[REDACTED KEY]")}function Gt(e){return typeof e!="string"?"source unknown":et(e).replace(/[\u0000-\u001f\u007f]/g," ").trim().slice(0,64)||"source unknown"}function qe(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?Math.floor(e):null}function Vt(e){if(typeof e!="string"||e.length===0)return{output:"",displayTruncated:!1};const s=Be(e.replace(/\r\n?/g,`
|
|
3
3
|
`),Mt);let n=et(s.value).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g," ").trim(),r=s.truncated;const i=n?n.split(`
|
|
4
4
|
`):[];if(i.length>Lt-1&&(n=i.slice(-199).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./pwa-startup-xxamnV7P.js";import{r as i,R as x,E as j,D as u,f as g,h as f}from"./icons-CuXJn-Hz.js";import{l as b,c as d,d as y}from"./HubApp-
|
|
1
|
+
import{j as e}from"./pwa-startup-xxamnV7P.js";import{r as i,R as x,E as j,D as u,f as g,h as f}from"./icons-CuXJn-Hz.js";import{l as b,c as d,d as y}from"./HubApp-5FvyiOsk.js";import"./pwa-bootstrap-BCid3CYk.js";import"./preload-helper-DD1OZmLC.js";import"./MonitorStackIcon-DxbiAfTW.js";import"./supabase-C7qjtLN3.js";import"./frame-lifecycle-esOdP-EY.js";function z({hubUrl:s,onToast:n}){const[o,m]=i.useState([]),[h,c]=i.useState(!0),r=i.useCallback(async()=>{c(!0);try{m((await b(s)).captures||[])}catch(t){n(t instanceof Error?t.message:String(t))}finally{c(!1)}},[s,n]);i.useEffect(()=>{r()},[r]);const p=async t=>{const a=d(t.id,s);if(navigator.share)try{await navigator.share({title:t.fileName,url:a});return}catch{}window.open(a,"_blank","noopener,noreferrer")};return e.jsxs("section",{className:"capture-gallery",children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsx("span",{className:"settings-eyebrow",children:"Capture Gallery"}),e.jsx("h2",{children:"Saved captures"})]}),e.jsxs("button",{className:"text-button",onClick:()=>{r()},type:"button",children:[e.jsx(x,{size:15})," Refresh"]})]}),h?e.jsx("p",{className:"settings-help",children:"Loading captures..."}):o.length===0?e.jsx("p",{className:"settings-help",children:"No captures saved yet."}):e.jsx("div",{className:"capture-gallery-grid",children:o.map(t=>{const a=d(t.id,s);return e.jsxs("article",{className:"capture-gallery-card",children:[t.mimeType.startsWith("image/")?e.jsx("img",{src:a,alt:t.target.label}):e.jsx("video",{src:a,controls:!0,preload:"metadata"}),e.jsxs("div",{className:"capture-gallery-card-body",children:[e.jsx("strong",{children:t.fileName}),e.jsxs("small",{children:[t.target.label," · ",new Date(t.createdAt).toLocaleString()," · ",Math.ceil(t.sizeBytes/1024)," KB"]}),e.jsxs("div",{children:[e.jsx("button",{className:"icon-button",title:"Open","aria-label":"Open",onClick:()=>window.open(a,"_blank","noopener,noreferrer"),type:"button",children:e.jsx(j,{size:15})}),e.jsx("a",{className:"icon-button",title:"Download","aria-label":"Download",href:`${a}?download=1`,download:t.fileName,children:e.jsx(u,{size:15})}),e.jsx("button",{className:"icon-button",title:"Share","aria-label":"Share",onClick:()=>{p(t)},type:"button",children:e.jsx(g,{size:15})}),e.jsx("button",{className:"icon-button danger",title:"Delete","aria-label":"Delete",onClick:()=>{window.confirm(`Delete ${t.fileName}?`)&&y(t.id,s).then(()=>r()).catch(l=>n(l instanceof Error?l.message:String(l)))},type:"button",children:e.jsx(f,{size:15})})]})]})]},t.id)})})]})}export{z as CaptureGallery};
|