@camstack/server 1.2.263 → 1.2.266

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.
@@ -809,7 +809,7 @@ async function runConnectionTest(ar, addonId, settings, logger) {
809
809
  }
810
810
  /**
811
811
  * Marker caps that flag an addon as a creatable integration type:
812
- * - `device-provider` — classic providers (Reolink/ONVIF/Frigate)
812
+ * - `device-provider` — classic providers (Reolink/ONVIF)
813
813
  * that expose `createDevice` + `discoverDevices` via their
814
814
  * device-provider cap.
815
815
  * - `device-adoption` — integration-style providers (Home Assistant
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FRAME_ANCESTORS_POLICY = void 0;
4
+ exports.isFramePolicyTarget = isFramePolicyTarget;
5
+ exports.registerFramePolicy = registerFramePolicy;
6
+ /** The one directive: frame me from my origin only. */
7
+ exports.FRAME_ANCESTORS_POLICY = "frame-ancestors 'self'";
8
+ const CSP_HEADER = 'content-security-policy';
9
+ /** Only a document can be framed; assets, JSON and streams are never one. */
10
+ function isFramePolicyTarget(contentType) {
11
+ return typeof contentType === 'string' && contentType.trim().toLowerCase().startsWith('text/html');
12
+ }
13
+ /**
14
+ * Install the `onSend` hook on the hub's one Fastify instance. Replies that
15
+ * bypass Fastify's reply pipeline (`reply.raw`, `reply.hijack()` — the addon
16
+ * reverse proxy's streaming path) are not seen here; they carry no HTML
17
+ * shell of ours.
18
+ */
19
+ function registerFramePolicy(fastify) {
20
+ fastify.addHook('onSend', async (_request, reply, payload) => {
21
+ if (!isFramePolicyTarget(reply.getHeader('content-type')))
22
+ return payload;
23
+ if (reply.getHeader(CSP_HEADER) !== undefined)
24
+ return payload;
25
+ reply.header(CSP_HEADER, exports.FRAME_ANCESTORS_POLICY);
26
+ return payload;
27
+ });
28
+ }
@@ -7380,6 +7380,33 @@ function createCapRouter_pipelineRunner(getProvider, createRemoteProxy) {
7380
7380
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7381
7381
  return p.runStatelessStep(methodInput);
7382
7382
  }),
7383
+ parkTrackFrame: trpc_middleware_js_1.protectedProcedure
7384
+ .input(types_89.pipelineRunnerCapability.methods.parkTrackFrame.input.loose())
7385
+ .output(types_89.pipelineRunnerCapability.methods.parkTrackFrame.output)
7386
+ .mutation(async ({ input, ctx }) => {
7387
+ const { nodeId, ...methodInput } = input;
7388
+ const p = resolveProvider('pipeline-runner', nodeId, () => getProvider(ctx), createRemoteProxy);
7389
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7390
+ return p.parkTrackFrame(methodInput);
7391
+ }),
7392
+ getParkedTrackFrame: trpc_middleware_js_1.protectedProcedure
7393
+ .input(types_89.pipelineRunnerCapability.methods.getParkedTrackFrame.input.loose())
7394
+ .output(types_89.pipelineRunnerCapability.methods.getParkedTrackFrame.output)
7395
+ .query(async ({ input, ctx }) => {
7396
+ const { nodeId, ...methodInput } = input;
7397
+ const p = resolveProvider('pipeline-runner', nodeId, () => getProvider(ctx), createRemoteProxy);
7398
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7399
+ return p.getParkedTrackFrame(methodInput);
7400
+ }),
7401
+ releaseParkedTrackFrames: trpc_middleware_js_1.protectedProcedure
7402
+ .input(types_89.pipelineRunnerCapability.methods.releaseParkedTrackFrames.input.loose())
7403
+ .output(types_89.pipelineRunnerCapability.methods.releaseParkedTrackFrames.output)
7404
+ .mutation(async ({ input, ctx }) => {
7405
+ const { nodeId, ...methodInput } = input;
7406
+ const p = resolveProvider('pipeline-runner', nodeId, () => getProvider(ctx), createRemoteProxy);
7407
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7408
+ return p.releaseParkedTrackFrames(methodInput);
7409
+ }),
7383
7410
  });
7384
7411
  }
7385
7412
  function createCapRouter_plateGallery(getProvider, createRemoteProxy) {
package/dist/main.js CHANGED
@@ -67,6 +67,7 @@ const sse_no_compression_js_1 = require("./api/sse-no-compression.js");
67
67
  const precompressed_asset_js_1 = require("./api/static/precompressed-asset.js");
68
68
  const spa_static_1 = require("./api/static/spa-static");
69
69
  const spa_mount_1 = require("./api/static/spa-mount");
70
+ const frame_policy_1 = require("./api/static/frame-policy");
70
71
  const cap_providers_1 = require("./api/core/cap-providers");
71
72
  const logging_settings_1 = require("./api/core/logging-settings");
72
73
  const request_census_settings_1 = require("./api/core/request-census-settings");
@@ -326,6 +327,10 @@ async function bootstrap() {
326
327
  app.enableCors();
327
328
  const fastify = app.getHttpAdapter().getInstance();
328
329
  await fastify.register(cookie_1.default);
330
+ // Every HTML document the hub serves may be framed by its own origin only
331
+ // (D425). Stamped here, on the one instance, so no shell-send site added
332
+ // later can ship without it.
333
+ (0, frame_policy_1.registerFramePolicy)(fastify);
329
334
  // Gzip/Brotli compression for all responses (including static JS/CSS).
330
335
  // Registered before @fastify/static so the compress plugin wraps the
331
336
  // static send path — hashed admin-ui chunks go from ~2MB to ~600KB on
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.263",
3
+ "version": "1.2.266",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",