Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

docs: keep media response documentation with its implementation

Sameh Khamisbac45815d11f
diff --git a/server/providers/common/http.js b/server/providers/common/http.js
index 5ec7cf785..67b985c22 100644
--- a/server/providers/common/http.js
+++ b/server/providers/common/http.js
@@ -65,18 +65,6 @@ export function coalesceProxyRequest(inFlight, key, create) {
return { promise, shared: false };
}
-/**
- * Pipe an upstream fetch Response (image or video) to the client HTTP response.
- *
- * Forwards Content-Type, Content-Length, Content-Range, Accept-Ranges, and
- * Cache-Control headers from the upstream. Falls back to buffered arrayBuffer
- * if the body is not streamable.
- *
- * @param {import('http').ServerResponse} res
- * @param {Response} upstream - fetch() Response object.
- * @param {object} [opts]
- * @param {string} [opts.sourceHeader='upstream'] - Value for X-CCTV-Source header.
- */
/**
* Read a fetch Response body as text while enforcing a hard byte cap during
* the read — so a malicious or buggy upstream that streams an unbounded body
diff --git a/server/providers/local.js b/server/providers/local.js
index 7268d8282..db4244d82 100644
--- a/server/providers/local.js
+++ b/server/providers/local.js
@@ -3540,6 +3540,18 @@ function toReadable(body) {
return null;
}
+/**
+ * Pipe an upstream fetch Response (image or video) to the client HTTP response.
+ *
+ * Forwards Content-Type, Content-Length, Content-Range, Accept-Ranges, and
+ * Cache-Control headers from the upstream. Falls back to buffered arrayBuffer
+ * if the body is not streamable.
+ *
+ * @param {import('http').ServerResponse} res
+ * @param {Response} upstream - fetch() Response object.
+ * @param {object} [opts]
+ * @param {string} [opts.sourceHeader='upstream'] - Value for X-CCTV-Source header.
+ */
async function proxyMediaResponse(res, upstream, { sourceHeader = 'upstream' } = {}) {
const contentType = upstream.headers.get('content-type') || 'application/octet-stream';
const cacheControl = upstream.headers.get('cache-control') || 'no-store';