Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Preview PDF files beside the chat instead of downloading them
AdityaUmale2cf09aa760e7
diff --git a/src/components/ChatMarkdown.test.ts b/src/components/ChatMarkdown.test.tsindex 6edf9cca6c..fdd9c2b423 100644--- a/src/components/ChatMarkdown.test.ts+++ b/src/components/ChatMarkdown.test.ts@@ -789,16 +789,16 @@ describe("ChatMarkdown attachments", () => {const message = { threadId: "thread-1", messageId: "message-1" };try {const html = renderToStaticMarkup(createElement(ChatMarkdown, {- text: "See https://github.com/a/app/pull/7 and [report.pdf](/work/report.pdf).",+ text: "See https://github.com/a/app/pull/7 and [report.zip](/work/report.zip).",message,- delivered: { "report.pdf": "/store/delivered-report.pdf" },+ delivered: { "report.zip": "/store/delivered-report.zip" },}));expect(html).toContain('data-github-ref="pull"');expect(html).toContain("<span>#7</span>");expect(html).toContain('title="Save a copy"');- expect(save).toHaveBeenCalledWith("/store/delivered-report.pdf", "report.pdf", message);- expect(html).not.toContain("/store/delivered-report.pdf");- expect(html).not.toContain("/work/report.pdf");+ expect(save).toHaveBeenCalledWith("/store/delivered-report.zip", "report.zip", message);+ expect(html).not.toContain("/store/delivered-report.zip");+ expect(html).not.toContain("/work/report.zip");} finally {save.mockRestore();}@@ -1132,14 +1132,23 @@ describe("ChatMarkdown attachments", () => {it("makes a message-authorized file link downloadable", () => {const html = renderToStaticMarkup(createElement(ChatMarkdown, {- text: "[Download the report](/workspace/final-report.pdf)",+ text: "[Download the report](/workspace/final-report.zip)",message: { threadId: "thread-1", messageId: "message-1" },}));expect(html).toContain('title="Save a copy"');- expect(html).not.toContain("/workspace/final-report.pdf");+ expect(html).not.toContain("/workspace/final-report.zip");expect(html).toContain("type=\"button\"");});+ it("opens a linked PDF in the preview, keeping its path private", () => {+ const html = renderToStaticMarkup(createElement(ChatMarkdown, {+ text: "[final-report.pdf](/workspace/final-report.pdf)",+ message: { threadId: "thread-1", messageId: "message-1" },+ }));+ expect(html).toContain('title="Preview: final-report.pdf"');+ expect(html).not.toContain("/workspace/final-report.pdf");+ });+it("does not nest a preview button in an anchor or block in a paragraph", () => {const standalone = renderToStaticMarkup(createElement(ChatMarkdown, {text: "",diff --git a/src/components/HtmlFilePreview.dom.test.ts b/src/components/HtmlFilePreview.dom.test.tsindex 8bcca29194..5a6168855a 100644--- a/src/components/HtmlFilePreview.dom.test.ts+++ b/src/components/HtmlFilePreview.dom.test.ts@@ -57,3 +57,34 @@ describe("HTML file preview errors", () => {expect(JSON.parse(String(fetch.mock.calls[1]![1]!.body))).toEqual({ path: "/outside/report.html", allowOutsideWorkspace: true });});});++describe("PDF file preview", () => {+ it("shows the PDF from a blob typed as PDF whatever the server said, with Download beside it", async () => {+ const made: Blob[] = [];+ const create = vi.spyOn(URL, "createObjectURL").mockImplementation((blob) => { made.push(blob as Blob); return "blob:pdf-preview"; });+ const revoke = vi.spyOn(URL, "revokeObjectURL").mockImplementation(() => {});+ try {+ vi.stubGlobal("fetch", vi.fn(async () => new Response("%PDF-1.4 report", { headers: { "content-type": "text/html" } })));+ await act(async () => root.render(createElement(HtmlFileButton, { path: "/workspace/report.pdf", name: "report.pdf", message })));+ await act(async () => host.querySelector<HTMLButtonElement>("button")!.click());+ await vi.waitFor(() => expect(document.body.querySelector("iframe")?.getAttribute("src")).toBe("blob:pdf-preview"));+ expect(made).toHaveLength(1);+ expect(made[0]!.type).toBe("application/pdf");+ expect(await made[0]!.text()).toBe("%PDF-1.4 report");+ expect(document.body.querySelector('button[aria-label="Save a copy of report.pdf"]')).not.toBeNull();+ expect(alertText()).toBe("");+ await act(async () => root.render(null));+ expect(revoke).toHaveBeenCalledWith("blob:pdf-preview");+ } finally {+ create.mockRestore();+ revoke.mockRestore();+ }+ });++ it("says the PDF could not be opened, not the page, when the request fails", async () => {+ vi.stubGlobal("fetch", vi.fn(async () => { throw new TypeError("Failed to fetch"); }));+ await act(async () => root.render(createElement(HtmlFileButton, { path: "/workspace/report.pdf", name: "report.pdf", message })));+ await act(async () => host.querySelector<HTMLButtonElement>("button")!.click());+ await vi.waitFor(() => expect(alertText()).toBe("Could not open this PDF. Check your connection and try again."));+ });+});diff --git a/src/components/HtmlFilePreview.test.ts b/src/components/HtmlFilePreview.test.tsindex 0e3a323962..62befd83fb 100644--- a/src/components/HtmlFilePreview.test.ts+++ b/src/components/HtmlFilePreview.test.ts@@ -2,7 +2,7 @@ import { createElement } from "react";import { renderToStaticMarkup } from "react-dom/server";import { afterEach, describe, expect, it, vi } from "vitest";import { AttachedFileChip } from "./AttachmentPreview";-import { HtmlPreviewFrame, OpenInBrowserButton, htmlPreviewDocument, isHtmlFile } from "./HtmlFilePreview";+import { HtmlPreviewFrame, OpenInBrowserButton, htmlPreviewDocument, isHtmlFile, isPdfFile } from "./HtmlFilePreview";import { PREVIEW_MAX_BYTES } from "../../shared/upload-limits";import { readTableResponse } from "./TableFilePreview";@@ -76,6 +76,29 @@ describe("HTML file chip (#4406)", () => {});});+describe("PDF file chip", () => {+ it.each(["report.pdf", "REPORT.PDF"])("knows %s is a PDF", (name) => expect(isPdfFile(name)).toBe(true));+ it.each(["report.pdf.zip", "pdf", "notes.md"])("rejects %s", (name) => expect(isPdfFile(name)).toBe(false));++ it("opens the preview from the file name and keeps saving on its own button", () => {+ const html = chip("2026 报告.pdf");+ expect(html).toMatch(/aria-label="Preview: 2026 报告.pdf"[^>]*>[^]*2026 报告\.pdf/);+ expect(html).not.toMatch(/<button[^>]*aria-label="Save a copy of 2026 报告.pdf"[^>]*class="flex min-h-10/);+ expect(html).toMatch(/class="table-action" aria-label="Save a copy of 2026 报告.pdf"/);+ });++ it("keeps saving from the name where the browser has no PDF viewer", () => {+ vi.stubGlobal("navigator", { ...globalThis.navigator, pdfViewerEnabled: false });+ try {+ const html = chip("report.pdf");+ expect(html).toMatch(/<button[^>]*aria-label="Save a copy of report.pdf"[^>]*class="flex min-h-10/);+ expect(html).not.toContain("Preview: report.pdf");+ } finally {+ vi.unstubAllGlobals();+ }+ });+});+describe("OpenInBrowserButton", () => {afterEach(() => vi.unstubAllGlobals());const button = () => renderToStaticMarkup(createElement(OpenInBrowserButton, { source: "<p>hi</p>", name: "report.html", onError: () => undefined }));diff --git a/src/components/HtmlFilePreview.tsx b/src/components/HtmlFilePreview.tsxindex 44bc252800..cf0f1edc92 100644--- a/src/components/HtmlFilePreview.tsx+++ b/src/components/HtmlFilePreview.tsx@@ -3,10 +3,11 @@ import { Check, Code2, Download, ExternalLink, Eye, LoaderCircle, RotateCcw } frimport { requestMessageFile, useLocalFileSave, type MessageAttachmentContext } from "./AttachmentPreview";import { OutsideWorkspacePreview, canOpenOutsideWorkspace, refusedAsOutsideWorkspace } from "./OutsideWorkspacePreview";import { TableDialog } from "./RichTable";-import { readTableResponse, TableFileContent } from "./TableFilePreview";+import { readResponseBytes, readTableResponse, TableFileContent } from "./TableFilePreview";import { cn } from "@/lib/cn";import { useFileBesideChat, type FilePreview } from "@/lib/file-preview";import { t } from "@/lib/i18n";+import type { LocaleKey } from "@/locales";import { tableDelimiter } from "@/lib/table-data";import { PREVIEW_MAX_BYTES } from "../../shared/upload-limits";@@ -25,6 +26,14 @@ export function isPlainTextFile(name: string): boolean {return /\.(txt|text|log)$/i.test(name);}+export function isPdfFile(name: string): boolean {+ return /\.pdf$/i.test(name);+}++/** False where the browser downloads PDFs instead of showing them (Android, or the viewer turned off): there a PDF's+ * name keeps saving it. */+const showsPdf = () => typeof navigator === "undefined" || navigator.pdfViewerEnabled !== false;+// Lazy, so the chat's Markdown renderer (which uses this file's chips) is not imported back into it.const MarkdownFileContent = lazy(() => import("./MarkdownFilePreview"));const WhatChangedContent = lazy(() => import("./WhatChangedView"));@@ -55,7 +64,7 @@ export function htmlBrowserBridge(): ((source: string, name: string) => Promise<return ogb?.remoteClient?.active ? undefined : ogb?.openHtmlInBrowser;}-/** The preview for an HTML or Markdown file in a message, opened by the eye button or by the file's name: beside the chat+/** The preview for an HTML, Markdown or PDF file in a message, opened by the eye button or by the file's name: beside the chat* when the window has room for it, else in a dialog. plainText: a plain text file opens it too. */export function useHtmlPreview(path: string, name: string, message?: MessageAttachmentContext, shownPath = path, plainText = false) {const [open, setOpen] = useState(false);@@ -64,6 +73,7 @@ export function useHtmlPreview(path: string, name: string, message?: MessageAttaconst kind = message === undefined ? null: isHtmlFile(name) || isHtmlFile(path) ? "html": isMarkdownFile(name) || isMarkdownFile(path) ? "markdown"+ : (isPdfFile(name) || isPdfFile(path)) && showsPdf() ? "pdf": plainText && (isPlainTextFile(name) || isPlainTextFile(path)) ? "text" : null;return {opens: kind !== null,@@ -86,6 +96,7 @@ export function FilePreviewContent({ kind, path, shownPath = path, name, messageconst key = `${message.threadId}:${message.messageId}:${path}`;if (kind === "changes") return original ? <MarkdownPreviewBoundary><Suspense fallback={<div role="status" className="flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary"><LoaderCircle size={16} className="animate-spin" />{t("changes.loading")}</div>}><WhatChangedContent key={`${key}:${original.path}`} edited={{ path, name, message }} original={{ path: original.path, name: original.name, message: { threadId: message.threadId, messageId: original.messageId } }} fill={fill} /></Suspense></MarkdownPreviewBoundary> : null;if (kind === "html") return <HtmlFileContent key={key} path={path} shownPath={shownPath} name={name} message={message} fill={fill} />;+ if (kind === "pdf") return <PdfFileContent key={key} path={path} shownPath={shownPath} name={name} message={message} fill={fill} />;if (kind === "table") {const delimiter = tableDelimiter(name) ?? tableDelimiter(path);return delimiter && <TableFileContent key={key} path={path} shownPath={shownPath} name={name} message={message} delimiter={delimiter} />;@@ -101,7 +112,7 @@ export function HtmlFileButton({ path, shownPath, name, message }: { path: strin</>;}-/** A file chip's name button: an HTML or Markdown file's name opens its preview, any other file's name saves it. */+/** A file chip's name button: an HTML, Markdown or PDF file's name opens its preview, any other file's name saves it. */export function chipNameAction(preview: ReturnType<typeof useHtmlPreview>, save: ReturnType<typeof useLocalFileSave>, name: string, retryable: boolean) {if (preview.opens) return { onClick: preview.show, disabled: false, "aria-label": preview.label };return { onClick: () => void save.save(), disabled: save.state === "saving", "aria-label": retryable ? t("attach.retrySaveAria", { name }) : t("attach.saveAria", { name }) };@@ -135,29 +146,35 @@ export function OpenInBrowserButton({ source, name, onError }: { source: string;}}><ExternalLink size={14} /></button>;}-function HtmlFileContent({ path, shownPath, name, message, fill }: { path: string; shownPath: string; name: string; message: MessageAttachmentContext; fill: boolean }) {+type PreviewError = "size" | "load" | "outside" | { reason: string };++const readHtml = (response: Response, signal: AbortSignal) => readTableResponse(response, signal, PREVIEW_MAX_BYTES);+// Security: the type is always PDF, so a file named .pdf that holds a page opens in the PDF viewer, never as a page+// on the app's own origin.+const readPdf = async (response: Response, signal: AbortSignal) => new Blob([await readResponseBytes(response, signal, PREVIEW_MAX_BYTES) as BlobPart], { type: "application/pdf" });++/** Loads a message's file for its preview, again on each retry, and from outside the chat's folder once the person+ * allows it. */+function usePreviewFile<T>(path: string, message: MessageAttachmentContext, read: (response: Response, signal: AbortSignal) => Promise<T>) {const fileKey = `${message.threadId}:${message.messageId}:${path}`;const [attempt, setAttempt] = useState(0);- const [source, setSource] = useState<string | null>(null);- const [error, setError] = useState<"size" | "load" | "outside" | { reason: string } | null>(null);+ const [value, setValue] = useState<T | null>(null);+ const [error, setError] = useState<PreviewError | null>(null);const [canOpenOutside, setCanOpenOutside] = useState(false);const [allowOutsideFor, setAllowOutsideFor] = useState<string | null>(null);const allowOutside = allowOutsideFor === fileKey;- const [showSource, setShowSource] = useState(false);- const [openFailed, setOpenFailed] = useState("");- const save = useLocalFileSave(path, name, message);useEffect(() => {const controller = new AbortController();setError(null);setCanOpenOutside(false);- setSource(null);+ setValue(null);void (async () => {let answered = false;try {const response = await requestMessageFile(path, message, controller.signal, allowOutside ? { allowOutsideWorkspace: true } : undefined);answered = true;- const text = await readTableResponse(response, controller.signal, PREVIEW_MAX_BYTES);- if (!controller.signal.aborted) setSource(text);+ const loaded = await read(response, controller.signal);+ if (!controller.signal.aborted) setValue(loaded);} catch (reason) {if (controller.signal.aborted) return;// A refusal from the server says why; only a request that got no answer (TypeError) is the connection.@@ -170,14 +187,31 @@ function HtmlFileContent({ path, shownPath, name, message, fill }: { path: strin}})();return () => controller.abort();- }, [path, message.threadId, message.messageId, attempt, allowOutside]);- if (error === "outside") return <OutsideWorkspacePreview filePath={shownPath} onOpenOutside={canOpenOutside ? () => setAllowOutsideFor(fileKey) : undefined} />;- if (error) return <div className="p-8 text-center text-sm"><p role="alert" className="mb-3 text-ink-secondary">{typeof error === "object" ? t("html.refused", { reason: error.reason }) : t(error === "size" ? "attach.fileTooLarge" : "html.loadFailed")}</p><button type="button" className="rounded-lg border border-hairline px-3 py-2 hover:bg-raised" onClick={() => setAttempt(attempt + 1)}>{t("chat.retry")}</button></div>;- if (source === null) return <div role="status" className="flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary"><LoaderCircle size={16} className="animate-spin" />{t("html.loading")}</div>;+ }, [path, message.threadId, message.messageId, attempt, allowOutside, read]);+ return { value, error, canOpenOutside, allowOutside, openOutside: () => setAllowOutsideFor(fileKey), retry: () => setAttempt(attempt + 1) };+}++/** What the preview shows instead of the file while it loads or after it failed; null once the file is there. */+function previewStatus(file: ReturnType<typeof usePreviewFile<unknown>>, shownPath: string, words: { refused: LocaleKey; failed: LocaleKey; loading: LocaleKey }) {+ const { error } = file;+ if (error === "outside") return <OutsideWorkspacePreview filePath={shownPath} onOpenOutside={file.canOpenOutside ? file.openOutside : undefined} />;+ if (error) return <div className="p-8 text-center text-sm"><p role="alert" className="mb-3 text-ink-secondary">{typeof error === "object" ? t(words.refused, { reason: error.reason }) : t(error === "size" ? "attach.fileTooLarge" : words.failed)}</p><button type="button" className="rounded-lg border border-hairline px-3 py-2 hover:bg-raised" onClick={file.retry}>{t("chat.retry")}</button></div>;+ if (file.value === null) return <div role="status" className="flex items-center justify-center gap-2 p-12 text-sm text-ink-secondary"><LoaderCircle size={16} className="animate-spin" />{t(words.loading)}</div>;+ return null;+}++function HtmlFileContent({ path, shownPath, name, message, fill }: { path: string; shownPath: string; name: string; message: MessageAttachmentContext; fill: boolean }) {+ const file = usePreviewFile(path, message, readHtml);+ const [showSource, setShowSource] = useState(false);+ const [openFailed, setOpenFailed] = useState("");+ const save = useLocalFileSave(path, name, message);+ const status = previewStatus(file, shownPath, { refused: "html.refused", failed: "html.loadFailed", loading: "html.loading" });+ const { value: source, allowOutside } = file;+ if (status || source === null) return status;return <div className={cn("flex flex-col gap-2", fill && "min-h-0 flex-1")}><div className="flex items-center justify-end gap-1"><button type="button" className="table-action" aria-pressed={showSource} aria-label={t(showSource ? "html.rendered" : "html.source")} title={t(showSource ? "html.rendered" : "html.source")} onClick={() => setShowSource(!showSource)}>{showSource ? <Eye size={14} /> : <Code2 size={14} />}</button>- <button type="button" className="table-action" aria-label={t("html.reload")} title={t("html.reload")} onClick={() => setAttempt(attempt + 1)}><RotateCcw size={14} /></button>+ <button type="button" className="table-action" aria-label={t("html.reload")} title={t("html.reload")} onClick={file.retry}><RotateCcw size={14} /></button><OpenInBrowserButton source={source} name={name} onError={setOpenFailed} /><button type="button" className="table-action" aria-label={t("attach.saveAria", { name })} title={t("attach.saveAria", { name })} disabled={save.state === "saving"} onClick={() => void save.save(allowOutside ? { allowOutsideWorkspace: true } : undefined)}><Download size={14} /></button></div>@@ -195,3 +229,29 @@ export const previewHeight = (fill = false) => fill ? "min-h-0 flex-1" : "h-[72dexport function HtmlPreviewFrame({ source, name, fill }: { source: string; name: string; fill?: boolean }) {return <iframe sandbox="" referrerPolicy="no-referrer" srcDoc={htmlPreviewDocument(source)} title={t("html.frameTitle", { name })} className={cn(previewHeight(fill), "w-full rounded-lg border border-hairline/40 bg-white")} />;}++/** Security: the PDF opens from a blob of this window only, typed as PDF, in the browser's own PDF viewer. */+function PdfFileContent({ path, shownPath, name, message, fill }: { path: string; shownPath: string; name: string; message: MessageAttachmentContext; fill: boolean }) {+ const file = usePreviewFile(path, message, readPdf);+ const [url, setUrl] = useState<string | null>(null);+ const save = useLocalFileSave(path, name, message);+ useEffect(() => {+ if (!file.value) {+ setUrl(null);+ return;+ }+ const made = URL.createObjectURL(file.value);+ setUrl(made);+ return () => URL.revokeObjectURL(made);+ }, [file.value]);+ const status = previewStatus(file, shownPath, { refused: "pdf.refused", failed: "pdf.loadFailed", loading: "markdown.loading" });+ if (status || url === null) return status;+ return <div className={cn("flex flex-col gap-2", fill && "min-h-0 flex-1")}>+ <div className="flex items-center justify-end gap-1">+ <button type="button" className="table-action" aria-label={t("html.reload")} title={t("html.reload")} onClick={file.retry}><RotateCcw size={14} /></button>+ <button type="button" className="table-action" aria-label={t("attach.saveAria", { name })} title={t("attach.saveAria", { name })} disabled={save.state === "saving"} onClick={() => void save.save(file.allowOutside ? { allowOutsideWorkspace: true } : undefined)}><Download size={14} /></button>+ </div>+ {save.state === "failed" && <p role="alert" className="text-end text-[12px] text-danger">{save.reason}</p>}+ <iframe src={url} referrerPolicy="no-referrer" title={t("html.frameTitle", { name })} className={cn(previewHeight(fill), "w-full rounded-lg border border-hairline/40 bg-white")} />+ </div>;+}diff --git a/src/components/TableFilePreview.tsx b/src/components/TableFilePreview.tsxindex 808eb70103..978670ab53 100644--- a/src/components/TableFilePreview.tsx+++ b/src/components/TableFilePreview.tsx@@ -7,15 +7,13 @@ import { useFileBesideChat } from "@/lib/file-preview";import { TABLE_FILE_MAX_BYTES, tableDelimiter, type TextTable } from "@/lib/table-data";import { t } from "@/lib/i18n";-/** A preview limit, not a download limit: chunked responses are bounded too. Text that is not UTF-8 is refused, unless- * `fallback` names a single-byte encoding to read it in instead; a NUL byte (UTF-16, binary) is refused even- * then, since such an encoding would only show it as garbage. */-export async function readTableResponse(response: Response, signal: AbortSignal, maxBytes = TABLE_FILE_MAX_BYTES, fallback?: string): Promise<string> {+/** The whole body. A preview limit, not a download limit: chunked responses are bounded too. */+export async function readResponseBytes(response: Response, signal: AbortSignal, maxBytes: number): Promise<Uint8Array> {if (Number(response.headers.get("content-length")) > maxBytes) {await response.body?.cancel().catch(() => {}); throw new Error("size"); // A body that already errored must not hide "size".}const reader = response.body?.getReader();- if (!reader) return "";+ if (!reader) return new Uint8Array();const parts: Uint8Array[] = [];let size = 0;try {@@ -28,7 +26,13 @@ export async function readTableResponse(response: Response, signal: AbortSignal,parts.push(part.value);}} finally { await reader.cancel().catch(() => {}); reader.releaseLock(); }- const bytes = new Uint8Array(await new Blob(parts as BlobPart[]).arrayBuffer());+ return new Uint8Array(await new Blob(parts as BlobPart[]).arrayBuffer());+}++/** Text that is not UTF-8 is refused, unless `fallback` names a single-byte encoding to read it in instead; a NUL+ * byte (UTF-16, binary) is refused even then, since such an encoding would only show it as garbage. */+export async function readTableResponse(response: Response, signal: AbortSignal, maxBytes = TABLE_FILE_MAX_BYTES, fallback?: string): Promise<string> {+ const bytes = await readResponseBytes(response, signal, maxBytes);// NUL is valid UTF-8, so UTF-16 without a byte order mark would pass the UTF-8 check: look for it first.if (fallback && bytes.includes(0)) throw new Error("encoding");try { return new TextDecoder("utf-8", { fatal: true }).decode(bytes); } catch (error) {diff --git a/src/lib/file-preview.ts b/src/lib/file-preview.tsindex 5b05132466..fe4ba616a9 100644--- a/src/lib/file-preview.ts+++ b/src/lib/file-preview.ts@@ -8,7 +8,7 @@ import { SIDEBAR_AND_PANEL_FIT } from "./use-media-query";/** A file from a message, shown beside the chat. Renderer-only: nothing about it is stored or sent anywhere. */export interface FilePreview {- kind: "html" | "markdown" | "text" | "table" | "changes";+ kind: "html" | "markdown" | "text" | "pdf" | "table" | "changes";path: string;shownPath?: string;name: string;diff --git a/src/locales/en.json b/src/locales/en.jsonindex cf38252006..9d502752b7 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -161,6 +161,8 @@"html.frameTitle": "Preview of {name}","html.openInBrowser": "Open {name} in your browser","html.openFailed": "Could not open this page in your browser.",+ "pdf.loadFailed": "Could not open this PDF. Check your connection and try again.",+ "pdf.refused": "Could not open this PDF: {reason}","markdown.preview": "Preview: {name}","markdown.loading": "Opening file…","markdown.tooLarge": "This file is too large for an in-app preview (2 MB). Download the original to view it.",diff --git a/src/locales/it.json b/src/locales/it.jsonindex 077c6d2781..8da4a9305d 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -161,6 +161,8 @@"html.frameTitle": "Anteprima di {name}","html.openInBrowser": "Aperto {name} nel tuo browser","html.openFailed": "Non è possibile aprire questa pagina nel browser.",+ "pdf.loadFailed": "Non riesco ad aprire questo PDF. Controlla la connessione e riprova.",+ "pdf.refused": "Non riesco ad aprire questo PDF: {reason}","markdown.preview": "Anteprima: {name}","markdown.loading": "Apertura del file…","markdown.tooLarge": "Questo file è troppo grande per l’anteprima nell’app (2 MB). Scarica l’originale per vederlo.",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 0dd3959498..60ba826a79 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -142,6 +142,8 @@"html.frameTitle": "Prévia de {name}","html.openInBrowser": "Abrir {name} no navegador","html.openFailed": "Não foi possível abrir esta página no navegador.",+ "pdf.loadFailed": "Não foi possível abrir este PDF. Verifique sua conexão e tente novamente.",+ "pdf.refused": "Não foi possível abrir este PDF: {reason}","markdown.preview": "Prévia: {name}","markdown.loading": "Abrindo arquivo…","markdown.tooLarge": "Este arquivo é grande demais para a prévia no app (2 MB). Baixe o original para vê-lo.",diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex 535b1bec67..8874028aa4 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -143,6 +143,8 @@"html.frameTitle": "{name} 的預覽","html.openInBrowser": "在你的瀏覽器中開啟 {name}","html.openFailed": "無法在你的瀏覽器中開啟這個頁面。",+ "pdf.loadFailed": "無法開啟此 PDF。請檢查網路連線後再試一次。",+ "pdf.refused": "無法開啟此 PDF:{reason}","markdown.preview": "預覽:{name}","markdown.loading": "正在開啟檔案…","markdown.tooLarge": "此檔案太大,無法在 App 內預覽(2 MB)。請下載原始檔案查看。",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex 2e355b71dd..ef62e506b2 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -161,6 +161,8 @@"html.frameTitle": "{name} 的预览","html.openInBrowser": "在浏览器中打开 {name}","html.openFailed": "无法在浏览器中打开这个页面。",+ "pdf.loadFailed": "无法打开此 PDF。请检查网络连接后重试。",+ "pdf.refused": "无法打开此 PDF:{reason}","markdown.preview": "预览:{name}","markdown.loading": "正在打开文件…","markdown.tooLarge": "此文件太大,无法在应用内预览(2 MB)。请下载原始文件查看。",