chore: prettier format

This commit is contained in:
Maya 2025-09-10 10:38:14 +03:00
parent 2dafc0f730
commit 1710cd038e
No known key found for this signature in database
24 changed files with 130 additions and 102 deletions

View File

@ -1,5 +1,7 @@
{ {
"useTabs": true, "useTabs": true,
"tabWidth": 4, "tabWidth": 4,
"singleQuote": false "singleQuote": false,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
} }

View File

@ -4,12 +4,18 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> <link rel="icon" href="%sveltekit.assets%/favicon.png" />
<link rel="apple-touch-icon" href="%sveltekit.assets%/favicon.png"> <link rel="apple-touch-icon" href="%sveltekit.assets%/favicon.png" />
<link rel="apple-touch-startup-image" href="%sveltekit.assets%/lettermark.jpg"> <link
<meta name="mobile-web-app-capable" content="yes"> rel="apple-touch-startup-image"
<meta name="apple-mobile-web-app-capable" content="yes"> href="%sveltekit.assets%/lettermark.jpg"
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta
name="apple-mobile-web-app-status-bar-style"
content="black-translucent"
/>
%sveltekit.head% %sveltekit.head%
<script> <script>
@ -34,8 +40,8 @@
// Lock dark reader if it's set to dark mode // Lock dark reader if it's set to dark mode
if (theme === "dark") { if (theme === "dark") {
const lock = document.createElement('meta'); const lock = document.createElement("meta");
lock.name = 'darkreader-lock'; lock.name = "darkreader-lock";
document.head.appendChild(lock); document.head.appendChild(lock);
} }
})(); })();

View File

@ -1,15 +1,18 @@
import type { Handle } from '@sveltejs/kit'; import type { Handle } from "@sveltejs/kit";
import { paraglideMiddleware } from '$lib/paraglide/server'; import { paraglideMiddleware } from "$lib/paraglide/server";
// creating a handle to use the paraglide middleware // creating a handle to use the paraglide middleware
const paraglideHandle: Handle = ({ event, resolve }) => const paraglideHandle: Handle = ({ event, resolve }) =>
paraglideMiddleware(event.request, ({ request: localizedRequest, locale }) => { paraglideMiddleware(
event.request = localizedRequest; event.request,
return resolve(event, { ({ request: localizedRequest, locale }) => {
transformPageChunk: ({ html }) => { event.request = localizedRequest;
return html.replace('%lang%', locale); return resolve(event, {
} transformPageChunk: ({ html }) => {
}); return html.replace("%lang%", locale);
}); },
});
},
);
export const handle: Handle = paraglideHandle; export const handle: Handle = paraglideHandle;

View File

@ -1,6 +1,6 @@
import type { Reroute } from '@sveltejs/kit'; import type { Reroute } from "@sveltejs/kit";
import { deLocalizeUrl } from '$lib/paraglide/runtime'; import { deLocalizeUrl } from "$lib/paraglide/runtime";
export const reroute: Reroute = (request) => { export const reroute: Reroute = (request) => {
return deLocalizeUrl(request.url).pathname; return deLocalizeUrl(request.url).pathname;
}; };

View File

@ -102,7 +102,7 @@
{m["upload.uploader.text"]({ {m["upload.uploader.text"]({
action: jpegify action: jpegify
? m["upload.uploader.jpegify"]() ? m["upload.uploader.jpegify"]()
: m["upload.uploader.convert"]() : m["upload.uploader.convert"](),
})} })}
</h2> </h2>
</Panel> </Panel>

View File

