The next-generation file converter. Open source, fully local* and free forever.
refactor: clsx for conditional classes, directives for styles, converter category cleanup
JovannMCba722dd21f81
diff --git a/src/env.ts b/src/env.tsindex 5842b0c..edfbb73 100644--- a/src/env.ts+++ b/src/env.ts@@ -4,27 +4,32 @@ export const variables = defineEnvVars({PUB_HOSTNAME: {public: true,static: true,- description: "The hostname used for analytics tracking (currently only used by Plausible).",+ description:+ "The hostname used for analytics tracking (currently only used by Plausible).",},PUB_PLAUSIBLE_URL: {public: true,static: true,- description: "URL for your Plausible Analytics instance (leave empty to disable analytics).",+ description:+ "URL for your Plausible Analytics instance (leave empty to disable analytics).",},PUB_ENV: {public: true,static: true,- description: 'Application environment: "production", "development", or "nightly".',+ description:+ 'Application environment: "production", "development", or "nightly".',},PUB_VERTD_URL: {public: true,static: true,- description: "URL of the vertd daemon for video conversion (default: official VERT instance).",+ description:+ "URL of the vertd daemon for video conversion (default: official VERT instance).",},PUB_DISABLE_ALL_EXTERNAL_REQUESTS: {public: true,static: true,- description: "Set to true to disable all external requests (vertd, Stripe, Plausible, etc.).",+ description:+ "Set to true to disable all external requests (vertd, Stripe, Plausible, etc.).",},PUB_DISABLE_FAILURE_BLOCKS: {public: true,@@ -35,11 +40,13 @@ export const variables = defineEnvVars({PUB_DONATION_URL: {public: true,static: true,- description: "Stripe donation settings. Please keep these values the same, they support VERT's development!",+ description:+ "Stripe donation settings. Please keep these values the same, they support VERT's development!",},PUB_STRIPE_KEY: {public: true,static: true,- description: "Stripe donation settings. Please keep these values the same, they support VERT's development!",+ description:+ "Stripe donation settings. Please keep these values the same, they support VERT's development!",},});diff --git a/src/lib/assets/style/host-grotesk.css b/src/lib/assets/style/host-grotesk.cssindex 143434e..ffe6974 100644--- a/src/lib/assets/style/host-grotesk.css+++ b/src/lib/assets/style/host-grotesk.css@@ -23,7 +23,8 @@font-family: "Host Grotesk";font-style: italic;font-weight: 500;- src: url("/src/lib/assets/font/HostGrotesk-MediumItalic.woff2") format("woff2");+ src: url("/src/lib/assets/font/HostGrotesk-MediumItalic.woff2")+ format("woff2");}@font-face {diff --git a/src/lib/components/functional/ConversionPanel.svelte b/src/lib/components/functional/ConversionPanel.svelteindex 9874052..9836bbf 100644--- a/src/lib/components/functional/ConversionPanel.svelte+++ b/src/lib/components/functional/ConversionPanel.svelte@@ -1,6 +1,10 @@<script lang="ts">import { effects, files, isMobile } from "#lib/store/index.svelte";- import { FolderArchiveIcon, RefreshCwIcon, TrashIcon } from "@lucide/svelte";+ import {+ FolderArchiveIcon,+ RefreshCwIcon,+ TrashIcon,+ } from "@lucide/svelte";import Panel from "../visual/Panel.svelte";import Dropdown from "./Dropdown.svelte";import Tooltip from "../visual/Tooltip.svelte";@@ -72,9 +76,10 @@</button>{#if $isMobile}<button- class="btn p-4 {$effects- ? ''- : '!scale-100'} flex gap-3 max-md:w-full"+ class={clsx(+ "btn p-4 flex gap-3 max-md:w-full",+ !$effects && "!scale-100",+ )}disabled={files.files.length === 0}onclick={() => files.removeAll()}>@@ -87,9 +92,10 @@position="right"><button- class="btn p-4 {$effects- ? ''- : '!scale-100'} flex gap-3 max-md:w-full"+ class={clsx(+ "btn p-4 flex gap-3 max-md:w-full",+ !$effects && "!scale-100",+ )}disabled={files.files.length === 0}onclick={() => files.removeAll()}>diff --git a/src/lib/components/functional/FancyInput.svelte b/src/lib/components/functional/FancyInput.svelteindex 62f47ad..bf03847 100644--- a/src/lib/components/functional/FancyInput.svelte+++ b/src/lib/components/functional/FancyInput.svelte@@ -65,25 +65,40 @@{...rest}bind:value{disabled}- class="w-full rounded-lg bg-panel border-2 border-button- {thin ? 'py-1.5' : 'p-3'}- {prefix ? 'pl-[2rem]' : thin ? 'pl-2.5' : 'pl-3'}- {extension ? (thin ? 'pr-[3.5rem]' : 'pr-[4rem]') : thin ? 'pr-2.5' : 'pr-3'}- {disabled && 'opacity-50 cursor-not-allowed'}- {inputClass}"- ></textarea>+ class={clsx(+ "w-full rounded-lg bg-panel border-2 border-button",+ thin ? "py-1.5" : "p-3",+ prefix ? "pl-[2rem]" : thin ? "pl-2.5" : "pl-3",+ extension+ ? thin+ ? "pr-[3.5rem]"+ : "pr-[4rem]"+ : thin+ ? "pr-2.5"+ : "pr-3",+ disabled && "opacity-50 cursor-not-allowed",+ inputClass,+ )}></textarea>{:else}<input{...rest}{type}bind:value{disabled}- class="w-full rounded-lg bg-panel border-2 border-button- {thin ? 'py-1.5' : 'p-3'}- {prefix ? 'pl-[2rem]' : thin ? 'pl-2.5' : 'pl-3'}- {extension ? (thin ? 'pr-[3rem]' : 'pr-[4rem]') : thin ? 'pr-2.5' : 'pr-3'}- {disabled && 'opacity-50 cursor-not-allowed'}- {inputClass}"+ class={clsx(+ "w-full rounded-lg bg-panel border-2 border-button",+ thin ? "py-1.5" : "p-3",+ prefix ? "pl-[2rem]" : thin ? "pl-2.5" : "pl-3",+ extension+ ? thin+ ? "pr-[3rem]"+ : "pr-[4rem]"+ : thin+ ? "pr-2.5"+ : "pr-3",+ disabled && "opacity-50 cursor-not-allowed",+ inputClass,+ )}/>{/if}@@ -95,14 +110,16 @@{/if}{#if extension}<div- class="absolute right-0 top-0 bottom-0 flex items-center {thin- ? 'px-2'- : 'px-4'}"+ class={clsx(+ "absolute right-0 top-0 bottom-0 flex items-center",+ thin ? "px-2" : "px-4",+ )}><span- class="bg-button text-black dynadark:text-white rounded {thin- ? 'text-xs px-2 py-0.5'- : 'text-sm px-2 py-1'}">{extension}</span+ class={clsx(+ "bg-button text-black dynadark:text-white rounded",+ thin ? "text-xs px-2 py-0.5" : "text-sm px-2 py-1",+ )}>{extension}</span></div>{/if}diff --git a/src/lib/components/functional/FancyMenu.svelte b/src/lib/components/functional/FancyMenu.svelteindex 91c24cd..4e2e202 100644--- a/src/lib/components/functional/FancyMenu.svelte+++ b/src/lib/components/functional/FancyMenu.svelte@@ -41,10 +41,9 @@{#if activeLinkIndex !== -1}<divclass="absolute pointer-events-none top-1 bg-foreground h-[calc(100%-8px)] rounded-xl"- style="width: {navWidth / linkCount - 8}px; left: {(navWidth /- linkCount) *- activeLinkIndex +- 4}px; transition: {hasLoaded ? duration - 200 : 0}ms ease left;"+ style:width="{navWidth / linkCount - 8}px"+ style:left="{(navWidth / linkCount) * activeLinkIndex + 4}px"+ style:transition="{hasLoaded ? duration - 200 : 0}ms ease left"></div>{/if}{#each links as { name, url } (url)}diff --git a/src/lib/components/functional/FormatDropdown.svelte b/src/lib/components/functional/FormatDropdown.svelteindex 62478e8..efbb8ee 100644--- a/src/lib/components/functional/FormatDropdown.svelte+++ b/src/lib/components/functional/FormatDropdown.svelte@@ -479,8 +479,10 @@bind:this={dropdown}><button- class="relative flex items-center justify-center w-full font-display px-3 py-3.5 bg-button rounded-full overflow-hidden cursor-pointer focus:!outline-none- {disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}"+ class={clsx(+ "relative flex items-center justify-center w-full font-display px-3 py-3.5 bg-button rounded-full overflow-hidden focus:!outline-none",+ disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",+ )}onclick={() => clickDropdown()}{disabled}>@@ -549,9 +551,11 @@<inputtype="text"placeholder={m["convert.dropdown.placeholder"]()}- class="flex-grow w-full !pl-11 !pr-3 rounded-lg bg-panel text-foreground {filteredData.isFallback- ? 'opacity-50 cursor-not-allowed'- : ''}"+ class={clsx(+ "flex-grow w-full !pl-11 !pr-3 rounded-lg bg-panel text-foreground",+ filteredData.isFallback &&+ "opacity-50 cursor-not-allowed",+ )}bind:value={searchQuery}oninput={handleSearch}onkeydown={onEnter}@@ -561,9 +565,10 @@disabled={filteredData.isFallback}/><span- class="absolute left-4 top-1/2 -translate-y-1/2 flex items-center {filteredData.isFallback- ? 'opacity-50'- : ''}"+ class={clsx(+ "absolute left-4 top-1/2 -translate-y-1/2 flex items-center",+ filteredData.isFallback && "opacity-50",+ )}><SearchIcon class="w-4 h-4" /></span>@@ -590,10 +595,12 @@<div class="flex items-center justify-between">{#each filteredData.categories as category (category)}<button- class="flex-grow text-lg hover:text-muted/20 border-b-2 pb-2 capitalize- {currentCategory === category- ? 'text-accent border-b-accent'- : 'border-b-separator text-muted'}"+ class={clsx(+ "flex-grow text-lg hover:text-muted/20 border-b-2 pb-2 capitalize",+ currentCategory === category+ ? "text-accent border-b-accent"+ : "border-b-separator text-muted",+ )}onclick={() => selectCategory(category)}><!-- eslint-disable-next-line @typescript-eslint/no-explicit-any -->@@ -638,12 +645,14 @@{:else}<buttondata-selected={format === selected}- class="w-full p-2 text-center rounded-xl- {format === selected- ? 'bg-accent text-black'- : format === from- ? 'bg-separator'- : 'hover:bg-panel'}"+ class={clsx(+ "w-full p-2 text-center rounded-xl",+ format === selected+ ? "bg-accent text-black"+ : format === from+ ? "bg-separator"+ : "hover:bg-panel",+ )}onclick={() => selectOption(format)}>{format}diff --git a/src/lib/components/functional/popups/Dialog.svelte b/src/lib/components/functional/popups/Dialog.svelteindex 505ac53..f2f5c62 100644--- a/src/lib/components/functional/popups/Dialog.svelte+++ b/src/lib/components/functional/popups/Dialog.svelte@@ -9,6 +9,7 @@} from "@lucide/svelte";import { quintOut } from "svelte/easing";import type { Dialog as DialogType } from "#lib/store/DialogProvider";+ import clsx from "clsx";type Props = DialogType;@@ -74,10 +75,12 @@<div class="flex flex-row items-center justify-between gap-4 w-full">{#each buttons as { text, action }, i (`${i}-${text}`)}<button- class="w-full justify-center hover:scale-105 active:scale-100 duration-200 flex items-center gap-2 p-2 rounded-md {i ===- 1- ? `bg-accent-${color} text-black`- : 'bg-button text-black dynadark:text-white'} px-6"+ class={clsx(+ "w-full justify-center hover:scale-105 active:scale-100 duration-200 flex items-center gap-2 p-2 rounded-md px-6",+ i === 1+ ? `bg-accent-${color} text-black`+ : "bg-button text-black dynadark:text-white",+ )}onclick={() => {action();removeDialog(id);diff --git a/src/lib/components/functional/popups/Modal.svelte b/src/lib/components/functional/popups/Modal.svelteindex 25bdaad..331d0cc 100644--- a/src/lib/components/functional/popups/Modal.svelte+++ b/src/lib/components/functional/popups/Modal.svelte@@ -3,6 +3,7 @@import { duration, fade } from "#lib/util/animation";import type { SearchIcon } from "@lucide/svelte";import { quintOut } from "svelte/easing";+ import clsx from "clsx";export interface ModalButton {text: string;@@ -126,10 +127,12 @@<div class="flex flex-row items-center gap-2 w-full">{#each buttons as { text, action, primary }, i (`${i}-${text}`)}<button- class="hover:scale-105 active:scale-100 duration-200 flex items-center gap-2 p-2 rounded-md {primary ||- i === 1- ? `text-black bg-accent-${color}`- : 'bg-button text-black dynadark:text-white'} px-6"+ class={clsx(+ "hover:scale-105 active:scale-100 duration-200 flex items-center gap-2 p-2 rounded-md px-6",+ primary || i === 1+ ? `text-black bg-accent-${color}`+ : "bg-button text-black dynadark:text-white",+ )}onclick={() => action()}>{text}diff --git a/src/lib/components/functional/popups/SettingsModal.svelte b/src/lib/components/functional/popups/SettingsModal.svelteindex 3b9b2cf..c7aae1c 100644--- a/src/lib/components/functional/popups/SettingsModal.svelte+++ b/src/lib/components/functional/popups/SettingsModal.svelte@@ -7,7 +7,7 @@import { m } from "#lib/paraglide/messages";import type { VertFile } from "#lib/types";import { effects, files } from "#lib/store/index.svelte";- import { converterCategories } from "#lib/converters";+ import { categoryByConverter } from "#lib/converters";import { log, error } from "#lib/util/logger.svelte";import type {ConversionSettings,@@ -65,25 +65,17 @@return available.find((c) => c.name === name) || available[0];};- const converterCategoryByName = new Map(- Object.entries(converterCategories).flatMap(([category, names]) =>- names.map((name) => [name, category] as const),- ),- );-const getFileType = (vertFile: VertFile) => {const converter = vertFile.converters.find(({ name, supportedFormats }) =>- converterCategoryByName.has(name) &&+ categoryByConverter[name] &&supportedFormats.some((format) =>format.name === vertFile.from && format.isNative,),);- return converter- ? converterCategoryByName.get(converter.name)!- : vertFile.from;+ return converter ? categoryByConverter[converter.name] : vertFile.from;};let settings = $state<ConversionSettings>({});diff --git a/src/lib/components/layout/Gradients.svelte b/src/lib/components/layout/Gradients.svelteindex 2c173c7..67d9b58 100644--- a/src/lib/components/layout/Gradients.svelte+++ b/src/lib/components/layout/Gradients.svelte@@ -84,10 +84,10 @@<divclass="fixed top-0 left-0 w-screen h-screen -z-40 pointer-events-none"- style="background-color: {color.color};- mask-image: {maskImage};- -webkit-mask-image: {maskImage};- transition: background-color {duration}ms {transition};"+ style:background-color={color.color}+ style:mask-image={maskImage}+ style:-webkit-mask-image={maskImage}+ style:transition="background-color {duration}ms {transition}"></div>{#if page.url.pathname === "/convert/" && files.files.length === 1}@@ -95,13 +95,13 @@"linear-gradient(to top, transparent 5%, rgba(0, 0, 0, 0.5) 100%)"}<divclass="fixed top-0 left-0 w-screen h-screen -z-50"- style="background-image: url({files.files[0].blobUrl});- background-size: cover;- background-position: center;- background-repeat: no-repeat;- filter: blur(10px);- mask-image: {bgMask};- -webkit-mask-image: {bgMask};"+ style:background-image="url({files.files[0].blobUrl})"+ style:background-size="cover"+ style:background-position="center"+ style:background-repeat="no-repeat"+ style:filter="blur(10px)"+ style:mask-image={bgMask}+ style:-webkit-mask-image={bgMask}transition:fade={{ duration, easing: quintOut }}></div>{/if}diff --git a/src/lib/components/layout/Navbar/Base.svelte b/src/lib/components/layout/Navbar/Base.svelteindex 3a6a920..acf9b47 100644--- a/src/lib/components/layout/Navbar/Base.svelte+++ b/src/lib/components/layout/Navbar/Base.svelte@@ -173,13 +173,14 @@{#if linkRect && isInitialized}<divclass="absolute bg-panel-highlight rounded-xl"- style="width: {linkRect.width}px; height: {linkRect.height}px; top: {linkRect.top -- (containerRect?.top || 0)}px; left: {linkRect.left -- (containerRect?.left || 0)}px; opacity: {isSecretPage- ? 0- : 1}; {$effects- ? `transition: left var(--transition) ${duration}ms, top var(--transition) ${duration}ms, opacity var(--transition) ${duration}ms;`- : ''}"+ style:width="{linkRect.width}px"+ style:height="{linkRect.height}px"+ style:top="{linkRect.top - (containerRect?.top || 0)}px"+ style:left="{linkRect.left - (containerRect?.left || 0)}px"+ style:opacity={isSecretPage ? 0 : 1}+ style:transition={$effects+ ? `left var(--transition) ${duration}ms, top var(--transition) ${duration}ms, opacity var(--transition) ${duration}ms`+ : null}></div>{/if}<adiff --git a/src/lib/components/layout/UploadRegion.svelte b/src/lib/components/layout/UploadRegion.svelteindex f88bb4c..5e9d9ac 100644--- a/src/lib/components/layout/UploadRegion.svelte+++ b/src/lib/components/layout/UploadRegion.svelte@@ -2,13 +2,15 @@import { duration, fade } from "#lib/util/animation";import { dropping, effects } from "#lib/store/index.svelte";import { quintOut } from "svelte/easing";+ import clsx from "clsx";</script>{#if $dropping}<div- class="fixed w-screen h-screen opacity-40 dynadark:opacity-20 z-[100] pointer-events-none blur-2xl {$effects- ? 'dragoverlay'- : 'bg-accent-blue'}"+ class={clsx(+ "fixed w-screen h-screen opacity-40 dynadark:opacity-20 z-[100] pointer-events-none blur-2xl",+ $effects ? "dragoverlay" : "bg-accent-blue",+ )}class:_dragover={dropping && $effects}transition:fade={{duration,diff --git a/src/lib/components/visual/ProgressBar.svelte b/src/lib/components/visual/ProgressBar.svelteindex a437cba..4777d47 100644--- a/src/lib/components/visual/ProgressBar.svelte+++ b/src/lib/components/visual/ProgressBar.svelte@@ -16,9 +16,8 @@<divclass="h-full bg-accent absolute left-0 top-0"class:percentless-animation={progress === null}- style={percent- ? `width: ${percent}%; transition: 500ms linear width;`- : ""}+ style:width={percent ? `${percent}%` : null}+ style:transition={percent ? "500ms linear width" : null}></div></div>diff --git a/src/lib/converters/index.ts b/src/lib/converters/index.tsindex d6ebb6e..b931bb8 100644--- a/src/lib/converters/index.ts+++ b/src/lib/converters/index.ts@@ -29,6 +29,14 @@ export const converterCategories = {doc: ["pandoc"],};+export type ConverterCategory = keyof typeof converterCategories;++export const categoryByConverter = Object.fromEntries(+ Object.entries(converterCategories).flatMap(([category, names]) =>+ names.map((name) => [name, category as ConverterCategory] as const),+ ),+) as Record<string, ConverterCategory>;+export function getConverterByFormat(format: string) {for (const converter of converters) {if (converter.supportedFormats.some((f) => f.name === format)) {diff --git a/src/lib/converters/vertd/vertd.svelte.ts b/src/lib/converters/vertd/vertd.svelte.tsindex a1c6dec..ab16324 100644--- a/src/lib/converters/vertd/vertd.svelte.ts+++ b/src/lib/converters/vertd/vertd.svelte.ts@@ -917,9 +917,7 @@ export class VertdConverter extends Converter {return;}- this.log(- `cancelling conversion for file ${input.name}`,- );+ this.log(`cancelling conversion for file ${input.name}`);const { ws, jobId, token } = activeConversion;diff --git a/src/lib/sections/about/Credits.svelte b/src/lib/sections/about/Credits.svelteindex cf670ba..8be8618 100644--- a/src/lib/sections/about/Credits.svelte+++ b/src/lib/sections/about/Credits.svelte@@ -88,7 +88,7 @@{m["about.credits.notable_description"]()}</p><div class="flex flex-col gap-2">- {#each notableContribs as contrib (contrib.github)}+ {#each notableContribs as contrib (contrib.github)}{@const { name, github, avatar, role } = contrib}{@render contributor(name, github, avatar, role, true)}{/each}@@ -130,7 +130,7 @@{#if ghContribs && ghContribs.length > 0}<div class="flex flex-row flex-wrap gap-2">- {#each ghContribs as contrib (contrib.github)}+ {#each ghContribs as contrib (contrib.github)}{@const { name, github, avatar } = contrib}{@render contributor(name, github, avatar)}{/each}diff --git a/src/lib/sections/about/Donate.svelte b/src/lib/sections/about/Donate.svelteindex 64464ab..459988a 100644--- a/src/lib/sections/about/Donate.svelte+++ b/src/lib/sections/about/Donate.svelte@@ -199,14 +199,13 @@<divclass="flex flex-col gap-3 w-full overflow-visible"- style="height: {paymentState !== 'prepay' ? 0 : 124}px;- transform: scaleY({paymentState !== 'prepay' ? 0 : 1});- opacity: {paymentState !== 'prepay' ? 0 : 1};- filter: blur({paymentState !== 'prepay' ? 4 : 0}px);- transition: height {payDuration}ms {transition},- opacity {payDuration - 200}ms {transition},- transform {payDuration}ms {transition},- filter {payDuration}ms {transition};"+ style:height="{paymentState !== 'prepay' ? 0 : 124}px"+ style:transform="scaleY({paymentState !== 'prepay' ? 0 : 1})"+ style:opacity={paymentState !== "prepay" ? 0 : 1}+ style:filter="blur({paymentState !== 'prepay' ? 4 : 0}px)"+ style:transition="height {payDuration}ms {transition}, opacity {payDuration -+ 200}ms {transition}, transform {payDuration}ms {transition}, filter {payDuration}ms+ {transition}"><div class="flex gap-3 w-full"><button@@ -249,7 +248,7 @@"bg-accent-red text-black": amount === preset,},)}- style={i === 2 ? "grid-column: 3;" : ""}+ style:grid-column={i === 2 ? "3" : null}>${preset} USD</button>diff --git a/src/lib/sections/about/Resources.svelte b/src/lib/sections/about/Resources.svelteindex 9d32e23..e5e1082 100644--- a/src/lib/sections/about/Resources.svelte+++ b/src/lib/sections/about/Resources.svelte@@ -12,6 +12,7 @@MailIcon,MessageCircleMoreIcon,} from "@lucide/svelte";+ import clsx from "clsx";import { m } from "#lib/paraglide/messages";</script>@@ -29,9 +30,10 @@href={DISCORD_URL}target="_blank"rel="noopener noreferrer"- class="btn {$effects- ? ''- : '!scale-100'} flex-1 gap-2 p-4 rounded-full bg-button text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 gap-2 p-4 rounded-full bg-button text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}><MessageCircleMoreIcon size="24" class="inline-block mr-2" />{m["about.resources.discord"]()}@@ -40,9 +42,10 @@href={GITHUB_URL_VERT}target="_blank"rel="noopener noreferrer"- class="btn {$effects- ? ''- : '!scale-100'} flex-1 gap-2 p-4 rounded-full bg-button text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 gap-2 p-4 rounded-full bg-button text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}><CodeXmlIcon size="24" class="inline-block mr-2" />{m["about.resources.source"]()}@@ -51,9 +54,10 @@href="mailto:{CONTACT_EMAIL}"target="_blank"rel="noopener noreferrer"- class="btn {$effects- ? ''- : '!scale-100'} flex-1 gap-2 p-4 rounded-full bg-button text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 gap-2 p-4 rounded-full bg-button text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}><MailIcon size="24" class="inline-block mr-2" />{m["about.resources.email"]()}diff --git a/src/lib/sections/about/Why.svelte b/src/lib/sections/about/Why.svelteindex 8f8c7e3..2b2c3ca 100644--- a/src/lib/sections/about/Why.svelte+++ b/src/lib/sections/about/Why.svelte@@ -15,10 +15,8 @@{m["about.why.title"]()}</h2><p class="text-lg font-normal">- {@html sanitize(link(- ["privacy_link"],- m["about.why.description"](),- ["/privacy"],- ))}+ {@html sanitize(+ link(["privacy_link"], m["about.why.description"](), ["/privacy"]),+ )}</p></Panel>diff --git a/src/lib/sections/settings/Appearance.svelte b/src/lib/sections/settings/Appearance.svelteindex c786f6b..cdfa07e 100644--- a/src/lib/sections/settings/Appearance.svelte+++ b/src/lib/sections/settings/Appearance.svelte@@ -19,6 +19,7 @@import { m } from "#lib/paraglide/messages";import { getLocale } from "#lib/paraglide/runtime";import Dropdown from "#lib/components/functional/Dropdown.svelte";+ import clsx from "clsx";let currentLocale = $state("en");@@ -119,9 +120,10 @@<buttonbind:this={lightElement}onclick={() => setTheme("light")}- class="btn {$effects- ? ''- : '!scale-100'} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}><SunIcon size="24" class="inline-block mr-2" />{m["settings.appearance.light"]()}@@ -130,9 +132,10 @@<buttonbind:this={darkElement}onclick={() => setTheme("dark")}- class="btn {$effects- ? ''- : '!scale-100'} flex-1 p-4 rounded-lg text-black flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black flex items-center justify-center",+ !$effects && "!scale-100",+ )}><MoonIcon size="24" class="inline-block mr-2" />{m["settings.appearance.dark"]()}@@ -154,9 +157,10 @@<buttonbind:this={enableEffectsElement}onclick={() => setEffects(true)}- class="btn {$effects- ? ''- : '!scale-100'} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}><PlayIcon size="24" class="inline-block mr-2" />{m["settings.appearance.enable"]()}@@ -165,9 +169,10 @@<buttonbind:this={disableEffectsElement}onclick={() => setEffects(false)}- class="btn {$effects- ? ''- : '!scale-100'} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}><PauseIcon size="24" class="inline-block mr-2" />{m["settings.appearance.disable"]()}diff --git a/src/lib/sections/settings/Conversion.svelte b/src/lib/sections/settings/Conversion.svelteindex 18b07f0..1f2fe97 100644--- a/src/lib/sections/settings/Conversion.svelte+++ b/src/lib/sections/settings/Conversion.svelte@@ -95,11 +95,12 @@<buttononclick={() =>(settings.useDefaultFormat = true)}- class="btn {$effects- ? ''- : '!scale-100'} {settings.useDefaultFormat- ? 'selected'- : ''} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ settings.useDefaultFormat &&+ "selected",+ )}><PlayIconsize="24"@@ -113,11 +114,12 @@<buttononclick={() =>(settings.useDefaultFormat = false)}- class="btn {$effects- ? ''- : '!scale-100'} {settings.useDefaultFormat- ? ''- : 'selected'} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ !settings.useDefaultFormat &&+ "selected",+ )}><PauseIconsize="24"@@ -211,11 +213,11 @@<buttononclick={() =>(settings.metadata = true)}- class="btn {$effects- ? ''- : '!scale-100'} {settings.metadata- ? 'selected'- : ''} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ settings.metadata && "selected",+ )}><PlayIconsize="24"@@ -229,11 +231,11 @@<buttononclick={() =>(settings.metadata = false)}- class="btn {$effects- ? ''- : '!scale-100'} {settings.metadata- ? ''- : 'selected'} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ !settings.metadata && "selected",+ )}><PauseIconsize="24"diff --git a/src/lib/sections/settings/Privacy.svelte b/src/lib/sections/settings/Privacy.svelteindex 86bec2f..0194dbb 100644--- a/src/lib/sections/settings/Privacy.svelte+++ b/src/lib/sections/settings/Privacy.svelte@@ -19,6 +19,7 @@import { DISABLE_ALL_EXTERNAL_REQUESTS } from "#lib/util/consts";import { addDialog } from "#lib/store/DialogProvider";import { PUB_PLAUSIBLE_URL } from "$app/env/public";+ import clsx from "clsx";const { settings = $bindable() }: { settings: ISettings } = $props();@@ -221,11 +222,11 @@<div class="flex gap-3 w-full"><buttononclick={() => (settings.plausible = true)}- class="btn {$effects- ? ''- : '!scale-100'} {settings.plausible- ? 'selected'- : ''} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ settings.plausible && "selected",+ )}><PlayIcon size="24" class="inline-block mr-2" />{m["settings.privacy.plausible.opt_in"]()}@@ -233,11 +234,11 @@<buttononclick={() => (settings.plausible = false)}- class="btn {$effects- ? ''- : '!scale-100'} {settings.plausible- ? ''- : 'selected'} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ !settings.plausible && "selected",+ )}><PauseIconsize="24"@@ -293,9 +294,10 @@<div class="flex gap-3 w-full"><buttononclick={loadCacheInfo}- class="btn {$effects- ? ''- : '!scale-100'} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}disabled={isLoadingCache || isClearingData}><RefreshCwIcon size="24" class="inline-block mr-2" />@@ -303,9 +305,10 @@</button><buttononclick={clearCache}- class="btn {$effects- ? ''- : '!scale-100'} flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn flex-1 p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}disabled={isLoadingCache || isClearingData}><TrashIcon size="24" class="inline-block mr-2" />@@ -326,9 +329,10 @@<buttononclick={clearAllData}- class="btn {$effects- ? ''- : '!scale-100'} w-full p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center"+ class={clsx(+ "btn w-full p-4 rounded-lg text-black dynadark:text-white flex items-center justify-center",+ !$effects && "!scale-100",+ )}disabled={isClearingData}><TrashIcon size="24" class="inline-block mr-2" />diff --git a/src/lib/sections/settings/Vertd.svelte b/src/lib/sections/settings/Vertd.svelteindex 058e9d8..0ae243f 100644--- a/src/lib/sections/settings/Vertd.svelte+++ b/src/lib/sections/settings/Vertd.svelte@@ -20,8 +20,21 @@let vertdCommit = $state<string | null>(null);let abortController: AbortController | null = null;+ const vertdStatusLabel = $derived.by(() => {+ if (vertdCommit === null) return m["settings.vertd.unavailable"]();+ if (vertdCommit === "loading") return m["settings.vertd.loading"]();+ // legacy commitId passed into message for languages that aren't updated yet (and to avoid "undefined" showing)+ return m["settings.vertd.available"]({ commitId: vertdCommit });+ });+const { settings = $bindable() }: { settings: ISettings } = $props();+ const vertdSizeLimitLabel = $derived.by(() => {+ if (vertdCommit === null) return "N/A";+ const size = formatBytes($vertdSizeLimit);+ return size === "0 B" ? "unlimited" : size;+ });+$effect(() => {if (abortController) abortController.abort();abortController = new AbortController();@@ -78,11 +91,7 @@})}>{m["settings.vertd.status"]()}- {vertdCommit- ? vertdCommit === "loading"- ? m["settings.vertd.loading"]()- : m["settings.vertd.available"]()- : m["settings.vertd.unavailable"]()}+ {vertdStatusLabel}</p><p class="text-sm text-muted font-normal">@@ -170,12 +179,7 @@{/if}<p class="text-sm text-muted font-normal">{m["settings.vertd.info"]({- sizeLimit:- vertdCommit === null- ? "N/A"- : formatBytes($vertdSizeLimit) === "0 B"- ? "unlimited"- : formatBytes($vertdSizeLimit),+ sizeLimit: vertdSizeLimitLabel,commitId: vertdCommit ?? "N/A",})}</p>diff --git a/src/lib/store/index.svelte.ts b/src/lib/store/index.svelte.tsindex 6071326..dc47274 100644--- a/src/lib/store/index.svelte.ts+++ b/src/lib/store/index.svelte.ts@@ -2,6 +2,7 @@ import { browser } from "$app/env";import {byNative,categories,+ categoryByConverter,converterCategories,converters,} from "#lib/converters";@@ -274,14 +275,7 @@ class Files {);const converterName = vf.converters[0].name;- const type =- converterName === "imagemagick"- ? "image"- : converterName === "ffmpeg"- ? "audio"- : converterName === "pandoc"- ? "doc"- : "video";+ const type = categoryByConverter[converterName] ?? "video";this.files.push(vf);this._addThumbnail(vf);diff --git a/src/lib/util/consts.ts b/src/lib/util/consts.tsindex 2ed74ec..c54524d 100644--- a/src/lib/util/consts.ts+++ b/src/lib/util/consts.ts@@ -5,11 +5,10 @@ export const GITHUB_URL_VERTD = "https://github.com/VERT-sh/vertd";export const GITHUB_API_URL = "https://api.github.com/repos/VERT-sh/VERT";export const DISCORD_URL = "https://discord.gg/kqevGxYPak";export const VERT_NAME =- PUB_ENV === "development"- ? "VERT Local"- : PUB_ENV === "nightly"- ? "VERT Nightly"- : "VERT.sh";+ {+ development: "VERT Local",+ nightly: "VERT Nightly",+ }[PUB_ENV as string] ?? "VERT.sh";export const CONTACT_EMAIL = "[email protected]";// i'm not entirely sure this should be in consts.ts, but it is technically a constant as .env is static for VERTdiff --git a/src/routes/+page.svelte b/src/routes/+page.svelteindex 3c6818e..7d408c8 100644--- a/src/routes/+page.svelte+++ b/src/routes/+page.svelte@@ -4,7 +4,13 @@import { converters } from "#lib/converters";import { vertdLoaded } from "#lib/store/index.svelte";import clsx from "clsx";- import { AudioLinesIcon, BookTextIcon, CheckIcon, FilmIcon, ImageIcon } from "@lucide/svelte";+ import {+ AudioLinesIcon,+ BookTextIcon,+ CheckIcon,+ FilmIcon,+ ImageIcon,+ } from "@lucide/svelte";import { m } from "#lib/paraglide/messages";import { OverlayScrollbarsComponent } from "overlayscrollbars-svelte";import { browser } from "$app/env";@@ -75,9 +81,9 @@.filter((f) => f !== "none").join(", ");- const mediabunnyAvailable = converters.find(- (c) => c.name === "mediabunny",- )?.isAvailable();+ const mediabunnyAvailable = converters+ .find((c) => c.name === "mediabunny")+ ?.isAvailable();const vertdReady = $vertdLoaded === true;const videoStatus =vertdReady && mediabunnyAvailablediff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelteindex 04e0397..b3c7830 100644--- a/src/routes/convert/+page.svelte+++ b/src/routes/convert/+page.svelte@@ -7,8 +7,10 @@import Tooltip from "#lib/components/visual/Tooltip.svelte";import {categories,+ categoryByConverter,converterCategories,converters,+ type ConverterCategory,} from "#lib/converters";import {effects,@@ -42,6 +44,20 @@import { vertdSizeLimit } from "#lib/sections/settings/vertdSettings.svelte";import clsx from "clsx";+ const gradientColors: Record<ConverterCategory, string> = {+ image: "blue",+ audio: "purple",+ video: "red",+ doc: "green",+ };++ const gradientVars: Record<ConverterCategory, string> = {+ audio: "--bg-gradient-purple-alt",+ video: "--bg-gradient-red-alt",+ doc: "--bg-gradient-green-alt",+ image: "--bg-gradient-blue-alt",+ };+let processedFileIds = $state(new Set<string>());$effect(() => {@@ -111,16 +127,7 @@const converter = getCurrentConverter(file);if (!converter) return;- let category: string | undefined;- const isImage = converterCategories.image.includes(converter.name);- const isAudio = converterCategories.audio.includes(converter.name);- const isVideo = converterCategories.video.includes(converter.name);- const isDocument = converterCategories.doc.includes(converter.name);-- if (isImage) category = "image";- else if (isAudio) category = "audio";- else if (isVideo) category = "video";- else if (isDocument) category = "doc";+ const category = categoryByConverter[converter.name];if (!category) return;let targetFormat: string | undefined;@@ -173,22 +180,11 @@// Set gradient color depending on the file typesconst fileTypes = files.files.map((file) => {- const converterName = getCurrentConverter(file)?.name;- if (!converterName) return null;- if (converterCategories.image.includes(converterName))- return "blue";- if (converterCategories.audio.includes(converterName))- return "purple";- if (converterCategories.video.includes(converterName))- return "red";- if (converterCategories.doc.includes(converterName))- return "green";- return null;+ const category =+ categoryByConverter[getCurrentConverter(file)?.name ?? ""];+ return category ? gradientColors[category] : null;})- .filter(- (type): type is "blue" | "purple" | "red" | "green" =>- type !== null,- );+ .filter((type): type is string => type !== null);const uniqueTypes = new Set(fileTypes);const type =@@ -208,6 +204,7 @@{#snippet fileItem(file: VertFile)}{@const currentConverter = getCurrentConverter(file)}{@const name = currentConverter?.name || "unknown"}+ {@const category = categoryByConverter[name]}{@const isAudio = converterCategories.audio.includes(name)}{@const isVideo = converterCategories.video.includes(name)}{@const isDocument = converterCategories.doc.includes(name)}@@ -395,13 +392,9 @@{:else}<divclass="w-full h-full flex items-center justify-center text-black"- style="background: var({isAudio- ? '--bg-gradient-purple-alt'- : isVideo- ? '--bg-gradient-red-alt'- : isDocument- ? '--bg-gradient-green-alt'- : '--bg-gradient-blue-alt'})"+ style:background="var({category+ ? gradientVars[category]+ : gradientVars.image})">{#if isAudio}<FileMusicIcon size="56" />@@ -438,15 +431,17 @@position="bottom"><button- class="btn {$effects- ? ''- : '!scale-100'} p-0 w-14 h-14 text-black {isAudio- ? 'bg-accent-purple'- : isVideo- ? 'bg-accent-red'- : isDocument- ? 'bg-accent-green'- : 'bg-accent-blue'}"+ class={clsx(+ "btn p-0 w-14 h-14 text-black",+ !$effects && "!scale-100",+ isAudio+ ? "bg-accent-purple"+ : isVideo+ ? "bg-accent-red"+ : isDocument+ ? "bg-accent-green"+ : "bg-accent-blue",+ )}disabled={!files.isReady(file)}onclick={() => file.convert()}>@@ -458,9 +453,10 @@position="bottom"><button- class="btn {$effects- ? ''- : '!scale-100'} p-0 w-14 h-14"+ class={clsx(+ "btn p-0 w-14 h-14",+ !$effects && "!scale-100",+ )}onclick={file.download}disabled={!file.result}>diff --git a/src/routes/debug/+page.svelte b/src/routes/debug/+page.svelteindex 52b938f..720c783 100644--- a/src/routes/debug/+page.svelte+++ b/src/routes/debug/+page.svelte@@ -404,7 +404,7 @@><divclass="h-full bg-accent-blue transition-all"- style="width: {quotaPercent}%"+ style:width="{quotaPercent}%"></div></div><span class="text-xs text-muted">