feat: add inline PDF viewer for Custom_PDF objects

Add a /pdf proxy route that forces Content-Disposition inline so PDFs render instead of downloading, and a web viewer that embeds the document in an iframe with a standalone open-in-new-tab link.
This commit is contained in:
2026-08-14 09:51:11 +08:00
parent 8bd186df54
commit dd08f901ae
8 changed files with 176 additions and 2 deletions
+5
View File
@@ -23,4 +23,9 @@ export function resolveAssetUrl(url: string, baseUrl?: string): string {
/** Route an external asset URL through the proxy so three.js can load it. */
export function assetUrl(url: string): string {
return `/asset?url=${encodeURIComponent(url)}`;
}
/** Route a PDF URL through the proxy so it renders inline instead of downloading. */
export function pdfUrl(url: string): string {
return `/pdf?url=${encodeURIComponent(url)}`;
}
+1 -1
View File
@@ -1,3 +1,3 @@
export { resolveAssetUrl, assetUrl } from './asset.js';
export { resolveAssetUrl, assetUrl, pdfUrl } from './asset.js';
export { traceImage } from './trace.js';
export type { TraceResult } from '@tts/shared';