@ -15,21 +15,21 @@
</script> </script>
{#if dialogList.length > 0} {#if dialogList.length > 0}
<div <div
class="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm z-40" class="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm z-40"
in:fade={{ in:fade={{
duration, duration,
easing: quintOut, easing: quintOut,
}} }}
out:fade={{ out:fade={{
duration, duration,
easing: quintOut, easing: quintOut,
}} }}
> >
{#each dialogList as { id, title, message, buttons, type }, i} {#each dialogList as { id, title, message, buttons, type }, i}
{#if i === 0} {#if i === 0}
<Dialog {id} {title} {message} {buttons} {type} /> <Dialog {id} {title} {message} {buttons} {type} />
{/if} {/if}
{/each} {/each}
</div> </div>
{/if} {/if}

View File

@ -3,16 +3,16 @@
</script> </script>
<div class="flex md:hidden justify-center items-center pb-8 pt-4"> <div class="flex md:hidden justify-center items-center pb-8 pt-4">
<a <a
class="flex items-center justify-center bg-panel p-2 rounded-[20px] shadow-panel" class="flex items-center justify-center bg-panel p-2 rounded-[20px] shadow-panel"
href="/" href="/"
> >
<div <div
class="h-14 bg-accent rounded-[14px] flex items-center justify-center" class="h-14 bg-accent rounded-[14px] flex items-center justify-center"
> >
<div class="w-28 h-5"> <div class="w-28 h-5">
<Logo /> <Logo />
</div> </div>
</div> </div>
</a> </a>
</div> </div>

View File

@ -3,5 +3,5 @@
</script> </script>
<div class="hidden md:flex p-8 w-screen justify-center"> <div class="hidden md:flex p-8 w-screen justify-center">
<Navbar /> <Navbar />
</div> </div>

View File

@ -1,2 +1,2 @@
export { default as Desktop } from "./Desktop.svelte"; export { default as Desktop } from "./Desktop.svelte";
export { default as Mobile } from "./Mobile.svelte"; export { default as Mobile } from "./Mobile.svelte";

View File

@ -5,7 +5,7 @@
import { quintOut } from "svelte/easing"; import { quintOut } from "svelte/easing";
import { fly, fade } from "$lib/animation"; import { fly, fade } from "$lib/animation";
let { children } = $props(); let { children } = $props();
</script> </script>
<div class="grid grid-rows-1 grid-cols-1 h-full flex-grow"> <div class="grid grid-rows-1 grid-cols-1 h-full flex-grow">

View File

@ -1,7 +1,7 @@
export { default as UploadRegion } from './UploadRegion.svelte'; export { default as UploadRegion } from "./UploadRegion.svelte";
export { default as Gradients } from './Gradients.svelte'; export { default as Gradients } from "./Gradients.svelte";
export { default as Toasts } from './Toasts.svelte'; export { default as Toasts } from "./Toasts.svelte";
export { default as Dialogs } from './Dialogs.svelte'; export { default as Dialogs } from "./Dialogs.svelte";
export { default as PageContent } from './PageContent.svelte'; export { default as PageContent } from "./PageContent.svelte";
export { default as MobileLogo } from './MobileLogo.svelte'; export { default as MobileLogo } from "./MobileLogo.svelte";
export { default as Footer } from './Footer.svelte'; export { default as Footer } from "./Footer.svelte";

View File

@ -48,7 +48,6 @@ categories.doc.formats =
?.supportedFormats.filter((f) => f.toSupported && f.isNative) ?.supportedFormats.filter((f) => f.toSupported && f.isNative)
.map((f) => f.name) || []; .map((f) => f.name) || [];
export const byNative = (format: string) => { export const byNative = (format: string) => {
return (a: Converter, b: Converter) => { return (a: Converter, b: Converter) => {
const aFormat = a.supportedFormats.find((f) => f.name === format); const aFormat = a.supportedFormats.find((f) => f.name === format);

View File

@ -86,7 +86,7 @@ export class MagickConverter extends Converter {
super(); super();
log(["converters", this.name], `created converter`); log(["converters", this.name], `created converter`);
if (!browser) return; if (!browser) return;
this.status = "downloading"; this.status = "downloading";
log(["converters", this.name], `loading worker @ ${MagickWorker}`); log(["converters", this.name], `loading worker @ ${MagickWorker}`);
@ -114,7 +114,10 @@ export class MagickConverter extends Converter {
let compression: number | undefined = args.at(0); let compression: number | undefined = args.at(0);
if (!compression) { if (!compression) {
compression = Settings.instance.settings.magickQuality ?? 100; compression = Settings.instance.settings.magickQuality ?? 100;
log(["converters", this.name], `using user setting for quality: ${compression}%`); log(
["converters", this.name],
`using user setting for quality: ${compression}%`,
);
} }
log(["converters", this.name], `converting ${input.name} to ${to}`); log(["converters", this.name], `converting ${input.name} to ${to}`);
@ -138,7 +141,8 @@ export class MagickConverter extends Converter {
} }
// every other format handled by magick worker // every other format handled by magick worker
const keepMetadata: boolean = Settings.instance.settings.metadata ?? true; const keepMetadata: boolean =
Settings.instance.settings.metadata ?? true;
log(["converters", this.name], `keep metadata: ${keepMetadata}`); log(["converters", this.name], `keep metadata: ${keepMetadata}`);
const msg = { const msg = {
type: "convert", type: "convert",

View File

@ -264,7 +264,7 @@ export class VertdConverter extends Converter {
token: uploadRes.auth, token: uploadRes.auth,
to, to,
speed, speed,
keepMetadata keepMetadata,
}, },
}; };
ws.send(JSON.stringify(msg)); ws.send(JSON.stringify(msg));

View File

@ -59,4 +59,4 @@ export const error = (prefix: string | string[], ...args: any[]) => {
), ),
...args, ...args,
); );
} };

View File

@ -102,7 +102,10 @@
m["about.credits.github_description"](), m["about.credits.github_description"](),
["/jpegify", GITHUB_URL_VERT], ["/jpegify", GITHUB_URL_VERT],
[false, true], [false, true],
["text-black dynadark:text-white", "text-blue-500 font-normal hover:underline"] [
"text-black dynadark:text-white",
"text-blue-500 font-normal hover:underline",
],
)} )}
</p> </p>
{:else} {:else}

