bunqueue-dashboard 0.0.15 → 0.0.16
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/dist/.vite/manifest.json +57 -57
- package/dist/assets/{AddJob-CgeLluaI.js → AddJob-CMIT6e17.js} +1 -1
- package/dist/assets/{Benchmark-DrUL2MGj.js → Benchmark-Dq1-vJ2k.js} +1 -1
- package/dist/assets/{CopilotPanel-fr19SCy4.js → CopilotPanel-BDZzDmVy.js} +1 -1
- package/dist/assets/{CopyButton-BRNz3U_X.js → CopyButton-XT7ykzf5.js} +1 -1
- package/dist/assets/{Cron-CGpba--B.js → Cron-9hndZ-Z5.js} +1 -1
- package/dist/assets/{CronManager-C8DgqC22.js → CronManager-BQupx6wZ.js} +1 -1
- package/dist/assets/{Database-3TVTb28B.js → Database-Difs7xYV.js} +1 -1
- package/dist/assets/{Diagnostics-Bx3SLh8R.js → Diagnostics-BzVDq9CH.js} +1 -1
- package/dist/assets/{Dlq-fvEtz0IH.js → Dlq-BCUVh_NO.js} +1 -1
- package/dist/assets/{DlqControl-BuoZGZiz.js → DlqControl-Cu2i1oq5.js} +1 -1
- package/dist/assets/{DlqPro-Dc4R2c0h.js → DlqPro-HBrCftLD.js} +1 -1
- package/dist/assets/{Flows-uJwr4Xtd.js → Flows-D3Bvkmd6.js} +1 -1
- package/dist/assets/{JobInspector-BHzMp9AE.js → JobInspector-B7zEuFhM.js} +1 -1
- package/dist/assets/{Jobs-B3ngaITT.js → Jobs-ovYRwmwi.js} +1 -1
- package/dist/assets/{JobsPro-B8ZXHQat.js → JobsPro-DNZivuzq.js} +1 -1
- package/dist/assets/{Logs-BFNzXnJu.js → Logs-CjM7MNYN.js} +1 -1
- package/dist/assets/{LogsPro-BsYmMhV3.js → LogsPro-P73LCkap.js} +1 -1
- package/dist/assets/{McpServer-Dp5CU2Ao.js → McpServer-CUK20-uN.js} +1 -1
- package/dist/assets/{Metrics-BIy2WsIk.js → Metrics-BodjiKpf.js} +1 -1
- package/dist/assets/{MetricsPro-59vtSH96.js → MetricsPro-CqcH6gJp.js} +1 -1
- package/dist/assets/{Overview-CKCv4aez.js → Overview-AwCA3XI2.js} +1 -1
- package/dist/assets/{Pagination-DdeRIp2i.js → Pagination-Cd6lHj2E.js} +1 -1
- package/dist/assets/{QueueControl-Bnk114Oa.js → QueueControl-D7J1JObu.js} +1 -1
- package/dist/assets/{QueueDetail-BjblUfMz.js → QueueDetail-BtiN0s3b.js} +1 -1
- package/dist/assets/{Queues-DLfqg-GX.js → Queues-LrodynCj.js} +1 -1
- package/dist/assets/{QueuesOverview-2q1ROf6f.js → QueuesOverview-DrYjyped.js} +1 -1
- package/dist/assets/{S3Backup-BnL4NviE.js → S3Backup-et1PcCC0.js} +1 -1
- package/dist/assets/{S3BackupPro-MKhVJfmN.js → S3BackupPro-BEo_EVAO.js} +1 -1
- package/dist/assets/{ServerControl-MwMUqZXA.js → ServerControl-BRLFRj7k.js} +1 -1
- package/dist/assets/{Settings-Bg4nYelW.js → Settings-CeRZgZU6.js} +1 -1
- package/dist/assets/{Usage-Cf-_mayK.js → Usage-CHCg6VNy.js} +1 -1
- package/dist/assets/{UsagePro-Dvnkxjtk.js → UsagePro-Cto9k5OI.js} +1 -1
- package/dist/assets/{Webhooks-DI-3YwZu.js → Webhooks-Cm3vZEp7.js} +1 -1
- package/dist/assets/{Workers-DzewyMtr.js → Workers-CVfx3TK-.js} +1 -1
- package/dist/assets/{WorkersPro-DXnomAJx.js → WorkersPro-BidtV_Bp.js} +1 -1
- package/dist/assets/{index-D6Nj5ksZ.js → index-C9fPU4bV.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/scripts/embedded.gen.ts +96 -96
- package/scripts/serve.ts +33 -6
package/scripts/serve.ts
CHANGED
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
* 2. Proxies /api/* to the bunqueue server (BUNQUEUE_URL, default :6790) —
|
|
8
8
|
* same-origin like the dev proxy, so no CORS and SSE streams through.
|
|
9
9
|
* 3. Runs the control agent (start/stop/restart bunqueue) on 127.0.0.1:6800
|
|
10
|
-
* with the same Origin-allowlist security as agent/index.ts
|
|
10
|
+
* with the same Origin-allowlist security as agent/index.ts — and ALSO
|
|
11
|
+
* exposes it same-origin at /agent/* (the served index.html gets
|
|
12
|
+
* `window.__BUNQUEUE_AGENT_URL__ = '/agent'` injected), so the prebuilt
|
|
13
|
+
* SPA finds the agent regardless of AGENT_PORT and even from a remote
|
|
14
|
+
* browser, where loopback :6800 would be unreachable.
|
|
11
15
|
*
|
|
12
16
|
* Env: PORT (dashboard, default 8080) · BIND_ADDR (default 127.0.0.1) ·
|
|
13
17
|
* BUNQUEUE_URL · AGENT_PORT · AGENT_ALLOWED_ORIGINS · AGENT_TOKEN ·
|
|
@@ -43,13 +47,34 @@ const agentHandle = createFetchHandler(mgr, {
|
|
|
43
47
|
});
|
|
44
48
|
Bun.serve({ port: AGENT_PORT, hostname: '127.0.0.1', fetch: agentHandle });
|
|
45
49
|
|
|
46
|
-
//
|
|
50
|
+
// index.html with the runtime agent base injected, prepared once at startup.
|
|
51
|
+
// The SPA's lib/bq.ts reads window.__BUNQUEUE_AGENT_URL__ before its baked-in
|
|
52
|
+
// default, so Server Control works whatever AGENT_PORT is — the /agent/*
|
|
53
|
+
// route below forwards to the in-process agent handler.
|
|
54
|
+
const INDEX_HTML = (await Bun.file(ASSETS['/index.html']).text()).replace(
|
|
55
|
+
'</head>',
|
|
56
|
+
"<script>window.__BUNQUEUE_AGENT_URL__='/agent'</script></head>"
|
|
57
|
+
);
|
|
58
|
+
const indexResponse = () =>
|
|
59
|
+
new Response(INDEX_HTML, { headers: { 'content-type': 'text/html; charset=utf-8' } });
|
|
60
|
+
|
|
61
|
+
// Dashboard + /api proxy + same-origin /agent proxy.
|
|
47
62
|
Bun.serve({
|
|
48
63
|
port: PORT,
|
|
49
64
|
hostname: HOST,
|
|
50
65
|
async fetch(req) {
|
|
51
66
|
const url = new URL(req.url);
|
|
52
67
|
|
|
68
|
+
// Same-origin bridge to the control agent: strip the /agent prefix and
|
|
69
|
+
// hand the request to the in-process agent handler (no loopback hop).
|
|
70
|
+
// The agent's own Origin allowlist + optional AGENT_TOKEN still apply —
|
|
71
|
+
// this changes reachability, not authorization.
|
|
72
|
+
if (url.pathname === '/agent' || url.pathname.startsWith('/agent/')) {
|
|
73
|
+
const sub = new URL(url.pathname.slice('/agent'.length) || '/', 'http://agent.internal');
|
|
74
|
+
sub.search = url.search;
|
|
75
|
+
return agentHandle(new Request(sub, req));
|
|
76
|
+
}
|
|
77
|
+
|
|
53
78
|
// Same-origin proxy to the bunqueue server (mirrors the Vite dev proxy).
|
|
54
79
|
if (url.pathname === '/api' || url.pathname.startsWith('/api/')) {
|
|
55
80
|
const target = API + (url.pathname.slice(4) || '/') + url.search;
|
|
@@ -74,11 +99,13 @@ Bun.serve({
|
|
|
74
99
|
// Embedded static assets with SPA history fallback. A missing fingerprinted
|
|
75
100
|
// /assets/* file must 404 (as docker/Caddyfile does) — falling back to
|
|
76
101
|
// index.html would feed HTML to a stale chunk import() and mask the miss.
|
|
102
|
+
// index.html (direct or via fallback) is served from the injected copy.
|
|
77
103
|
const key = url.pathname === '/' ? '/index.html' : url.pathname;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
return new Response(
|
|
104
|
+
if (key === '/index.html') return indexResponse();
|
|
105
|
+
const asset = ASSETS[key];
|
|
106
|
+
if (asset) return new Response(Bun.file(asset));
|
|
107
|
+
if (url.pathname.startsWith('/assets/')) return new Response('Not found', { status: 404 });
|
|
108
|
+
return indexResponse();
|
|
82
109
|
},
|
|
83
110
|
});
|
|
84
111
|
|