camstack 1.2.105 → 1.2.106
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/cli.js
CHANGED
|
@@ -38,7 +38,7 @@ async function runServe(args) {
|
|
|
38
38
|
...typeof values.data === "string" ? { data: values.data } : {}
|
|
39
39
|
};
|
|
40
40
|
Object.assign(process.env, buildServeEnv(opts));
|
|
41
|
-
await import("./launcher-
|
|
41
|
+
await import("./launcher-3C6CQU54.js");
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// src/commands/agent.ts
|
|
@@ -83,7 +83,7 @@ async function runAgent(args) {
|
|
|
83
83
|
...typeof values.port === "string" ? { port: values.port } : {}
|
|
84
84
|
};
|
|
85
85
|
Object.assign(process.env, buildAgentEnv(opts));
|
|
86
|
-
await import("./launcher-
|
|
86
|
+
await import("./launcher-3C6CQU54.js");
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// src/commands/setup.ts
|
|
@@ -412781,8 +412781,8 @@ var require_session_cookie = __commonJS({
|
|
|
412781
412781
|
function shouldRedirectToLogin(method, accept) {
|
|
412782
412782
|
return method === "GET" && typeof accept === "string" && accept.includes("text/html");
|
|
412783
412783
|
}
|
|
412784
|
-
function loginRedirectUrl(originalUrl) {
|
|
412785
|
-
return
|
|
412784
|
+
function loginRedirectUrl(originalUrl, mountPrefix = null) {
|
|
412785
|
+
return `${mountPrefix ?? ""}/login?next=${encodeURIComponent(originalUrl)}`;
|
|
412786
412786
|
}
|
|
412787
412787
|
function isEmbedRedirectTarget(next) {
|
|
412788
412788
|
if (!next.startsWith("/addon/stream-broker/embed/"))
|
|
@@ -413959,6 +413959,97 @@ var require_spa_static = __commonJS({
|
|
|
413959
413959
|
}
|
|
413960
413960
|
});
|
|
413961
413961
|
|
|
413962
|
+
// ../../server/backend/dist/api/static/spa-mount.js
|
|
413963
|
+
var require_spa_mount = __commonJS({
|
|
413964
|
+
"../../server/backend/dist/api/static/spa-mount.js"(exports) {
|
|
413965
|
+
"use strict";
|
|
413966
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
413967
|
+
if (k2 === void 0) k2 = k;
|
|
413968
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
413969
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
413970
|
+
desc = { enumerable: true, get: function() {
|
|
413971
|
+
return m[k];
|
|
413972
|
+
} };
|
|
413973
|
+
}
|
|
413974
|
+
Object.defineProperty(o, k2, desc);
|
|
413975
|
+
}) : (function(o, m, k, k2) {
|
|
413976
|
+
if (k2 === void 0) k2 = k;
|
|
413977
|
+
o[k2] = m[k];
|
|
413978
|
+
}));
|
|
413979
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
413980
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
413981
|
+
}) : function(o, v) {
|
|
413982
|
+
o["default"] = v;
|
|
413983
|
+
});
|
|
413984
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
413985
|
+
var ownKeys = function(o) {
|
|
413986
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
413987
|
+
var ar = [];
|
|
413988
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
413989
|
+
return ar;
|
|
413990
|
+
};
|
|
413991
|
+
return ownKeys(o);
|
|
413992
|
+
};
|
|
413993
|
+
return function(mod) {
|
|
413994
|
+
if (mod && mod.__esModule) return mod;
|
|
413995
|
+
var result = {};
|
|
413996
|
+
if (mod != null) {
|
|
413997
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
413998
|
+
}
|
|
413999
|
+
__setModuleDefault(result, mod);
|
|
414000
|
+
return result;
|
|
414001
|
+
};
|
|
414002
|
+
})();
|
|
414003
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
414004
|
+
exports.FORWARDED_PREFIX_HEADER = void 0;
|
|
414005
|
+
exports.parseForwardedPrefix = parseForwardedPrefix;
|
|
414006
|
+
exports.injectSpaMount = injectSpaMount;
|
|
414007
|
+
exports.sendSpaShell = sendSpaShell;
|
|
414008
|
+
var fs = __importStar(__require("fs/promises"));
|
|
414009
|
+
var spa_static_1 = require_spa_static();
|
|
414010
|
+
exports.FORWARDED_PREFIX_HEADER = "x-forwarded-prefix";
|
|
414011
|
+
var FORWARDED_PREFIX_VARY = "X-Forwarded-Prefix";
|
|
414012
|
+
var MOUNT_META_NAME = "camstack-mount";
|
|
414013
|
+
var PREFIX_RE = /^\/[A-Za-z0-9_\-.]+(?:\/[A-Za-z0-9_\-.]+)*$/;
|
|
414014
|
+
var MAX_PREFIX_LENGTH = 512;
|
|
414015
|
+
function parseForwardedPrefix(value) {
|
|
414016
|
+
if (typeof value !== "string")
|
|
414017
|
+
return null;
|
|
414018
|
+
if (value.length === 0 || value.length > MAX_PREFIX_LENGTH)
|
|
414019
|
+
return null;
|
|
414020
|
+
const trimmed = value.endsWith("/") ? value.slice(0, -1) : value;
|
|
414021
|
+
if (trimmed === "")
|
|
414022
|
+
return null;
|
|
414023
|
+
if (!PREFIX_RE.test(trimmed))
|
|
414024
|
+
return null;
|
|
414025
|
+
if (trimmed.split("/").some((segment) => segment === ".." || segment === "."))
|
|
414026
|
+
return null;
|
|
414027
|
+
return trimmed;
|
|
414028
|
+
}
|
|
414029
|
+
function injectSpaMount(html, prefix) {
|
|
414030
|
+
const match = /<head(?:\s[^>]*)?>/i.exec(html);
|
|
414031
|
+
if (match === null)
|
|
414032
|
+
return html;
|
|
414033
|
+
const mount = `${prefix}/`;
|
|
414034
|
+
const injected = `<base href="${mount}"><meta name="${MOUNT_META_NAME}" content="${mount}">`;
|
|
414035
|
+
const at = match.index + match[0].length;
|
|
414036
|
+
return `${html.slice(0, at)}${injected}${html.slice(at)}`;
|
|
414037
|
+
}
|
|
414038
|
+
async function sendSpaShell(reply, indexPath, headers) {
|
|
414039
|
+
reply.header("cache-control", (0, spa_static_1.spaShellCacheControl)());
|
|
414040
|
+
reply.header("vary", FORWARDED_PREFIX_VARY);
|
|
414041
|
+
let html;
|
|
414042
|
+
try {
|
|
414043
|
+
html = await fs.readFile(indexPath, "utf8");
|
|
414044
|
+
} catch {
|
|
414045
|
+
return reply.status(503).send({ error: "Admin UI shell unavailable" });
|
|
414046
|
+
}
|
|
414047
|
+
const prefix = parseForwardedPrefix(headers[exports.FORWARDED_PREFIX_HEADER]);
|
|
414048
|
+
return reply.type("text/html").send(prefix === null ? html : injectSpaMount(html, prefix));
|
|
414049
|
+
}
|
|
414050
|
+
}
|
|
414051
|
+
});
|
|
414052
|
+
|
|
413962
414053
|
// ../../server/backend/dist/boot/integration-id-backfill.js
|
|
413963
414054
|
var require_integration_id_backfill = __commonJS({
|
|
413964
414055
|
"../../server/backend/dist/boot/integration-id-backfill.js"(exports) {
|
|
@@ -429580,6 +429671,7 @@ var require_main4 = __commonJS({
|
|
|
429580
429671
|
var sse_no_compression_js_1 = require_sse_no_compression();
|
|
429581
429672
|
var precompressed_asset_js_1 = require_precompressed_asset();
|
|
429582
429673
|
var spa_static_1 = require_spa_static();
|
|
429674
|
+
var spa_mount_1 = require_spa_mount();
|
|
429583
429675
|
var cap_providers_1 = require_cap_providers();
|
|
429584
429676
|
var logging_settings_1 = require_logging_settings();
|
|
429585
429677
|
var request_census_settings_1 = require_request_census_settings();
|
|
@@ -430207,7 +430299,7 @@ var require_main4 = __commonJS({
|
|
|
430207
430299
|
return reply.status(404).send({ error: "Not found" });
|
|
430208
430300
|
}
|
|
430209
430301
|
if (method === "GET" && spaIndexHtml) {
|
|
430210
|
-
return
|
|
430302
|
+
return (0, spa_mount_1.sendSpaShell)(reply, spaIndexHtml, request.headers);
|
|
430211
430303
|
}
|
|
430212
430304
|
return reply.status(404).send({ error: "Not found" });
|
|
430213
430305
|
}
|
|
@@ -430217,7 +430309,7 @@ var require_main4 = __commonJS({
|
|
|
430217
430309
|
if (!authHeader && !cookieToken) {
|
|
430218
430310
|
if ((0, session_cookie_js_1.shouldRedirectToLogin)(request.method, request.headers.accept)) {
|
|
430219
430311
|
const qs = request.url.includes("?") ? request.url.slice(request.url.indexOf("?")) : "";
|
|
430220
|
-
return reply.redirect((0, session_cookie_js_1.loginRedirectUrl)(fullPath + qs));
|
|
430312
|
+
return reply.redirect((0, session_cookie_js_1.loginRedirectUrl)(fullPath + qs, (0, spa_mount_1.parseForwardedPrefix)(request.headers["x-forwarded-prefix"])));
|
|
430221
430313
|
}
|
|
430222
430314
|
return reply.status(401).send({ error: "Unauthorized" });
|
|
430223
430315
|
}
|
|
@@ -430419,7 +430511,7 @@ var require_main4 = __commonJS({
|
|
|
430419
430511
|
return reply.status(503).send({ error: "Admin UI is starting" });
|
|
430420
430512
|
}
|
|
430421
430513
|
const pathOnly = url.split("?")[0] ?? url;
|
|
430422
|
-
if (/\.[a-zA-Z0-9]+$/.test(pathOnly)) {
|
|
430514
|
+
if (pathOnly !== "/index.html" && /\.[a-zA-Z0-9]+$/.test(pathOnly)) {
|
|
430423
430515
|
const rel = pathOnly.replace(/^\/+/, "");
|
|
430424
430516
|
const abs = path.join(staticDir, rel);
|
|
430425
430517
|
if ((abs === staticDir || abs.startsWith(staticDir + path.sep)) && fs.existsSync(abs)) {
|
|
@@ -430428,8 +430520,7 @@ var require_main4 = __commonJS({
|
|
|
430428
430520
|
}
|
|
430429
430521
|
return reply.callNotFound();
|
|
430430
430522
|
}
|
|
430431
|
-
|
|
430432
|
-
return reply.type("text/html").send(fs.createReadStream(indexPath));
|
|
430523
|
+
return (0, spa_mount_1.sendSpaShell)(reply, indexPath, request.headers);
|
|
430433
430524
|
});
|
|
430434
430525
|
const resolveAdminUi = async () => {
|
|
430435
430526
|
try {
|