feat: umm actual documents support..

This commit is contained in:
not-nullptr 2025-04-12 23:18:56 +01:00
parent a84837cff4
commit 8f8ea34483
10 changed files with 88 additions and 88 deletions

View File

@ -4,6 +4,7 @@
"": {
"name": "unnamed-file-converter",
"dependencies": {
"@bjorn3/browser_wasi_shim": "^0.4.1",
"@ffmpeg/ffmpeg": "^0.12.15",
"@ffmpeg/util": "^0.12.2",
"@fontsource/azeret-mono": "^5.1.1",
@ -47,6 +48,8 @@
"@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="],
"@bjorn3/browser_wasi_shim": ["@bjorn3/browser_wasi_shim@0.4.1", "", {}, "sha512-54kpBQX69TZ8I1zyDC8sziv/zPT1zoIadv3CmdIZNZ5WDF1houMjAzRZ3dwWvhXObiEBjOxXyS8Ja7vA0EfGEQ=="],
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.21.5", "", { "os": "aix", "cpu": "ppc64" }, "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ=="],
"@esbuild/android-arm": ["@esbuild/android-arm@0.21.5", "", { "os": "android", "cpu": "arm" }, "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg=="],

View File

@ -34,6 +34,7 @@
"vite": "^5.4.11"
},
"dependencies": {
"@bjorn3/browser_wasi_shim": "^0.4.1",
"@ffmpeg/ffmpeg": "^0.12.15",
"@ffmpeg/util": "^0.12.2",
"@fontsource/azeret-mono": "^5.1.1",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

View File

@ -70,7 +70,7 @@
stroke="2"
fill="none"
/>
<p class="text-black font-normal">{message}</p>
<p class="text-black font-normal whitespace-pre-wrap">{message}</p>
</div>
<button
class="text-gray-600 hover:text-black flex-shrink-0"

View File

@ -1,4 +1,5 @@
import { FFmpegConverter } from "./ffmpeg.svelte";
import { PandocConverter } from "./pandoc.svelte";
import { VertdConverter } from "./vertd.svelte";
import { VipsConverter } from "./vips.svelte";
@ -6,4 +7,5 @@ export const converters = [
new VipsConverter(),
new FFmpegConverter(),
new VertdConverter(),
new PandocConverter(),
];

View File

@ -46,7 +46,11 @@ export class PandocConverter extends Converter {
}
default:
throw new Error(`[${result.errorKind}] ${result.error}`);
if (result.errorKind)
throw new Error(
`[${result.errorKind}] ${result.error}`,
);
else throw new Error(result.error);
}
}
worker.terminate();

View File

