The next-generation file converter. Open source, fully local* and free forever.
chore: re-organize structure a bit
Maya95210e84eb73
diff --git a/src/lib/components/functional/FormatDropdown.svelte b/src/lib/components/functional/FormatDropdown.svelteindex 3ba801c..5cb27d1 100644--- a/src/lib/components/functional/FormatDropdown.svelte+++ b/src/lib/components/functional/FormatDropdown.svelte@@ -8,7 +8,7 @@import { onMount } from "svelte";import { quintOut } from "svelte/easing";import { VertFile } from "$lib/types";- import SettingsModal from "./SettingsModal.svelte";+ import SettingsModal from "./popups/SettingsModal.svelte";import { log } from "$lib/util/logger";type Props = {@@ -279,7 +279,7 @@});const ext = filename.split(".").pop() ?? "";return new VertFile(f, ext);- } catch (err) {+ } catch {return null;}})diff --git a/src/lib/components/functional/Dialog.svelte b/src/lib/components/functional/popups/Dialog.sveltesimilarity index 100%rename from src/lib/components/functional/Dialog.svelterename to src/lib/components/functional/popups/Dialog.sveltediff --git a/src/lib/components/functional/Modal.svelte b/src/lib/components/functional/popups/Modal.sveltesimilarity index 100%rename from src/lib/components/functional/Modal.svelterename to src/lib/components/functional/popups/Modal.sveltediff --git a/src/lib/components/functional/SettingsModal.svelte b/src/lib/components/functional/popups/SettingsModal.sveltesimilarity index 98%rename from src/lib/components/functional/SettingsModal.svelterename to src/lib/components/functional/popups/SettingsModal.svelteindex caf417e..54055f4 100644--- a/src/lib/components/functional/SettingsModal.svelte+++ b/src/lib/components/functional/popups/SettingsModal.svelte@@ -1,8 +1,8 @@<script lang="ts">/* eslint-disable @typescript-eslint/no-explicit-any */import { SearchIcon } from "lucide-svelte";- import Dropdown from "./Dropdown.svelte";- import FancyInput from "./FancyInput.svelte";+ import Dropdown from "../Dropdown.svelte";+ import FancyInput from "../FancyInput.svelte";import Modal from "./Modal.svelte";import { m } from "$lib/paraglide/messages";import type { VertFile } from "$lib/types";diff --git a/src/lib/components/functional/VertdError.svelte b/src/lib/components/functional/popups/VertdError.sveltesimilarity index 98%rename from src/lib/components/functional/VertdError.svelterename to src/lib/components/functional/popups/VertdError.svelteindex 6afa501..43733fe 100644--- a/src/lib/components/functional/VertdError.svelte+++ b/src/lib/components/functional/popups/VertdError.svelte@@ -31,8 +31,9 @@submitting = true;try {await submitInner();- } catch (e) {}- submitting = false;+ } finally {+ submitting = false;+ }};const submitInner = async () => {diff --git a/src/lib/components/functional/VertdErrorDetails.svelte b/src/lib/components/functional/popups/VertdErrorDetails.sveltesimilarity index 100%rename from src/lib/components/functional/VertdErrorDetails.svelterename to src/lib/components/functional/popups/VertdErrorDetails.sveltediff --git a/src/lib/components/layout/Dialogs.svelte b/src/lib/components/layout/Dialogs.svelteindex 0682825..c902203 100644--- a/src/lib/components/layout/Dialogs.svelte+++ b/src/lib/components/layout/Dialogs.svelte@@ -1,7 +1,7 @@<script lang="ts">import { duration, fade } from "$lib/util/animation";import { quintOut } from "svelte/easing";- import Dialog from "../functional/Dialog.svelte";+ import Dialog from "../functional/popups/Dialog.svelte";import {type Dialog as DialogType,dialogs,diff --git a/src/lib/converters/mediabunny.svelte.ts b/src/lib/converters/mediabunny.svelte.tsindex 75d11e1..031ab32 100644--- a/src/lib/converters/mediabunny.svelte.ts+++ b/src/lib/converters/mediabunny.svelte.ts@@ -17,12 +17,12 @@ import {WEBM,WebMOutputFormat,} from "mediabunny";-import { registerMp3Encoder } from "@mediabunny/mp3-encoder";import { registerAc3Decoder, registerAc3Encoder } from "@mediabunny/ac3";+import { registerMp3Encoder } from "@mediabunny/mp3-encoder";+import { registerFlacEncoder } from "@mediabunny/flac-encoder";import { Converter, FormatInfo, type WorkerStatus } from "./converter.svelte";import { ToastManager } from "$lib/util/toast.svelte";import { error, log } from "$lib/util/logger";-import { registerFlacEncoder } from "@mediabunny/flac-encoder";import { m } from "$lib/paraglide/messages";import type {SettingDefinition,@@ -32,6 +32,7 @@ import { CONVERSION_BITRATES, SAMPLE_RATES } from "./ffmpeg.svelte";// codec compatibility object, based on docs// https://mediabunny.dev/guide/supported-formats-and-codecs#compatibility-table+// eslint-disable-next-line @typescript-eslint/no-unused-varsconst codecCompatibility = {video: {mp4: ["avc", "hevc", "vp8", "vp9", "av1"],@@ -200,7 +201,7 @@ export class MediabunnyConverter extends Converter {super();// additional mediabunny coders- // currently both official ones -- maybe add our own in the future+ // currently the official ones -- maybe add our own in the futurethis.initializeCodecs();}diff --git a/src/lib/converters/vertd.svelte.ts b/src/lib/converters/vertd.svelte.tsindex 59ed619..151c5b7 100644--- a/src/lib/converters/vertd.svelte.ts+++ b/src/lib/converters/vertd.svelte.ts@@ -1,4 +1,4 @@-import VertdErrorComponent from "$lib/components/functional/VertdError.svelte";+import VertdErrorComponent from "$lib/components/functional/popups/VertdError.svelte";import { error, log } from "$lib/util/logger";import { m } from "$lib/paraglide/messages";import { Settings } from "$lib/sections/settings/index.svelte";diff --git a/src/lib/types/file.svelte.ts b/src/lib/types/file.svelte.tsindex c68f60c..25c31ba 100644--- a/src/lib/types/file.svelte.ts+++ b/src/lib/types/file.svelte.ts@@ -142,14 +142,27 @@ export class VertFile {const customConverter = this.converters.find((c) => c.name === this.conversionSettings.converter,);- const converter =- customConverter ||- (this.isZip() // TODO: not sure if the zip needs to be changed now- ? this.converters[0]- : this.findConverters([this.from, this.to])[0]);- log(["file", "convert"], `using converter: ${converter.name}`);+ let converter = customConverter;++ if (!converter) {+ const compatibleConverters = this.findConverters([+ this.from,+ this.to,+ ]);+ if (compatibleConverters.length) {+ converter = compatibleConverters[0];+ log(["file", "convert"], `found compatible converter: ${converter.name}`);+ } else {+ log(["file", "convert"], `no compatible converter found for ${this.from} to ${this.to}`);+ // TODO: handle zip converter fallback explicitly if needed+ // TODO: provide a clearer error path for unsupported from/to pairs+ }+ } else {+ log(["file", "convert"], `using custom converter from settings: ${converter.name}`);+ }if (!converter) throw new Error("No converter found");+ log(["file", "convert"], `using converter: ${converter.name}`);this.result = null;this.progress = 0;diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelteindex 206b6e7..533d1a3 100644--- a/src/routes/convert/+page.svelte+++ b/src/routes/convert/+page.svelte@@ -64,12 +64,6 @@const converter = getCurrentConverter(file);if (!converter) return;-- // Initialize converter in settings if not already set- if (!file.conversionSettings.converter)- file.conversionSettings.converter = converter.name;--let category: string | undefined;const isImage = converterCategories.image.includes(converter.name);const isAudio = converterCategories.audio.includes(converter.name);