refactor: run prettier

This commit is contained in:
Maya 2026-05-25 21:29:28 +03:00
parent 35949a6d04
commit c139eae565
No known key found for this signature in database
24 changed files with 583 additions and 524 deletions

View File

@ -58,7 +58,8 @@
if (!file) return;
file.conversionSettings.imageSequence = imageSequence;
file.conversionSettings.imageSequenceFPS = imageSequenceFPS;
file.conversionSettings.imageSequenceTransparency = imageSequenceTransparency;
file.conversionSettings.imageSequenceTransparency =
imageSequenceTransparency;
});
const normalize = (str: string) => str.replace(/^\./, "").toLowerCase();

View File

@ -75,7 +75,7 @@
</div>
<h2 class="text-center text-2xl font-semibold mt-4">
{m["upload.uploader.text"]({
action: m["upload.uploader.convert"]()
action: m["upload.uploader.convert"](),
})}
</h2>
</Panel>

View File

@ -19,8 +19,8 @@
<div class="flex flex-col gap-4">
<p class="text-black">
{m["convert.external_warning.text"]({
filename: toast.additional.filename,
})}
filename: toast.additional.filename,
})}
</p>
<div class="flex flex-col gap-2">
<button

View File

@ -38,40 +38,50 @@
<p>{@html sanitize(m["convert.errors.vertd.details.body"]())}</p>
<p>
<span class="text-black dynadark:text-white">
{@html sanitize(m["convert.errors.vertd.details.job_id"]({
jobId: additional.jobId,
}))}
{@html sanitize(
m["convert.errors.vertd.details.job_id"]({
jobId: additional.jobId,
}),
)}
</span>
</p>
<p>
<span class="text-black dynadark:text-white">
{@html sanitize(m["convert.errors.vertd.details.from"]({
from: additional.from,
}))}
{@html sanitize(
m["convert.errors.vertd.details.from"]({
from: additional.from,
}),
)}
</span>
</p>
<p>
<span class="text-black dynadark:text-white">
{@html sanitize(m["convert.errors.vertd.details.to"]({ to: additional.to }))}
{@html sanitize(
m["convert.errors.vertd.details.to"]({ to: additional.to }),
)}
</span>
</p>
<p>
<span class="text-black dynadark:text-white">
{@html sanitize(link(
["view_link"],
m["convert.errors.vertd.details.error_message"](),
[errorBlobUrl || "#"],
{@html sanitize(
link(
["view_link"],
m["convert.errors.vertd.details.error_message"](),
[errorBlobUrl || "#"],
[true],
["text-blue-500 font-normal"],
),
)}
</span>
</p>
<p>
{@html sanitize(
link(
["privacy_link"],
m["convert.errors.vertd.details.footer"](),
"/privacy",
[true],
["text-blue-500 font-normal"],
))}
</span>
</p>
<p>
{@html sanitize(link(
["privacy_link"],
m["convert.errors.vertd.details.footer"](),
"/privacy",
[true],
))}
),
)}
</p>
</div>

View File