@ -47,7 +47,7 @@
<!-- Main contributors -->
<div class="flex flex-col gap-4">
<div class="flex flex-row flex-wrap gap-2">
<div class="flex flex-col flex-wrap gap-2">
{#each mainContribs as contrib}
{@const { name, github, avatar, role } = contrib}
{@render contributor(name, github, avatar, role)}
@ -94,5 +94,12 @@
{/each}
</div>
{/if}
<h2 class="mt-2 -mb-2">Libraries</h2>
<p class="font-normal">
A big thanks to FFmpeg (audio, video), libvips (images) and Pandoc
(documents) for maintaining such excellent libraries for so many
years. VERT relies on them to provide you with your conversions.
</p>
</div>
</Panel>

View File

@ -48,10 +48,15 @@ const handleMessage = async (message: any): Promise<any> => {
try {
// eslint-disable-next-line prefer-const
let { to, file }: { to: Format; file: File } = message;
if (to === ".rtf") {
throw new Error(
"Converting into RTF is currently not supported.",
);
}
const buf = new Uint8Array(await file.arrayBuffer());
const args = `-f ${formatToReader(`.${file.name.split(".").pop() || ""}` as Format)} -t ${formatToReader(to)}`;
const [result, stderr] = await pandoc(args, buf);
if (stderr) {
if (result.length === 0) {
return {
type: "error",
error: stderr

View File

@ -10,20 +10,34 @@
converters.find((c) => c.name === name)?.supportedFormats.join(", ") ||
"none";
const status = $derived({
images: {
ready: converters.find((c) => c.name === "libvips")?.ready,
const status: {
[key: string]: {
ready: boolean;
formats: string;
icon: typeof Image;
};
} = $derived({
Images: {
ready: converters.find((c) => c.name === "libvips")?.ready || false,
formats: getSupportedFormats("libvips"),
icon: Image,
},
audio: {
ready: converters.find((c) => c.name === "ffmpeg")?.ready,
Audio: {
ready: converters.find((c) => c.name === "ffmpeg")?.ready || false,
formats: getSupportedFormats("ffmpeg"),
icon: AudioLines,
},
video: {
Documents: {
ready: converters.find((c) => c.name === "pandoc")?.ready || false,
formats: getSupportedFormats("pandoc"),
icon: Image,
},
Video: {
ready:
converters.find((c) => c.name === "vertd")?.ready &&
$vertdLoaded,
converters.find((c) => c.name === "vertd")?.ready ||
(false && $vertdLoaded),
formats: getSupportedFormats("vertd"),
icon: Film,
},
});
</script>
@ -58,79 +72,43 @@
<div class="mt-10 md:mt-16">
<h2 class="text-center text-4xl">VERT supports...</h2>
<div class="grid gap-4 md:grid-cols-3 mt-8">
<div class="file-category-card">
<div class="file-category-card-inner">
<div class="icon-container bg-accent-blue">
<Image size="20" />
<div class="flex gap-4 mt-8 md:flex-row flex-col">
{#each Object.entries(status) as [key, s]}
{@const Icon = s.icon}
<div class="file-category-card w-full">
<div class="file-category-card-inner">
<div class="icon-container bg-accent-blue">
<Icon size="20" />
</div>
<span>{key}</span>
</div>
<span>Images</span>
</div>
<div class="file-category-card-content">
<p class="flex items-center justify-center gap-2">
<Check size="20" /> Fully supported
</p>
<p>
<b>Status: </b>
{status.images.ready ? "ready" : "not ready"}
</p>
<p>
<b>Supported formats:</b>
{status.images.formats}
</p>
</div>
</div>
<div class="file-category-card">
<div class="file-category-card-inner">
<div class="icon-container bg-accent-purple">
<AudioLines size="20" />
<div class="file-category-card-content">
{#if key === "Video"}
<p>
Video uploads to a server for processing by
default, learn how to set it up locally <a
target="_blank"
href="https://github.com/VERT-sh/VERT/wiki/How-to-convert-video-with-VERT"
>here</a
>.
</p>
{:else}
<p class="flex items-center justify-center gap-2">
<Check size="20" /> Fully supported
</p>
{/if}
<p>
<b>Status: </b>
{s.ready ? "ready" : "not ready"}
</p>
<p>
<b>Supported formats:</b>
{s.formats}
</p>
</div>
<span>Audio</span>
</div>
<div class="file-category-card-content">
<p class="flex items-center justify-center gap-2">
<Check size="20" /> Fully supported
</p>
<p>
<b>Status: </b>
{status.audio.ready ? "ready" : "not ready"}
</p>
<p>
<b>Supported formats:</b>
{status.audio.formats}
</p>
</div>
</div>
<div class="file-category-card">
<div class="file-category-card-inner">
<div class="icon-container bg-accent-red">
<Film size="20" />
</div>
<span>Video *</span>
</div>
<div class="file-category-card-content">
<p>
Video uploads to a server for processing by default,
learn how to set it up locally <a
target="_blank"
href="https://github.com/VERT-sh/VERT/wiki/How-to-convert-video-with-VERT"
>here</a
>.
</p>
<p>
<b>Status: </b>
{status.video.ready ? "ready" : "not ready"}
</p>
<p>
<b>Supported formats:</b>
{status.video.formats}
</p>
</div>
</div>
{/each}
</div>
</div>
</div>

View File

@ -4,7 +4,7 @@
import { InfoIcon } from "lucide-svelte";
import { onMount } from "svelte";
import avatarNullptr from "$lib/assets/avatars/nullptr.jpg";
import avatarRealmy from "$lib/assets/avatars/realmy.jpg";
import avatarLiam from "$lib/assets/avatars/liam.jpg";
import avatarJovannMC from "$lib/assets/avatars/jovannmc.jpg";
import { GITHUB_API_URL } from "$lib/consts";
import { addToast } from "$lib/store/ToastProvider";
@ -31,18 +31,18 @@
role: "Lead developer; conversion backend, UI implementation",
avatar: avatarNullptr,
},
{
name: "Realmy",
github: "https://github.com/RealmyTheMan",
role: "Lead designer; logo and branding, user interface design",
avatar: avatarRealmy,
},
{
name: "JovannMC",
github: "https://github.com/JovannMC",
role: "Developer; UI implementation",
avatar: avatarJovannMC,
},
{
name: "Liam",
github: "https://x.com/z2rMC",
role: "Designer; UX, branding, marketing",
avatar: avatarLiam,
},
];
let ghContribs: Contributor[] = [];