Skip to content

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

feat(chat): stream large videos and audio in capped ranges, and offer a download when one will not play

milind-soniaed2714e8d2f
diff --git a/server/cloud-home-server.test.ts b/server/cloud-home-server.test.ts
index 8860ef3c6e..e37b4d0110 100644
--- a/server/cloud-home-server.test.ts
+++ b/server/cloud-home-server.test.ts
@@ -2,7 +2,7 @@
// Cloud Pro dropped included AI. Disposable home; no network; a synthetic Claude CLI.
import { randomBytes } from "node:crypto";
import { spawn, type ChildProcess } from "node:child_process";
-import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, rmSync, truncateSync, writeFileSync, writeSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
@@ -78,6 +78,7 @@ if (hang) process.env.FAKE_CLAUDE_MODE = "hang";
const failure = ${JSON.stringify(join(home, "fail.json"))};
if (!hang && existsSync(failure)) Object.assign(process.env, JSON.parse(readFileSync(failure, "utf8")));
if (process.argv[2] !== "--version") process.env.FAKE_CLAUDE_DUMP = ${JSON.stringify(join(home, "spawn"))} + (hang ? "-hang.json" : ".json");
+process.env.FAKE_CLAUDE_REPLY_FILE = ${JSON.stringify(join(home, "reply.md"))};
await import(${JSON.stringify(pathToFileURL(join(SERVER_DIR, "testing", "fake-claude-cli.ts")).href)});
`, { mode: 0o755 });
writeFileSync(join(dataDir, "config.json"), JSON.stringify({
@@ -453,3 +454,69 @@ it("tells the Admin's signed health read a failed turn's code, never its words,
expect((await read("W".repeat(43))).status).toBe(401);
expect((await api("GET", "/api/cloud/health?after=0", { remote: true })).status).toBe(401);
});
+
+it("streams a bot's 30 MB video to a browser signed in from the Cloud page, in ranges a player and a Save As both get", async () => {
+ const created = await api("POST", "/api/bots", { body: {
+ name: "Video fixture", modelSelection: { instanceId: "claude", model: "claude-sonnet-5" }, requireAvailableModel: true,
+ } });
+ expect(created.status, JSON.stringify(created.body)).toBe(201);
+ const botId = created.body.bot.id as string;
+ const clip = join(home, ".openmausbot", "workspaces", botId, "trip.mp4");
+ const size = 30 * 1024 * 1024;
+ mkdirSync(dirname(clip), { recursive: true });
+ writeFileSync(clip, "");
+ truncateSync(clip, size);
+ const marks = openSync(clip, "r+");
+ writeSync(marks, "HEAD", 0);
+ writeSync(marks, "TAIL", size - 4);
+ closeSync(marks);
+ writeFileSync(join(home, "reply.md"), `Here it is: [Trip](<${pathToFileURL(clip).href}>)`);
+ let reply: { id: string } | undefined;
+ let threadId = "";
+ try {
+ expect((await api("POST", `/api/bots/${botId}/messages`, { body: { text: "make the trip video" } })).status).toBe(202);
+ await expect.poll(async () => {
+ const bot = ((await api("GET", "/api/bots?messages=10")).body.bots as any[]).find((candidate) => candidate.id === botId);
+ threadId = bot?.threadId ?? "";
+ reply = bot?.messages.find((message: any) => message.role === "bot" && message.kind === "text" && String(message.text).includes("trip.mp4"));
+ return Boolean(reply);
+ }, { timeout: 15_000 }).toBe(true);
+ } finally {
+ rmSync(join(home, "reply.md"), { force: true });
+ }
+ const credential = await mintBrowserSignIn();
+ const signedIn = await browserRequest({ code: credential, label: "Edge on Windows", cookie: true, browser: true, attemptId: randomBytes(12).toString("base64url") });
+ expect(signedIn.status).toBe(200);
+ const cookie = (signedIn.headers.get("set-cookie") ?? "").split(";")[0]!;
+ // What the edge forwards from the browser: Chromium's own Sec-Fetch headers, the page's Origin only on the POST.
+ const edge = { host: HOST, "x-forwarded-for": "203.0.113.9", "x-forwarded-proto": "https" };
+ const page = { ...edge, cookie, origin: base.replace("http:", "https:"), "sec-fetch-site": "same-origin", "sec-fetch-mode": "cors", "sec-fetch-dest": "empty" };
+ const player = { ...edge, cookie, "sec-fetch-site": "same-origin", "sec-fetch-mode": "no-cors", "sec-fetch-dest": "video" };
+ const route = `/api/threads/${encodeURIComponent(threadId)}/messages/${encodeURIComponent(reply!.id)}/file`;
+ const issued = await fetch(`${base}${route}`, { method: "POST", headers: { ...page, "content-type": "application/json" }, body: JSON.stringify({ path: pathToFileURL(clip).href, media: true }) });
+ expect(issued.status).toBe(200);
+ const link = await issued.json() as { url: string; mime: string; bytes: number };
+ expect(link).toMatchObject({ mime: "video/mp4", bytes: size });
+
+ const first = await fetch(`${base}${link.url}`, { headers: { ...player, range: "bytes=0-" } });
+ expect(first.status).toBe(206);
+ expect(first.headers.get("content-range")).toBe(`bytes 0-${8 * 1024 * 1024 - 1}/${size}`);
+ expect(Buffer.from(await first.arrayBuffer()).subarray(0, 4).toString()).toBe("HEAD");
+ const last = await fetch(`${base}${link.url}`, { headers: { ...player, range: "bytes=-4" } });
+ expect(last.status).toBe(206);
+ expect(await last.text()).toBe("TAIL");
+ expect((await fetch(`${base}${link.url}`, { headers: { ...player, range: `bytes=${size}-` } })).status).toBe(416);
+
+ // The desktop menu's Save As and Open: the window's own download, with the cookie and no Origin or Range.
+ const saved = await fetch(`${base}${link.url}`, { headers: { ...edge, cookie, "sec-fetch-site": "none", "sec-fetch-mode": "navigate", "sec-fetch-dest": "document" } });
+ expect(saved.status).toBe(200);
+ expect(saved.headers.get("content-length")).toBe(String(size));
+ expect(saved.headers.get("content-disposition")).toBe(`inline; filename="trip.mp4"; filename*=UTF-8''trip.mp4`);
+ await saved.body?.cancel();
+
+ // The link is this browser's alone: the edge without its cookie, a page on another site, and the owner's app all get nothing.
+ expect((await fetch(`${base}${link.url}`, { headers: { ...edge, range: "bytes=0-" } })).status).toBe(403);
+ expect((await fetch(`${base}${link.url}`, { headers: { ...player, origin: "https://evil.example", "sec-fetch-site": "cross-site", range: "bytes=0-" } })).status).toBe(403);
+ expect((await api("GET", link.url)).status).toBe(404);
+ await fetch(`${base}/api/auth/logout`, { method: "POST", headers: { ...page } }).catch(() => undefined);
+});
diff --git a/server/index.test.ts b/server/index.test.ts
index a08e30be41..a9b7e9cc19 100644
--- a/server/index.test.ts
+++ b/server/index.test.ts
@@ -5,7 +5,7 @@ import { createHash, randomUUID } from "node:crypto";
import { once } from "node:events";
import { createServer, request, type Server } from "node:http";
import { connect, type Socket } from "node:net";
-import { chmodSync, existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, renameSync, rmSync, statSync, symlinkSync, truncateSync, utimesSync, writeFileSync } from "node:fs";
+import { chmodSync, closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readdirSync, readFileSync, renameSync, rmSync, statSync, symlinkSync, truncateSync, utimesSync, writeFileSync, writeSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
@@ -14471,7 +14471,7 @@ describe("message pages", () => {
expect(whole.status).toBe(200);
expect(whole.headers.get("content-type")).toBe("video/mp4");
expect(whole.headers.get("accept-ranges")).toBe("bytes");
- expect(whole.headers.get("content-disposition")).toBe("inline");
+ expect(whole.headers.get("content-disposition")).toBe(`inline; filename="clip.mp4"; filename*=UTF-8''clip.mp4`);
expect(whole.headers.get("cache-control")).toBe("private, no-store");
expect(whole.headers.get("x-content-type-options")).toBe("nosniff");
expect(whole.headers.get("cross-origin-resource-policy")).toBe("same-origin");
@@ -14513,6 +14513,75 @@ describe("message pages", () => {
}
});
+ it("streams a video over the 25 MB preview cap to a remote browser's cookie session in capped chunks, never to anyone else", async () => {
+ const threadId = "test-linked-file-room-thread";
+ const route = `/api/threads/${threadId}/messages/linked-video-message/file`;
+ const video = join(home, ".openmausbot", "workspaces", "test-bot-a", "clip.mp4");
+ const original = readFileSync(video);
+ const size = 30 * 1024 * 1024;
+ const chunk = 8 * 1024 * 1024;
+ // What a Cloud's edge proxy hands the server: the browser is remote and signed in by its cookie alone.
+ const viaEdge = { "x-forwarded-for": "198.51.100.30", "x-forwarded-proto": "https" };
+ const pairing = await api("POST", "/api/auth/pairing", { scopes: ["client"] });
+ const paired = await fetch(`${BASE}/api/auth/pair`, {
+ method: "POST", headers: { ...viaEdge, "content-type": "application/json" }, body: JSON.stringify({ code: pairing.body.code, label: "Cloud browser", cookie: true }),
+ });
+ expect(paired.status).toBe(200);
+ const browser = { ...viaEdge, cookie: paired.headers.get("set-cookie")!.split(";", 1)[0]! };
+ try {
+ truncateSync(video, size);
+ const marks = openSync(video, "r+");
+ writeSync(marks, "HEAD", 0);
+ writeSync(marks, "TAIL", size - 4);
+ closeSync(marks);
+
+ expect((await fetch(`${BASE}${route}`, {
+ method: "POST", headers: { ...viaEdge, "content-type": "application/json" }, body: JSON.stringify({ path: pathToFileURL(video).href, media: true }),
+ })).status).toBe(403);
+ const issued = await fetch(`${BASE}${route}`, {
+ method: "POST", headers: { ...browser, "content-type": "application/json" }, body: JSON.stringify({ path: pathToFileURL(video).href, media: true }),
+ });
+ expect(issued.status).toBe(200);
+ const link = (await issued.json()) as { url: string; bytes: number };
+ expect(link.bytes).toBe(size);
+
+ const first = await fetch(`${BASE}${link.url}`, { headers: { ...browser, range: "bytes=0-" } });
+ expect(first.status).toBe(206);
+ expect(first.headers.get("content-range")).toBe(`bytes 0-${chunk - 1}/${size}`);
+ expect(first.headers.get("content-length")).toBe(String(chunk));
+ const firstBytes = Buffer.from(await first.arrayBuffer());
+ expect(firstBytes.byteLength).toBe(chunk);
+ expect(firstBytes.subarray(0, 4).toString()).toBe("HEAD");
+
+ const small = await fetch(`${BASE}${link.url}`, { headers: { ...browser, range: "bytes=2-3" } });
+ expect(small.status).toBe(206);
+ expect(await small.text()).toBe("AD");
+ const last = await fetch(`${BASE}${link.url}`, { headers: { ...browser, range: "bytes=-4" } });
+ expect(last.headers.get("content-range")).toBe(`bytes ${size - 4}-${size - 1}/${size}`);
+ expect(await last.text()).toBe("TAIL");
+ const middle = await fetch(`${BASE}${link.url}`, { headers: { ...browser, range: `bytes=${chunk}-${size - 1}` } });
+ expect(middle.headers.get("content-range")).toBe(`bytes ${chunk}-${2 * chunk - 1}/${size}`);
+ await middle.body?.cancel();
+ const past = await fetch(`${BASE}${link.url}`, { headers: { ...browser, range: `bytes=${size}-` } });
+ expect(past.status).toBe(416);
+ expect(past.headers.get("content-range")).toBe(`bytes */${size}`);
+
+ // Save As sends no Range: the whole file streams, named for the download.
+ const whole = await fetch(`${BASE}${link.url}`, { headers: browser });
+ expect(whole.status).toBe(200);
+ expect(whole.headers.get("content-length")).toBe(String(size));
+ expect(whole.headers.get("content-disposition")).toBe(`inline; filename="clip.mp4"; filename*=UTF-8''clip.mp4`);
+ await whole.body?.cancel();
+
+ // The link is this browser's: the edge without its cookie, and this machine's own callers, get nothing.
+ expect((await fetch(`${BASE}${link.url}`, { headers: { ...viaEdge, range: "bytes=0-" } })).status).toBe(403);
+ expect((await fetch(`${BASE}${link.url}`, { headers: { range: "bytes=0-" } })).status).toBe(404);
+ } finally {
+ writeFileSync(video, original);
+ await fetch(`${BASE}/api/auth/logout`, { method: "POST", headers: browser }).catch(() => undefined);
+ }
+ });
+
it("shows the copy a bot delivered of an outside picture, and says why one it never delivered is refused", async () => {
const threadId = "test-linked-file-room-thread";
const ref = "Heidi, 51 – Sideboard\n\n".length;
diff --git a/server/message-file.ts b/server/message-file.ts
index 90689bd46d..99877e8883 100644
--- a/server/message-file.ts
+++ b/server/message-file.ts
@@ -587,7 +587,7 @@ export function messageFolderEntryName(value: unknown): string | null {
return value;
}
-export function messageFileDisposition(name: string): string {
+export function messageFileDisposition(name: string, type: "attachment" | "inline" = "attachment"): string {
const safeName = safeDisplayName(name);
const fallback = safeName
.normalize("NFKD")
@@ -597,7 +597,7 @@ export function messageFileDisposition(name: string): string {
const encoded = encodeURIComponent(safeName).replace(/[!'()*]/g, (char) =>
`%${char.charCodeAt(0).toString(16).toUpperCase()}`
);
- return `attachment; filename="${fallback}"; filename*=UTF-8''${encoded}`;
+ return `${type}; filename="${fallback}"; filename*=UTF-8''${encoded}`;
}
/** A transport name must not disguise the bytes' canonical extension (PDF bytes named setup.exe). */
diff --git a/server/message-media-links.test.ts b/server/message-media-links.test.ts
index f1fb63b2ca..bb990bf177 100644
--- a/server/message-media-links.test.ts
+++ b/server/message-media-links.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
-import { MESSAGE_MEDIA_IDLE_MS, MESSAGE_MEDIA_MAX_AGE_MS, MessageMediaLinks } from "./message-media-links.ts";
+import { parseAudioRange } from "./attachments.ts";
+import { cappedMediaRange, MESSAGE_MEDIA_IDLE_MS, MESSAGE_MEDIA_MAX_AGE_MS, MESSAGE_MEDIA_RANGE_MAX_BYTES, MessageMediaLinks, STREAMABLE_MEDIA_MIMES } from "./message-media-links.ts";
import type { RequestAuth } from "./request-auth.ts";
import type { SessionRecord } from "./sessions.ts";
@@ -51,4 +52,20 @@ describe("MessageMediaLinks", () => {
for (let i = 0; i < 600; i++) links.issue(grant, owner);
expect(links.use(first, "t1", "m1", owner)).toBeNull();
});
+
+ it("caps a player's range at one chunk and leaves small, suffix and missing ranges alone", () => {
+ const size = 500 * 1024 * 1024;
+ const capped = (header?: string) => cappedMediaRange(parseAudioRange(header, size));
+ expect(capped("bytes=0-")).toEqual({ kind: "range", start: 0, end: MESSAGE_MEDIA_RANGE_MAX_BYTES - 1 });
+ expect(capped(`bytes=100-${size - 1}`)).toEqual({ kind: "range", start: 100, end: 100 + MESSAGE_MEDIA_RANGE_MAX_BYTES - 1 });
+ expect(capped("bytes=10-19")).toEqual({ kind: "range", start: 10, end: 19 });
+ expect(capped("bytes=-4")).toEqual({ kind: "range", start: size - 4, end: size - 1 });
+ expect(capped(`bytes=${size}-`)).toEqual({ kind: "unsatisfiable" });
+ expect(capped(undefined)).toEqual({ kind: "none" });
+ });
+
+ it("links audio as well as video, and nothing else", () => {
+ for (const mime of ["video/mp4", "video/quicktime", "audio/mpeg", "audio/mp4", "audio/flac"]) expect(STREAMABLE_MEDIA_MIMES.has(mime), mime).toBe(true);
+ for (const mime of ["text/html", "image/png", "application/pdf"]) expect(STREAMABLE_MEDIA_MIMES.has(mime), mime).toBe(false);
+ });
});
diff --git a/server/message-media-links.ts b/server/message-media-links.ts
index 17cf8bcdc6..2a2a6e677a 100644
--- a/server/message-media-links.ts
+++ b/server/message-media-links.ts
@@ -3,6 +3,7 @@
// viewer, and the route re-runs every message, folder and MIME check against what the id stands for.
import { randomBytes } from "node:crypto";
+import type { AudioRange } from "./attachments.ts";
import type { RequestAuth } from "./request-auth.ts";
/** Idle limit: every range request a playing video makes renews it. */
@@ -10,6 +11,17 @@ export const MESSAGE_MEDIA_IDLE_MS = 15 * 60_000;
/** Hard limit, however busy the link is. */
export const MESSAGE_MEDIA_MAX_AGE_MS = 4 * 60 * 60_000;
const MAX_LINKS = 512;
+/** The most one answer to a player's range request carries; the player asks again for the rest. */
+export const MESSAGE_MEDIA_RANGE_MAX_BYTES = 8 * 1024 * 1024;
+/** What the chat's players accept; anything else is never handed a link. */
+export const STREAMABLE_MEDIA_MIMES: ReadonlySet<string> = new Set([
+ "video/mp4", "video/webm", "video/quicktime", "video/x-m4v",
+ "audio/mpeg", "audio/mp4", "audio/aac", "audio/wav", "audio/ogg", "audio/opus", "audio/flac",
+]);
+
+export function cappedMediaRange(range: AudioRange): AudioRange {
+ return range.kind === "range" ? { ...range, end: Math.min(range.end, range.start + MESSAGE_MEDIA_RANGE_MAX_BYTES - 1) } : range;
+}
export interface MessageMediaGrant {
threadId: string;
diff --git a/server/routes/threads.ts b/server/routes/threads.ts
index e41773c883..1cef6e0c89 100644
--- a/server/routes/threads.ts
+++ b/server/routes/threads.ts
@@ -16,7 +16,7 @@ import type { Coordinator } from "../coordinator.ts";
import type { WorkspaceAccess } from "../enterprise.ts";
import type { GroupUsageReader } from "../group-thread-usage.ts";
import { readMessage, searchMessagesAsync } from "../message-db.ts";
-import { MessageMediaLinks } from "../message-media-links.ts";
+import { cappedMediaRange, MessageMediaLinks, STREAMABLE_MEDIA_MIMES } from "../message-media-links.ts";
import {
listMessageFolder, MESSAGE_FILE_DOWNLOAD_MAX_BYTES, MESSAGE_FILE_MAX_BYTES, messageAttachmentName, messageFileDisposition, messageFileDownloadName, messageFolderEntryName,
messageImageTargetAt, messageReferencesFile, openMessageFile, openMessageFolderEntry, referencedFileName,
@@ -74,9 +74,6 @@ export interface ThreadRouteDeps {
keptAttachments?(): ReadonlySet<string> | null;
}
-/** 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 {
const {
store, userName: userNameFor, sessions, groupUsageReader, lendingEnabled,
@@ -289,9 +286,9 @@ export function createThreadRoutes(deps: ThreadRouteDeps): RouteHandler {
await file.handle.close();
return json(res, 415, { error: "only images can be previewed here" });
}
- if ((asksMediaLink || mediaGrant) && !STREAMABLE_VIDEO_MIMES.has(file.mime)) {
+ if ((asksMediaLink || mediaGrant) && !STREAMABLE_MEDIA_MIMES.has(file.mime)) {
await file.handle.close();
- return json(res, 415, { error: "only videos can be played here" });
+ return json(res, 415, { error: "only videos and audio can be played here" });
}
if (asksMediaLink) {
await file.handle.close();
@@ -302,7 +299,8 @@ export function createThreadRoutes(deps: ThreadRouteDeps): RouteHandler {
}
const inline = streamsMessageImage || Boolean(mediaGrant);
const rawRange = Array.isArray(req.headers.range) ? req.headers.range[0] : req.headers.range;
- const range = mediaGrant ? parseAudioRange(rawRange, file.bytes) : { kind: "none" as const };
+ // Without a Range header (Save As) the whole file streams; a player's range never ties up more than one chunk.
+ const range = mediaGrant ? cappedMediaRange(parseAudioRange(rawRange, file.bytes)) : { kind: "none" as const };
if (range.kind === "unsatisfiable") {
await file.handle.close();
res.writeHead(416, { "content-range": `bytes */${file.bytes}`, "cache-control": "private, no-store", "x-content-type-options": "nosniff" });
@@ -314,9 +312,9 @@ export function createThreadRoutes(deps: ThreadRouteDeps): RouteHandler {
"content-length": String(end - start + 1),
...(range.kind === "range" ? { "content-range": `bytes ${start}-${end}/${file.bytes}` } : {}),
...(mediaGrant ? { "accept-ranges": "bytes" } : {}),
- ...(inline
- ? { "content-disposition": "inline" }
- : { "content-disposition": messageFileDisposition(messageFileDownloadName(downloadName, file.name)) }),
+ "content-disposition": mediaGrant
+ ? messageFileDisposition(messageFileDownloadName(downloadName, file.name), "inline")
+ : inline ? "inline" : messageFileDisposition(messageFileDownloadName(downloadName, file.name)),
"cache-control": "private, no-store",
"cdn-cache-control": "no-store",
"cloudflare-cdn-cache-control": "no-store",
diff --git a/src/components/AttachmentGallery.test.ts b/src/components/AttachmentGallery.test.ts
index 3a9645a5a2..c072f3233a 100644
--- a/src/components/AttachmentGallery.test.ts
+++ b/src/components/AttachmentGallery.test.ts
@@ -65,25 +65,52 @@ describe("audio attachments", () => {
expect(isAudioAttachment("/store/a.mp4")).toBe(false);
});
+ const route = "/api/threads/thread%2Fone/messages/message%20two/file";
+ const asks = (body: unknown) => [route, {
+ method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body), signal: expect.any(AbortSignal),
+ }];
+
+ it("streams audio of any size through this message's own link", async () => {
+ const url = `${route}?media=${"c".repeat(43)}`;
+ const fetcher = vi.fn(async () => new Response(JSON.stringify({ url, mime: "audio/mpeg", bytes: PREVIEW_MAX_BYTES * 8 }), {
+ headers: { "content-type": "application/json", "x-openmausbot-media": "1" },
+ }));
+ vi.stubGlobal("fetch", fetcher);
+ expect(await loadMessageAudio(clip, message, new AbortController().signal)).toBe(url);
+ expect(fetcher.mock.calls).toEqual([asks({ path: clip.path, media: true })]);
+ vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify({ url, mime: "video/mp4" }), {
+ headers: { "content-type": "application/json", "x-openmausbot-media": "1" },
+ })));
+ await expect(loadMessageAudio(clip, message, new AbortController().signal)).rejects.toThrow("cannot be played");
+ });
+
it("loads audio through the message-scoped file endpoint and keeps the server's MIME type", async () => {
const fetcher = vi.fn(async () => new Response("audio bytes", { headers: { "content-type": "audio/mpeg" } }));
vi.stubGlobal("fetch", fetcher);
- const signal = new AbortController().signal;
- const blob = await loadMessageAudio(clip, message, signal);
- expect(fetcher).toHaveBeenCalledWith("/api/threads/thread%2Fone/messages/message%20two/file", {
- method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ path: clip.path }), signal: expect.any(AbortSignal),
- });
+ const blob = await loadMessageAudio(clip, message, new AbortController().signal) as Blob;
+ expect(fetcher.mock.calls).toEqual([asks({ path: clip.path, media: true })]);
expect(blob.type).toBe("audio/mpeg");
expect(await blob.text()).toBe("audio bytes");
});
+ it("asks again for the bytes when the server links only videos", async () => {
+ const fetcher = vi.fn(async (_url: string, init: RequestInit) => String(init.body).includes("media")
+ ? new Response(JSON.stringify({ error: "only videos can be played here" }), { status: 415 })
+ : new Response("audio bytes", { headers: { "content-type": "audio/mpeg" } }));
+ vi.stubGlobal("fetch", fetcher);
+ expect(await (await loadMessageAudio(clip, message, new AbortController().signal) as Blob).text()).toBe("audio bytes");
+ expect(fetcher.mock.calls).toEqual([asks({ path: clip.path, media: true }), asks({ path: clip.path })]);
+ });
+
it("refuses anything the server does not call audio, and keeps authorization failures", async () => {
for (const mime of ["text/html", "application/octet-stream", "video/mp4", "image/svg+xml"]) {
vi.stubGlobal("fetch", vi.fn(async () => new Response("not audio", { headers: { "content-type": mime } })));
await expect(loadMessageAudio(clip, message, new AbortController().signal)).rejects.toThrow("cannot be played");
}
- vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify({ error: "outside this conversation" }), { status: 403 })));
+ const refused = vi.fn(async () => new Response(JSON.stringify({ error: "outside this conversation" }), { status: 403 }));
+ vi.stubGlobal("fetch", refused);
await expect(loadMessageAudio(clip, message, new AbortController().signal)).rejects.toThrow("outside this conversation");
+ expect(refused).toHaveBeenCalledOnce();
});
it("enforces the size limit with and without Content-Length", async () => {
diff --git a/src/components/AttachmentGallery.tsx b/src/components/AttachmentGallery.tsx
index 4b4abca71b..fd09ef209a 100644
--- a/src/components/AttachmentGallery.tsx
+++ b/src/components/AttachmentGallery.tsx
@@ -186,7 +186,7 @@ async function readMessageVideo(
): Promise<Blob | string> {
const response = await requestMessageFile(file.path, message, signal, { mediaLink: true });
progress();
- if (response.headers.get("x-openmausbot-media") === "1") return messageVideoLink(await response.json().catch(() => null), message);
+ if (response.headers.get("x-openmausbot-media") === "1") return messageMediaLink(await response.json().catch(() => null), message, VIDEO_MIMES, t("attach.videoUnavailable"));
const mime = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase();
if (!mime || !VIDEO_MIMES.includes(mime)) {
await response.body?.cancel();
@@ -221,12 +221,12 @@ async function readMessageVideo(
}
/** Security: only this message's own file route, never a URL the response could point anywhere else. */
-function messageVideoLink(body: unknown, message: MessageAttachmentContext): string {
+function messageMediaLink(body: unknown, message: MessageAttachmentContext, mimes: readonly string[], unavailable: string): string {
const { url, mime } = (body ?? {}) as { url?: unknown; mime?: unknown };
const route = `/api/threads/${encodeURIComponent(message.threadId)}/messages/${encodeURIComponent(message.messageId)}/file?media=`;
if (typeof url !== "string" || !url.startsWith(route) || !/^[\w-]+$/.test(url.slice(route.length))
- || typeof mime !== "string" || !VIDEO_MIMES.includes(mime)) {
- throw new Error(t("attach.videoUnavailable"));
+ || typeof mime !== "string" || !mimes.includes(mime)) {
+ throw new Error(unavailable);
}
return url;
}
@@ -288,7 +288,16 @@ function VideoAttachment({ file, message }: { file: GalleryFile; message: Messag
return (
<div className="min-w-0 overflow-hidden rounded-xl border border-hairline/40 bg-inset/40">
<div className="relative flex aspect-[4/3] items-center justify-center bg-inset">
- {preview && !error ? (
+ {preview && error ? (
+ <div className="flex size-full flex-col items-center justify-center gap-2 p-3 text-center">
+ <Film size={24} className="text-ink-tertiary" aria-hidden="true" />
+ <p role="alert" className="text-[12px] text-ink-secondary">{error}</p>
+ <a href={preview} download={file.name} aria-label={t("attach.downloadAria", { name: file.name })}
+ className="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[13px] text-accent-text hover:bg-ink/[0.06] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus">
+ <Download size={14} aria-hidden="true" />{t("attach.download")}
+ </a>
+ </div>
+ ) : preview ? (
<video
ref={videoRef}
src={preview}
@@ -311,7 +320,7 @@ function VideoAttachment({ file, message }: { file: GalleryFile; message: Messag
>
{loading ? <LoaderCircle size={24} className="animate-spin" /> : <Play size={24} />}
<span className="text-[12px]">{loading ? t("attach.videoLoading") : error && !tooLarge ? t("chat.retry") : t("attach.loadVideo")}</span>
- {!error && !loading && <span className="text-[11px]">{t("attach.videoHint")}</span>}
+ {!error && !loading && <span className="text-[11px]">{t("attach.videoHintStreams")}</span>}
</button>
)}
{(preview || loading || error) && (
@@ -321,7 +330,7 @@ function VideoAttachment({ file, message }: { file: GalleryFile; message: Messag
)}
{!preview && !loading && <Film size={13} className="pointer-events-none absolute left-2 top-2 text-ink-secondary/50" />}
</div>
- {error && <p role="alert" className="px-3 py-2 text-[11px] text-danger">{error}</p>}
+ {error && !preview && <p role="alert" className="px-3 py-2 text-[11px] text-danger">{error}</p>}
<AttachedFileChip file={file} linked={file.linked} message={message} className="max-w-none rounded-none border-0 border-t border-hairline/30 bg-transparent" />
</div>
);
@@ -333,7 +342,7 @@ export function loadMessageAudio(
file: GalleryFile,
message: MessageAttachmentContext,
signal: AbortSignal,
-): Promise<Blob> {
+): Promise<Blob | string> {
return withStallRetry(signal, t("attach.audioUnavailable"), (attempt, progress) => readMessageAudio(file, message, attempt, progress));
}
@@ -342,9 +351,14 @@ async function readMessageAudio(
message: MessageAttachmentContext,
signal: AbortSignal,
progress: () => void,
-): Promise<Blob> {
- const response = await requestMessageFile(file.path, message, signal);
+): Promise<Blob | string> {
+ // A server that links only videos answers 415; it still sends the bytes to a plain request.
+ const response = await requestMessageFile(file.path, message, signal, { mediaLink: true }).catch((reason: unknown) => {
+ if ((reason as { status?: unknown } | null)?.status !== 415) throw reason;
+ return requestMessageFile(file.path, message, signal);
+ });
progress();
+ if (response.headers.get("x-openmausbot-media") === "1") return messageMediaLink(await response.json().catch(() => null), message, AUDIO_MIMES, t("attach.audioUnavailable"));
const mime = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase();
if (!mime || !AUDIO_MIMES.includes(mime)) {
await response.body?.cancel();
@@ -382,7 +396,7 @@ function AudioAttachment({ file, message }: { file: GalleryFile; message: Messag
const [error, setError] = useState("");
const request = useRef<AbortController | null>(null);
useEffect(() => () => request.current?.abort(), []);
- useEffect(() => () => { if (src) URL.revokeObjectURL(src); }, [src]);
+ useEffect(() => () => { if (src?.startsWith("blob:")) URL.revokeObjectURL(src); }, [src]);
const load = async () => {
if (request.current) return;
@@ -391,8 +405,8 @@ function AudioAttachment({ file, message }: { file: GalleryFile; message: Messag
setLoading(true);
setError("");
try {
- const blob = await loadMessageAudio(file, message, controller.signal);
- if (!controller.signal.aborted) setSrc(URL.createObjectURL(blob));
+ const source = await loadMessageAudio(file, message, controller.signal);
+ if (!controller.signal.aborted) setSrc(typeof source === "string" ? source : URL.createObjectURL(source));
} catch (reason) {
if (!controller.signal.aborted) setError(reason instanceof Error ? reason.message : t("attach.audioUnavailable"));
} finally {
diff --git a/src/components/AttachmentGallery.video.dom.test.ts b/src/components/AttachmentGallery.video.dom.test.ts
new file mode 100644
index 0000000000..6187d2168e
--- /dev/null
+++ b/src/components/AttachmentGallery.video.dom.test.ts
@@ -0,0 +1,43 @@
+// @vitest-environment happy-dom
+import { act, createElement } from "react";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { AttachmentGallery } from "./AttachmentGallery";
+
+const message = { threadId: "thread-one", messageId: "message-two" };
+const file = { path: "/workspace/trip.mov", name: "trip.mov", linked: true };
+const url = `/api/threads/thread-one/messages/message-two/file?media=${"a".repeat(43)}`;
+
+describe("a chat video the player cannot decode", () => {
+ let root: Root, host: HTMLElement;
+ beforeEach(() => {
+ host = document.createElement("div");
+ document.body.append(host);
+ root = createRoot(host);
+ vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify({ url, mime: "video/quicktime", bytes: 300 * 1024 * 1024 }), {
+ headers: { "content-type": "application/json", "x-openmausbot-media": "1" },
+ })));
+ });
+ afterEach(() => {
+ act(() => root.unmount());
+ host.remove();
+ vi.unstubAllGlobals();
+ });
+
+ it("streams a large file, and when it will not play offers a download of the same link instead of a dead player", async () => {
+ await act(async () => root.render(createElement(AttachmentGallery, { files: [file], message })));
+ expect(host.textContent).toContain("Plays on request");
+ expect(host.textContent).not.toContain("25 MB");
+ await act(async () => host.querySelector<HTMLButtonElement>('button[aria-label="Preview trip.mov"]')!.click());
+ const video = host.querySelector("video")!;
+ expect(video.getAttribute("src")).toBe(url);
+
+ await act(async () => { video.dispatchEvent(new Event("error")); });
+ expect(host.querySelector("video")).toBeNull();
+ expect(host.querySelector("[role=alert]")!.textContent).toBe("This video cannot be played here. You can still save a copy.");
+ const download = host.querySelector<HTMLAnchorElement>('a[aria-label="Download trip.mov"]')!;
+ expect(download.getAttribute("href")).toBe(url);
+ expect(download.getAttribute("download")).toBe("trip.mov");
+ expect(download.textContent).toBe("Download");
+ });
+});
diff --git a/src/components/AttachmentPreview.tsx b/src/components/AttachmentPreview.tsx
index 9d2bf5a80a..e1a3bee79f 100644
--- a/src/components/AttachmentPreview.tsx
+++ b/src/components/AttachmentPreview.tsx
@@ -237,7 +237,7 @@ export async function requestMessageFile(
});
if (!response.ok) {
const body = await response.json().catch(() => null) as { error?: string; code?: string } | null;
- throw Object.assign(new Error(serverErrorText(body, body?.error ?? t("attach.downloadFailed"))), { code: body?.code });
+ throw Object.assign(new Error(serverErrorText(body, body?.error ?? t("attach.downloadFailed"))), { code: body?.code, status: response.status });
}
return response;
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 9dd5fa8d45..f023bdf414 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1005,7 +1005,7 @@
"attach.previewVideo": "Preview {name}",
"attach.loadVideo": "Load video",
"attach.closeVideo": "Close video preview",
- "attach.videoHint": "Loads on request · up to 25 MB",
+ "attach.videoHintStreams": "Plays on request",
"attach.videoLoading": "Loading video…",
"attach.videoUnavailable": "This video cannot be played here. You can still save a copy.",
"attach.previewAudio": "Play {name}",
diff --git a/src/locales/es.json b/src/locales/es.json
index 2e9d3752a0..706df47a31 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -654,7 +654,6 @@
"attach.previewVideo": "Vista previa de {name}",
"attach.loadVideo": "Cargar video",
"attach.closeVideo": "Cerrar la vista previa del video",
- "attach.videoHint": "Se carga al pedirlo · hasta 25 MB",
"attach.videoLoading": "Cargando video…",
"attach.videoUnavailable": "Este video no se puede reproducir aquí. Aun así, puedes guardar una copia.",
"attach.previewAudio": "Reproducir {name}",
diff --git a/src/locales/it.json b/src/locales/it.json
index ed504afeec..691dcf4dc6 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -721,7 +721,6 @@
"attach.previewVideo": "Anteprima di {name}",
"attach.loadVideo": "Carica il video",
"attach.closeVideo": "Chiudi anteprima video",
- "attach.videoHint": "Si carica su richiesta · fino a 25 MB",
"attach.videoLoading": "Caricamento del video…",
"attach.videoUnavailable": "Questo video non si riproduce qui. Puoi comunque salvarne una copia.",
"attach.previewAudio": "Riproduci {name}",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 7dfd9cc978..5f63f762c1 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -830,7 +830,6 @@
"attach.previewVideo": "{name} をプレビュー",
"attach.loadVideo": "動画を読み込む",
"attach.closeVideo": "動画プレビューを閉じる",
- "attach.videoHint": "要求時に読み込み · 最大 25 MB",
"attach.videoLoading": "動画を読み込んでいます…",
"attach.videoUnavailable": "この動画はここでは再生できません。コピーの保存は可能です。",
"attach.previewAudio": "{name} を再生",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index c20effed85..8d3580a805 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -770,7 +770,6 @@
"attach.previewVideo": "{name} 미리보기",
"attach.loadVideo": "동영상 불러오기",
"attach.closeVideo": "동영상 미리보기 닫기",
- "attach.videoHint": "요청할 때 불러와요 · 최대 25MB",
"attach.videoLoading": "동영상 불러오는 중…",
"attach.videoUnavailable": "이 동영상은 여기서 재생할 수 없어요. 사본은 저장할 수 있어요.",
"attach.previewAudio": "{name} 재생",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index eadcffa0e2..19134c8ede 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -726,7 +726,6 @@
"attach.previewVideo": "Podgląd: {name}",
"attach.loadVideo": "Wczytaj wideo",
"attach.closeVideo": "Zamknij podgląd wideo",
- "attach.videoHint": "Wczytywane na żądanie · do 25 MB",
"attach.videoLoading": "Wczytywanie wideo…",
"attach.videoUnavailable": "Tego wideo nie można odtworzyć w tym miejscu. Nadal możesz zapisać kopię.",
"attach.previewAudio": "Odtwórz: {name}",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 4f2c7eb78c..ef5a1f3363 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -972,7 +972,7 @@
"attach.previewVideo": "Ver prévia de {name}",
"attach.loadVideo": "Carregar vídeo",
"attach.closeVideo": "Fechar a prévia do vídeo",
- "attach.videoHint": "Carrega quando você pedir · até 25 MB",
+ "attach.videoHintStreams": "Reproduz quando você pedir",
"attach.videoLoading": "Carregando vídeo…",
"attach.videoUnavailable": "Não dá para reproduzir este vídeo aqui, mas você pode salvar uma cópia.",
"attach.previewAudio": "Reproduzir {name}",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 4ce1ca2676..e18b9e4802 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -732,7 +732,6 @@
"attach.previewVideo": "Предпросмотр {name}",
"attach.loadVideo": "Загрузить видео",
"attach.closeVideo": "Закрыть предпросмотр видео",
- "attach.videoHint": "Загружается по запросу · до 25 МБ",
"attach.videoLoading": "Загрузка видео…",
"attach.videoUnavailable": "Это видео нельзя воспроизвести здесь. Вы всё равно можете сохранить копию.",
"attach.previewAudio": "Воспроизвести {name}",
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index 1db9e135ca..33f8eea090 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -4285,7 +4285,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -18321,7 +18320,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -26884,7 +26882,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -37246,7 +37243,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.fileTooLarge": "a50fd7752c7cc02d6f14fd4a4c1dea87b539f4bfbf05d10fe195fcbed5a15080",
@@ -47527,7 +47523,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -61971,7 +61966,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -67973,7 +67967,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -74148,7 +74141,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -81410,7 +81402,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -88708,7 +88699,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
@@ -95982,7 +95972,6 @@
"attach.previewVideo": "46f4453356a0d51b135491e9ea80f2d917e8fae656b275dd5b7d705d4026f440",
"attach.loadVideo": "20fd50061f6cdf43843e3c1c19078c2349af252e0a203e6a9ce2e9f054b9ea6d",
"attach.closeVideo": "39ea06d45ed0691f9d4484f3bfca00117c2214d9506e94fa3633af277c1e6610",
- "attach.videoHint": "86bacabf04703ec70024a834631bd2eb7fbee83c4ee8e616a8ebe957553888dc",
"attach.videoLoading": "bbef69c8923287bf8e9b1ee05cd35ce123325bb5829a32e06879386e5c763098",
"attach.videoUnavailable": "0264b0ec58746236782df04a41666bfdeb1402f430996e2aad39292e5ede0209",
"attach.previewAudio": "8915e145b5af24e9f386820e06cd3e4dce620e9f816ac45dce6813802b5ddddb",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index 3c897160c6..4e8c61b675 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -443,7 +443,6 @@
"attach.previewVideo": "{name} önizlemesi",
"attach.loadVideo": "Videoyu yükle",
"attach.closeVideo": "Video önizlemesini kapat",
- "attach.videoHint": "İstek üzerine yüklenir · 25 MB'a kadar",
"attach.videoLoading": "Video yükleniyor…",
"attach.videoUnavailable": "Bu video burada oynatılamıyor. Yine de bir kopyasını kaydedebilirsiniz.",
"attach.previewAudio": "{name} çal",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 5b08f60288..78ae93a53e 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -443,7 +443,6 @@
"attach.previewVideo": "Xem trước {name}",
"attach.loadVideo": "Tải video",
"attach.closeVideo": "Đóng xem trước video",
- "attach.videoHint": "Tải theo yêu cầu · tối đa 25 MB",
"attach.videoLoading": "Đang tải video…",
"attach.videoUnavailable": "Không thể phát video này ở đây. Bạn vẫn có thể lưu một bản sao.",
"attach.previewAudio": "Phát {name}",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 42e785e66a..2e249f5aab 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -906,7 +906,6 @@
"attach.previewVideo": "預覽 {name}",
"attach.loadVideo": "載入影片",
"attach.closeVideo": "關閉影片預覽",
- "attach.videoHint": "依需求載入 · 最多 25 MB",
"attach.videoLoading": "正在載入影片…",
"attach.videoUnavailable": "無法在此播放這部影片,但你仍可儲存副本。",
"attach.previewAudio": "播放 {name}",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 9c4cdee562..939dc30923 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -1028,7 +1028,6 @@
"attach.previewVideo": "预览 {name}",
"attach.loadVideo": "加载视频",
"attach.closeVideo": "关闭视频预览",
- "attach.videoHint": "依需求加载 · 最多 25 MB",
"attach.videoLoading": "正在加载视频…",
"attach.videoUnavailable": "无法在此播放这部视频,但你仍可保存副本。",
"attach.previewAudio": "播放 {name}",