@ -37,10 +37,7 @@
{m["footer.discord_server"]()}
</a>
<p></p>
<a
class="hover:underline font-normal"
href="/privacy/"
>
<a class="hover:underline font-normal" href="/privacy/">
{m["footer.privacy_policy"]()}
</a>
{#if commitHash}

View File

@ -6,7 +6,12 @@ import type {
SettingDefinition,
} from "$lib/types/conversion-settings";
export type WorkerStatus = "not-ready" | "downloading" | "ready" | "partially-ready" | "error";
export type WorkerStatus =
| "not-ready"
| "downloading"
| "ready"
| "partially-ready"
| "error";
export class FormatInfo {
public name: string;
@ -56,7 +61,9 @@ export class Converter {
* Can be overridden per converter for format-specific settings.
* @param input The input file.
*/
public async getAvailableSettings(input?: VertFile): Promise<SettingDefinition[]> {
public async getAvailableSettings(
input?: VertFile,
): Promise<SettingDefinition[]> {
return [];
}
@ -64,7 +71,9 @@ export class Converter {
* Get default settings for a conversion.
* @param input The input file.
*/
public async getDefaultSettings(input?: VertFile): Promise<ConversionSettings> {
public async getDefaultSettings(
input?: VertFile,
): Promise<ConversionSettings> {
const defaults: ConversionSettings = {};
const settings = await this.getAvailableSettings(input);
settings.forEach((setting) => {

View File

@ -1,4 +1,7 @@
import { toArgs, animatedImageFormats } from "$lib/converters/ffmpeg/ffmpeg.codecs";
import {
toArgs,
animatedImageFormats,
} from "$lib/converters/ffmpeg/ffmpeg.codecs";
import type { ConversionSettings } from "$lib/types/conversion-settings";
import { videoFormats } from "../vertd/vertd.svelte";

View File

@ -27,7 +27,7 @@ export const converterCategories = {
video: ["mediabunny", "vertd"],
audio: ["ffmpeg"],
doc: ["pandoc"],
}
};
export function getConverterByFormat(format: string) {
for (const converter of converters) {

View File

@ -1,6 +1,10 @@
<script lang="ts">
import Panel from "$lib/components/visual/Panel.svelte";
import { CONTACT_EMAIL, DISCORD_URL, GITHUB_URL_VERT } from "$lib/util/consts";
import {
CONTACT_EMAIL,
DISCORD_URL,
GITHUB_URL_VERT,
} from "$lib/util/consts";
import { effects } from "$lib/store/index.svelte";
import {
GithubIcon,

View File

@ -48,12 +48,14 @@
</a>
</div>
<p class="text-muted">
{@html sanitize(link(
"discord_link",
m["about.sponsors.description"](),
DISCORD_URL,
true
))}
{@html sanitize(
link(
"discord_link",
m["about.sponsors.description"](),
DISCORD_URL,
true,
),
)}
<span class="inline-block mx-[2px] relative top-[2px]">
<button
id="email"

View File

@ -179,7 +179,8 @@
<div class="flex flex-col gap-2">
<p class="text-base font-bold">
{m["settings.appearance.language.title"]()}
{#if currentLocale !== "en"} (Language){/if}
{#if currentLocale !== "en"}
(Language){/if}
</p>
<p class="text-sm text-muted font-normal italic">
{m["settings.appearance.language.description"]()}

View File

@ -40,11 +40,11 @@
<div class="flex flex-col gap-4">
<div class="flex flex-col gap-2">
<p class="text-base font-bold">
{m["settings.conversion.filename.format"]()}
{m["settings.conversion.filename.format"]()}
</p>
<p class="text-sm text-muted font-normal">
{@html sanitize(
m["settings.conversion.filename.description"](),
m["settings.conversion.filename.description"](),
)}
</p>
</div>
@ -87,7 +87,9 @@
<div class="flex flex-col gap-4">
<div class="flex flex-col gap-2">
<p class="text-base font-bold">
{m["settings.conversion.default_format.label"]()}
{m[
"settings.conversion.default_format.label"
]()}
</p>
<p class="text-sm text-muted font-normal">
{m[
@ -226,7 +228,9 @@
size="24"
class="inline-block mr-2"
/>
{m["settings.conversion.metadata.keep"]()}
{m[
"settings.conversion.metadata.keep"
]()}
</button>
<button
@ -242,7 +246,9 @@
size="24"
class="inline-block mr-2"
/>
{m["settings.conversion.metadata.remove"]()}
{m[
"settings.conversion.metadata.remove"
]()}
</button>
</div>
</div>

View File

@ -76,7 +76,9 @@
m["settings.privacy.site_data.clear_all_data_confirm"](),
[
{
text: m["settings.privacy.site_data.clear_all_data_cancel"](),
text: m[
"settings.privacy.site_data.clear_all_data_cancel"
](),
action: () => {},
},
{
@ -95,7 +97,9 @@
ToastManager.add({
type: "success",
message:
m["settings.privacy.site_data.all_data_cleared"](),
m[
"settings.privacy.site_data.all_data_cleared"
](),
});
} catch (err) {
error(

View File

@ -11,11 +11,11 @@ export interface SettingDefinition {
min?: number;
max?: number;
step?: number;
options?: Array<{ value: any; label: any; }>; // for select/range types
options?: Array<{ value: any; label: any }>; // for select/range types
description?: string;
hasCustomInput?: boolean; // for select types with a "custom" option
customInputKey?: string; // key to use for custom input value in settings object
forceFullWidth?: boolean; // force setting to take up full width (usually grid 2)
forceFullWidth?: boolean; // force setting to take up full width (usually grid 2)
}
export interface ConversionSettings {

View File

@ -2,12 +2,14 @@ import { VertFile } from "./file.svelte";
interface ConvertMessage {
type: "convert";
input: {
file: File;
name: string;
from: string;
to: string;
} | VertFile;
input:
| {
file: File;
name: string;
from: string;
to: string;
}
| VertFile;
to: string;
conversionSettings: string; // JSON stringified ConversionSettings
}

View File

@ -1,7 +1,9 @@
import { browser } from "$app/environment";
import { error } from "$lib/util/logger";
export function readSettings<T extends object = Record<string, unknown>>(): Partial<T> {
export function readSettings<
T extends object = Record<string, unknown>,
>(): Partial<T> {
if (!browser) return {};
const raw = localStorage.getItem("settings");

View File

@ -279,7 +279,10 @@ const pandocToFiles = (entries: PandocEntries, parent = ""): File[] => {
const nestedFiles = pandocToFiles(entry.entries, fullPath);
flattened.push(...nestedFiles);
} else {
const file = new File([new Uint8Array(Array.from(entry.data))], fullPath);
const file = new File(
[new Uint8Array(Array.from(entry.data))],
fullPath,
);
flattened.push(file);
}
}

View File

@ -3,7 +3,10 @@
import { goto, beforeNavigate, afterNavigate } from "$app/navigation";
import { PUB_PLAUSIBLE_URL, PUB_HOSTNAME } from "$env/static/public";
import { DISABLE_ALL_EXTERNAL_REQUESTS, VERT_NAME } from "$lib/util/consts.js";
import {
DISABLE_ALL_EXTERNAL_REQUESTS,
VERT_NAME,
} from "$lib/util/consts.js";
import * as Layout from "$lib/components/layout";
import * as Navbar from "$lib/components/layout/Navbar";
import { Settings } from "$lib/sections/settings/index.svelte";
@ -96,7 +99,10 @@
// detect if insecure context
if (!window.isSecureContext) {
log(["layout"], "Insecure context (HTTP) detected, some features may not work as expected -- you may want to enable \"PUB_DISABLE_FAILURE_BLOCKS\" on local deployments.");
log(
["layout"],
'Insecure context (HTTP) detected, some features may not work as expected -- you may want to enable "PUB_DISABLE_FAILURE_BLOCKS" on local deployments.',
);
ToastManager.add({
type: "warning",
message: m["toast.insecure_context"](),
@ -155,7 +161,10 @@
property="twitter:description"
content="With VERT, you can quickly convert any image, video, audio, and document file. No ads, no tracking, open source, and all processing is done on your device."
/>
<meta property="twitter:image" content="https://vert.sh/VERT_Feature.webp" />
<meta
property="twitter:image"
content="https://vert.sh/VERT_Feature.webp"
/>
<link rel="manifest" href="/manifest.json" />
<link rel="canonical" href="https://vert.sh/" />
{#if enablePlausible}

View File

@ -37,7 +37,10 @@
link(
["about_link", "stripe_link"],
m["privacy.donations.description"](),
["/about", "https://stripe.com/docs/disputes/prevention/advanced-fraud-detection"],
[
"/about",
"https://stripe.com/docs/disputes/prevention/advanced-fraud-detection",
],
[false, true],
),
)}

View File

@ -26,7 +26,10 @@
}
const parsedSettings = readSavedSettings();
if (parsedSettings && JSON.stringify(parsedSettings) === JSON.stringify(settings))
if (
parsedSettings &&
JSON.stringify(parsedSettings) === JSON.stringify(settings)
)
return;
try {