mirror of https://github.com/VERT-sh/VERT.git
refactor: run prettier
This commit is contained in:
parent
35949a6d04
commit
c139eae565
|
|
@ -58,7 +58,8 @@
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
file.conversionSettings.imageSequence = imageSequence;
|
file.conversionSettings.imageSequence = imageSequence;
|
||||||
file.conversionSettings.imageSequenceFPS = imageSequenceFPS;
|
file.conversionSettings.imageSequenceFPS = imageSequenceFPS;
|
||||||
file.conversionSettings.imageSequenceTransparency = imageSequenceTransparency;
|
file.conversionSettings.imageSequenceTransparency =
|
||||||
|
imageSequenceTransparency;
|
||||||
});
|
});
|
||||||
|
|
||||||
const normalize = (str: string) => str.replace(/^\./, "").toLowerCase();
|
const normalize = (str: string) => str.replace(/^\./, "").toLowerCase();
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-center text-2xl font-semibold mt-4">
|
<h2 class="text-center text-2xl font-semibold mt-4">
|
||||||
{m["upload.uploader.text"]({
|
{m["upload.uploader.text"]({
|
||||||
action: m["upload.uploader.convert"]()
|
action: m["upload.uploader.convert"](),
|
||||||
})}
|
})}
|
||||||
</h2>
|
</h2>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<p class="text-black">
|
<p class="text-black">
|
||||||
{m["convert.external_warning.text"]({
|
{m["convert.external_warning.text"]({
|
||||||
filename: toast.additional.filename,
|
filename: toast.additional.filename,
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<button
|
<button
|
||||||
|
|
|
||||||
|
|
@ -38,40 +38,50 @@
|
||||||
<p>{@html sanitize(m["convert.errors.vertd.details.body"]())}</p>
|
<p>{@html sanitize(m["convert.errors.vertd.details.body"]())}</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="text-black dynadark:text-white">
|
<span class="text-black dynadark:text-white">
|
||||||
{@html sanitize(m["convert.errors.vertd.details.job_id"]({
|
{@html sanitize(
|
||||||
jobId: additional.jobId,
|
m["convert.errors.vertd.details.job_id"]({
|
||||||
}))}
|
jobId: additional.jobId,
|
||||||
|
}),
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="text-black dynadark:text-white">
|
<span class="text-black dynadark:text-white">
|
||||||
{@html sanitize(m["convert.errors.vertd.details.from"]({
|
{@html sanitize(
|
||||||
from: additional.from,
|
m["convert.errors.vertd.details.from"]({
|
||||||
}))}
|
from: additional.from,
|
||||||
|
}),
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="text-black dynadark:text-white">
|
<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>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="text-black dynadark:text-white">
|
<span class="text-black dynadark:text-white">
|
||||||
{@html sanitize(link(
|
{@html sanitize(
|
||||||
["view_link"],
|
link(
|
||||||
m["convert.errors.vertd.details.error_message"](),
|
["view_link"],
|
||||||
[errorBlobUrl || "#"],
|
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],
|
[true],
|
||||||
["text-blue-500 font-normal"],
|
),
|
||||||
))}
|
)}
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
{@html sanitize(link(
|
|
||||||
["privacy_link"],
|
|
||||||
m["convert.errors.vertd.details.footer"](),
|
|
||||||
"/privacy",
|
|
||||||
[true],
|
|
||||||
))}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,7 @@
|
||||||
{m["footer.discord_server"]()}
|
{m["footer.discord_server"]()}
|
||||||
</a>
|
</a>
|
||||||
<p>•</p>
|
<p>•</p>
|
||||||
<a
|
<a class="hover:underline font-normal" href="/privacy/">
|
||||||
class="hover:underline font-normal"
|
|
||||||
href="/privacy/"
|
|
||||||
>
|
|
||||||
{m["footer.privacy_policy"]()}
|
{m["footer.privacy_policy"]()}
|
||||||
</a>
|
</a>
|
||||||
{#if commitHash}
|
{#if commitHash}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,12 @@ import type {
|
||||||
SettingDefinition,
|
SettingDefinition,
|
||||||
} from "$lib/types/conversion-settings";
|
} 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 {
|
export class FormatInfo {
|
||||||
public name: string;
|
public name: string;
|
||||||
|
|
@ -56,7 +61,9 @@ export class Converter {
|
||||||
* Can be overridden per converter for format-specific settings.
|
* Can be overridden per converter for format-specific settings.
|
||||||
* @param input The input file.
|
* @param input The input file.
|
||||||
*/
|
*/
|
||||||
public async getAvailableSettings(input?: VertFile): Promise<SettingDefinition[]> {
|
public async getAvailableSettings(
|
||||||
|
input?: VertFile,
|
||||||
|
): Promise<SettingDefinition[]> {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,7 +71,9 @@ export class Converter {
|
||||||
* Get default settings for a conversion.
|
* Get default settings for a conversion.
|
||||||
* @param input The input file.
|
* @param input The input file.
|
||||||
*/
|
*/
|
||||||
public async getDefaultSettings(input?: VertFile): Promise<ConversionSettings> {
|
public async getDefaultSettings(
|
||||||
|
input?: VertFile,
|
||||||
|
): Promise<ConversionSettings> {
|
||||||
const defaults: ConversionSettings = {};
|
const defaults: ConversionSettings = {};
|
||||||
const settings = await this.getAvailableSettings(input);
|
const settings = await this.getAvailableSettings(input);
|
||||||
settings.forEach((setting) => {
|
settings.forEach((setting) => {
|
||||||
|
|
|
||||||
|
|
@ -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 type { ConversionSettings } from "$lib/types/conversion-settings";
|
||||||
import { videoFormats } from "../vertd/vertd.svelte";
|
import { videoFormats } from "../vertd/vertd.svelte";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export const converterCategories = {
|
||||||
video: ["mediabunny", "vertd"],
|
video: ["mediabunny", "vertd"],
|
||||||
audio: ["ffmpeg"],
|
audio: ["ffmpeg"],
|
||||||
doc: ["pandoc"],
|
doc: ["pandoc"],
|
||||||
}
|
};
|
||||||
|
|
||||||
export function getConverterByFormat(format: string) {
|
export function getConverterByFormat(format: string) {
|
||||||
for (const converter of converters) {
|
for (const converter of converters) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Panel from "$lib/components/visual/Panel.svelte";
|
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 { effects } from "$lib/store/index.svelte";
|
||||||
import {
|
import {
|
||||||
GithubIcon,
|
GithubIcon,
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,14 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
{@html sanitize(link(
|
{@html sanitize(
|
||||||
"discord_link",
|
link(
|
||||||
m["about.sponsors.description"](),
|
"discord_link",
|
||||||
DISCORD_URL,
|
m["about.sponsors.description"](),
|
||||||
true
|
DISCORD_URL,
|
||||||
))}
|
true,
|
||||||
|
),
|
||||||
|
)}
|
||||||
<span class="inline-block mx-[2px] relative top-[2px]">
|
<span class="inline-block mx-[2px] relative top-[2px]">
|
||||||
<button
|
<button
|
||||||
id="email"
|
id="email"
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,8 @@
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<p class="text-base font-bold">
|
<p class="text-base font-bold">
|
||||||
{m["settings.appearance.language.title"]()}
|
{m["settings.appearance.language.title"]()}
|
||||||
{#if currentLocale !== "en"} (Language){/if}
|
{#if currentLocale !== "en"}
|
||||||
|
(Language){/if}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm text-muted font-normal italic">
|
<p class="text-sm text-muted font-normal italic">
|
||||||
{m["settings.appearance.language.description"]()}
|
{m["settings.appearance.language.description"]()}
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@
|
||||||
<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">
|
<p class="text-base font-bold">
|
||||||
{m["settings.conversion.filename.format"]()}
|
{m["settings.conversion.filename.format"]()}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm text-muted font-normal">
|
<p class="text-sm text-muted font-normal">
|
||||||
{@html sanitize(
|
{@html sanitize(
|
||||||
m["settings.conversion.filename.description"](),
|
m["settings.conversion.filename.description"](),
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -87,7 +87,9 @@
|
||||||
<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">
|
<p class="text-base font-bold">
|
||||||
{m["settings.conversion.default_format.label"]()}
|
{m[
|
||||||
|
"settings.conversion.default_format.label"
|
||||||
|
]()}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm text-muted font-normal">
|
<p class="text-sm text-muted font-normal">
|
||||||
{m[
|
{m[
|
||||||
|
|
@ -226,7 +228,9 @@
|
||||||
size="24"
|
size="24"
|
||||||
class="inline-block mr-2"
|
class="inline-block mr-2"
|
||||||
/>
|
/>
|
||||||
{m["settings.conversion.metadata.keep"]()}
|
{m[
|
||||||
|
"settings.conversion.metadata.keep"
|
||||||
|
]()}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
@ -242,7 +246,9 @@
|
||||||
size="24"
|
size="24"
|
||||||
class="inline-block mr-2"
|
class="inline-block mr-2"
|
||||||
/>
|
/>
|
||||||
{m["settings.conversion.metadata.remove"]()}
|
{m[
|
||||||
|
"settings.conversion.metadata.remove"
|
||||||
|
]()}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,9 @@
|
||||||
m["settings.privacy.site_data.clear_all_data_confirm"](),
|
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: () => {},
|
action: () => {},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -95,7 +97,9 @@
|
||||||
ToastManager.add({
|
ToastManager.add({
|
||||||
type: "success",
|
type: "success",
|
||||||
message:
|
message:
|
||||||
m["settings.privacy.site_data.all_data_cleared"](),
|
m[
|
||||||
|
"settings.privacy.site_data.all_data_cleared"
|
||||||
|
](),
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error(
|
error(
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ export interface SettingDefinition {
|
||||||
min?: number;
|
min?: number;
|
||||||
max?: number;
|
max?: number;
|
||||||
step?: 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;
|
description?: string;
|
||||||
hasCustomInput?: boolean; // for select types with a "custom" option
|
hasCustomInput?: boolean; // for select types with a "custom" option
|
||||||
customInputKey?: string; // key to use for custom input value in settings object
|
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 {
|
export interface ConversionSettings {
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,14 @@ import { VertFile } from "./file.svelte";
|
||||||
|
|
||||||
interface ConvertMessage {
|
interface ConvertMessage {
|
||||||
type: "convert";
|
type: "convert";
|
||||||
input: {
|
input:
|
||||||
file: File;
|
| {
|
||||||
name: string;
|
file: File;
|
||||||
from: string;
|
name: string;
|
||||||
to: string;
|
from: string;
|
||||||
} | VertFile;
|
to: string;
|
||||||
|
}
|
||||||
|
| VertFile;
|
||||||
to: string;
|
to: string;
|
||||||
conversionSettings: string; // JSON stringified ConversionSettings
|
conversionSettings: string; // JSON stringified ConversionSettings
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import { browser } from "$app/environment";
|
import { browser } from "$app/environment";
|
||||||
import { error } from "$lib/util/logger";
|
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 {};
|
if (!browser) return {};
|
||||||
|
|
||||||
const raw = localStorage.getItem("settings");
|
const raw = localStorage.getItem("settings");
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,10 @@ const pandocToFiles = (entries: PandocEntries, parent = ""): File[] => {
|
||||||
const nestedFiles = pandocToFiles(entry.entries, fullPath);
|
const nestedFiles = pandocToFiles(entry.entries, fullPath);
|
||||||
flattened.push(...nestedFiles);
|
flattened.push(...nestedFiles);
|
||||||
} else {
|
} 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);
|
flattened.push(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
import { goto, beforeNavigate, afterNavigate } from "$app/navigation";
|
import { goto, beforeNavigate, afterNavigate } from "$app/navigation";
|
||||||
|
|
||||||
import { PUB_PLAUSIBLE_URL, PUB_HOSTNAME } from "$env/static/public";
|
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 Layout from "$lib/components/layout";
|
||||||
import * as Navbar from "$lib/components/layout/Navbar";
|
import * as Navbar from "$lib/components/layout/Navbar";
|
||||||
import { Settings } from "$lib/sections/settings/index.svelte";
|
import { Settings } from "$lib/sections/settings/index.svelte";
|
||||||
|
|
@ -96,7 +99,10 @@
|
||||||
|
|
||||||
// detect if insecure context
|
// detect if insecure context
|
||||||
if (!window.isSecureContext) {
|
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({
|
ToastManager.add({
|
||||||
type: "warning",
|
type: "warning",
|
||||||
message: m["toast.insecure_context"](),
|
message: m["toast.insecure_context"](),
|
||||||
|
|
@ -155,7 +161,10 @@
|
||||||
property="twitter:description"
|
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."
|
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="manifest" href="/manifest.json" />
|
||||||
<link rel="canonical" href="https://vert.sh/" />
|
<link rel="canonical" href="https://vert.sh/" />
|
||||||
{#if enablePlausible}
|
{#if enablePlausible}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@
|
||||||
link(
|
link(
|
||||||
["about_link", "stripe_link"],
|
["about_link", "stripe_link"],
|
||||||
m["privacy.donations.description"](),
|
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],
|
[false, true],
|
||||||
),
|
),
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const parsedSettings = readSavedSettings();
|
const parsedSettings = readSavedSettings();
|
||||||
if (parsedSettings && JSON.stringify(parsedSettings) === JSON.stringify(settings))
|
if (
|
||||||
|
parsedSettings &&
|
||||||
|
JSON.stringify(parsedSettings) === JSON.stringify(settings)
|
||||||
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue