Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

chore(chat): keep video streaming comments to their own behaviour

AdityaUmale6a70c9db7ac7
diff --git a/server/routes/threads.ts b/server/routes/threads.ts
index c70caf8184..2e6a6a9dd5 100644
--- a/server/routes/threads.ts
+++ b/server/routes/threads.ts
@@ -73,7 +73,7 @@ export interface ThreadRouteDeps {
keptAttachments?(): ReadonlySet<string> | null;
}
-/** The types the chat's video player accepts (AttachmentGallery.tsx); anything else is never streamed inline. */
+/** The types the chat's video player accepts; anything else is never streamed inline. */
const STREAMABLE_VIDEO_MIMES = new Set(["video/mp4", "video/webm", "video/quicktime", "video/x-m4v"]);
export function createThreadRoutes(deps: ThreadRouteDeps): RouteHandler {
@@ -189,7 +189,7 @@ export function createThreadRoutes(deps: ThreadRouteDeps): RouteHandler {
const streamsMessageImage = Boolean(
m && method === "GET" && url.searchParams.get("preview") === "1",
);
- // A <video> element can only GET, so a POST first trades its body for a link id (see message-media-links.ts).
+ // A <video> element can only GET, so a POST first trades its body for a link id.
const mediaId = m && method === "GET" && !streamsMessageImage ? url.searchParams.get("media") : null;
if (m && (method === "POST" || streamsMessageImage || mediaId)) {
if (method === "POST" && !String(req.headers["content-type"] ?? "").toLowerCase().startsWith("application/json")) {
diff --git a/src/components/AttachmentGallery.tsx b/src/components/AttachmentGallery.tsx
index b26a8f9da1..4b4abca71b 100644
--- a/src/components/AttachmentGallery.tsx
+++ b/src/components/AttachmentGallery.tsx
@@ -169,11 +169,7 @@ async function withStallRetry<T>(
const VIDEO_MIMES = ["video/mp4", "video/webm", "video/quicktime", "video/x-m4v"];
-/**
- * Security: the server's MIME is required as well as the filename, so arbitrary bytes never become UI.
- * A string is the server's link for this one file, which the player streams with byte ranges; a server without
- * links answers the same request with the bytes, read whole into a Blob as before.
- */
+/** Security: the server's MIME is required as well as the filename, so arbitrary bytes never become UI. */
export function loadMessageVideo(
file: GalleryFile,
message: MessageAttachmentContext,