View File

@ -67,10 +67,7 @@
if (!res.ok) { if (!res.ok) {
paymentState = "prepay"; paymentState = "prepay";
addToast( addToast("error", m["about.donate.payment_error"]());
"error",
m["about.donate.payment_error"](),
);
return; return;
} }
@ -102,9 +99,9 @@
const period = submitResult.error.message?.endsWith(".") ? "" : "."; const period = submitResult.error.message?.endsWith(".") ? "" : ".";
addToast( addToast(
"error", "error",
m["about.donate.payment_failed"]({ m["about.donate.payment_failed"]({
message: submitResult.error.message || "", message: submitResult.error.message || "",
period period,
}), }),
); );
enablePay = true; enablePay = true;
@ -124,9 +121,9 @@
const period = res.error.message?.endsWith(".") ? "" : "."; const period = res.error.message?.endsWith(".") ? "" : ".";
addToast( addToast(
"error", "error",
m["about.donate.payment_failed"]({ m["about.donate.payment_failed"]({
message: res.error.message || "", message: res.error.message || "",
period period,
}), }),
); );
} else { } else {
@ -152,10 +149,7 @@
addToast("success", m["about.donate.thank_you"]()); addToast("success", m["about.donate.thank_you"]());
break; break;
default: default:
addToast( addToast("error", m["about.donate.donation_error"]());
"error",
m["about.donate.donation_error"](),
);
} }
goto("/about"); goto("/about");
@ -298,7 +292,9 @@
class="btn w-full h-12 bg-accent-red text-black rounded-full mt-4" class="btn w-full h-12 bg-accent-red text-black rounded-full mt-4"
onclick={donate} onclick={donate}
> >
{m["about.donate.donate_amount"]({ amount: amount.toFixed(2) })} {m["about.donate.donate_amount"]({
amount: amount.toFixed(2),
})}
</button> </button>
</div> </div>
</div> </div>

View File

@ -82,13 +82,16 @@
</button> </button>
</div> </div>
</div> </div>
<div class="grid gap-3 grid-cols-2 md:grid-cols-4" class:opacity-50={!settings.useDefaultFormat}> <div
class="grid gap-3 grid-cols-2 md:grid-cols-4"
class:opacity-50={!settings.useDefaultFormat}
>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<p class="text-sm font-bold"> <p class="text-sm font-bold">
{m["settings.conversion.default_format_image"]()} {m["settings.conversion.default_format_image"]()}
</p> </p>
<FormatDropdown <FormatDropdown
categories={{image: categories.image}} categories={{ image: categories.image }}
from={".png"} from={".png"}
bind:selected={settings.defaultFormat.image} bind:selected={settings.defaultFormat.image}
disabled={!settings.useDefaultFormat} disabled={!settings.useDefaultFormat}
@ -99,7 +102,7 @@
{m["settings.conversion.default_format_audio"]()} {m["settings.conversion.default_format_audio"]()}
</p> </p>
<FormatDropdown <FormatDropdown
categories={{audio: categories.audio}} categories={{ audio: categories.audio }}
from={".mp3"} from={".mp3"}
bind:selected={settings.defaultFormat.audio} bind:selected={settings.defaultFormat.audio}
disabled={!settings.useDefaultFormat} disabled={!settings.useDefaultFormat}
@ -110,7 +113,7 @@
{m["settings.conversion.default_format_video"]()} {m["settings.conversion.default_format_video"]()}
</p> </p>
<FormatDropdown <FormatDropdown
categories={{video: categories.video}} categories={{ video: categories.video }}
from={".mp4"} from={".mp4"}
bind:selected={settings.defaultFormat.video} bind:selected={settings.defaultFormat.video}
disabled={!settings.useDefaultFormat} disabled={!settings.useDefaultFormat}
@ -121,7 +124,7 @@
{m["settings.conversion.default_format_document"]()} {m["settings.conversion.default_format_document"]()}
</p> </p>
<FormatDropdown <FormatDropdown
categories={{doc: categories.doc}} categories={{ doc: categories.doc }}
from={".docx"} from={".docx"}
bind:selected={settings.defaultFormat.document} bind:selected={settings.defaultFormat.document}
disabled={!settings.useDefaultFormat} disabled={!settings.useDefaultFormat}

View File

