feat: modality-based URLs (/image/resize, /video/compress-video)

Tool routes now include the modality prefix: /image/crop, /video/trim-video,
/audio/convert-audio, /document/merge-pdf, /data/csv-json. Old URLs
(e.g. /resize) redirect to the new modality-prefixed path automatically.

Routes are computed by prepending MODALITY_URL_SLUG to each tool's route
in the TOOLS array at module init. The App.tsx route changed from
/:toolId to /:modality/:toolId, with a LegacyToolRedirect fallback.
This commit is contained in:
SnapOtter
2026-06-14 20:54:29 +08:00
parent 914ff1b1aa
commit ea83e1c8b4
3 changed files with 36 additions and 8 deletions
+8
View File
@@ -119,6 +119,14 @@ export const DOCUMENT_INPUTS = [
];
export const FILE_INPUTS = [".csv", ".json", ".xml", ".yaml", ".yml", ".zip"];
export const MODALITY_URL_SLUG: Record<Modality, string> = {
image: "image",
video: "video",
audio: "audio",
document: "document",
file: "data",
};
export function detectModalityFromMime(mime: string): Modality {
if (mime.startsWith("image/")) return "image";
if (mime.startsWith("video/")) return "video";