@ -45,7 +45,7 @@
vertdCommit = null; vertdCommit = null;
vertdLoaded.set(false); vertdLoaded.set(false);
// const converter = converters.find((c) => c.name === "vertd"); // const converter = converters.find((c) => c.name === "vertd");
// if (converter) converter.status = "not-ready"; // if (converter) converter.status = "not-ready";
} }
return () => { return () => {
@ -71,7 +71,8 @@
"!text-muted": vertdCommit === "loading", "!text-muted": vertdCommit === "loading",
})} })}
> >
{m["settings.vertd.status"]()} {vertdCommit {m["settings.vertd.status"]()}
{vertdCommit
? vertdCommit === "loading" ? vertdCommit === "loading"
? m["settings.vertd.loading"]() ? m["settings.vertd.loading"]()
: m["settings.vertd.available"]({ commitId: vertdCommit }) : m["settings.vertd.available"]({ commitId: vertdCommit })
@ -83,10 +84,16 @@
{@html m["settings.vertd.description"]()} {@html m["settings.vertd.description"]()}
</p> </p>
<p class="text-sm text-muted font-normal"> <p class="text-sm text-muted font-normal">
{@html link("vertd_link", m["settings.vertd.hosting_info"](), GITHUB_URL_VERTD)} {@html link(
"vertd_link",
m["settings.vertd.hosting_info"](),
GITHUB_URL_VERTD,
)}
</p> </p>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<p class="text-base font-bold">{m["settings.vertd.instance_url"]()}</p> <p class="text-base font-bold">
{m["settings.vertd.instance_url"]()}
</p>
<input <input
type="text" type="text"
placeholder={m["settings.vertd.url_placeholder"]()} placeholder={m["settings.vertd.url_placeholder"]()}
@ -95,7 +102,9 @@
</div> </div>
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<p class="text-base font-bold">{m["settings.vertd.conversion_speed"]()}</p> <p class="text-base font-bold">
{m["settings.vertd.conversion_speed"]()}
</p>
<p class="text-sm text-muted font-normal"> <p class="text-sm text-muted font-normal">
{m["settings.vertd.speed_description"]()} {m["settings.vertd.speed_description"]()}
</p> </p>
@ -113,7 +122,9 @@
selected={(() => { selected={(() => {
switch (settings.vertdSpeed) { switch (settings.vertdSpeed) {
case "verySlow": case "verySlow":
return m["settings.vertd.speeds.very_slow"](); return m[
"settings.vertd.speeds.very_slow"
]();
case "slower": case "slower":
return m["settings.vertd.speeds.slower"](); return m["settings.vertd.speeds.slower"]();
case "slow": case "slow":
@ -123,7 +134,9 @@
case "fast": case "fast":
return m["settings.vertd.speeds.fast"](); return m["settings.vertd.speeds.fast"]();
case "ultraFast": case "ultraFast":
return m["settings.vertd.speeds.ultra_fast"](); return m[
"settings.vertd.speeds.ultra_fast"
]();
} }
})()} })()}
onselect={(selected) => { onselect={(selected) => {

View File

@ -34,7 +34,7 @@ function addDialog(
}; };
dialogs.update((currentDialogs) => [...currentDialogs, newDialog]); dialogs.update((currentDialogs) => [...currentDialogs, newDialog]);
return id; return id;
} }
function removeDialog(id: number) { function removeDialog(id: number) {

View File

@ -1,3 +1,3 @@
export * from "./file.svelte"; export * from "./file.svelte";
export * from "./util"; export * from "./util";
export * from "./conversion-worker"; export * from "./conversion-worker";

View File

@ -57,8 +57,7 @@
formats: getSupportedFormats("vertd"), formats: getSupportedFormats("vertd"),
icon: Film, icon: Film,
title: m["upload.cards.video"](), title: m["upload.cards.video"](),
status: status: $vertdLoaded === true ? "ready" : "not-ready", // not using converter.status for this
$vertdLoaded === true ? "ready" : "not-ready", // not using converter.status for this
}, },
}); });

View File

@ -90,7 +90,7 @@
const excludedNames = new Set([ const excludedNames = new Set([
...mainContribs.map((c) => c.github.split("/").pop()), ...mainContribs.map((c) => c.github.split("/").pop()),
...notableContribs.map((c) => c.github.split("/").pop()), ...notableContribs.map((c) => c.github.split("/").pop()),
"Z2r-YT" "Z2r-YT",
]); ]);
const filteredContribs = allContribs.filter( const filteredContribs = allContribs.filter(

View File

@ -271,7 +271,7 @@
})} })}
</p> </p>
</div> </div>
{:else if (isVideo && $vertdLoaded) && (!isAudio && !isImage && !isDocument)} {:else if isVideo && $vertdLoaded && !isAudio && !isImage && !isDocument}
<div <div
class="h-full flex flex-col text-center justify-center text-failure" class="h-full flex flex-col text-center justify-center text-failure"
> >