mirror of https://github.com/VERT-sh/VERT.git
feat: warn when converting videos if vertd instance isn't found
+ add an easter egg if you try to upload the vertd server yw realmy
This commit is contained in:
parent
98fadbbe76
commit
51e67a3970
|
|
@ -5,6 +5,7 @@
|
||||||
import type { ISettings } from "./index.svelte";
|
import type { ISettings } from "./index.svelte";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import Dropdown from "$lib/components/functional/Dropdown.svelte";
|
import Dropdown from "$lib/components/functional/Dropdown.svelte";
|
||||||
|
import { vertdLoaded } from "$lib/store/index.svelte";
|
||||||
|
|
||||||
let vertdCommit = $state<string | null>(null);
|
let vertdCommit = $state<string | null>(null);
|
||||||
let abortController: AbortController | null = null;
|
let abortController: AbortController | null = null;
|
||||||
|
|
@ -21,17 +22,23 @@
|
||||||
fetch(`${settings.vertdURL}/api/version`, { signal })
|
fetch(`${settings.vertdURL}/api/version`, { signal })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!res.ok) throw new Error("bad response");
|
if (!res.ok) throw new Error("bad response");
|
||||||
|
vertdLoaded.set(false);
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
vertdCommit = data.data;
|
vertdCommit = data.data;
|
||||||
|
vertdLoaded.set(true);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.name !== "AbortError") vertdCommit = null;
|
if (err.name !== "AbortError") {
|
||||||
|
vertdCommit = null;
|
||||||
|
vertdLoaded.set(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (abortController) abortController.abort();
|
if (abortController) abortController.abort();
|
||||||
vertdCommit = null;
|
vertdCommit = null;
|
||||||
|
vertdLoaded.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,7 @@ export const showGradient = writable(true);
|
||||||
export const gradientColor = writable("");
|
export const gradientColor = writable("");
|
||||||
export const goingLeft = writable(false);
|
export const goingLeft = writable(false);
|
||||||
export const dropping = writable(false);
|
export const dropping = writable(false);
|
||||||
|
export const vertdLoaded = writable(false);
|
||||||
|
|
||||||
export const isMobile = writable(false);
|
export const isMobile = writable(false);
|
||||||
export const effects = writable(true);
|
export const effects = writable(true);
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,13 @@
|
||||||
import Uploader from "$lib/components/functional/Uploader.svelte";
|
import Uploader from "$lib/components/functional/Uploader.svelte";
|
||||||
import Panel from "$lib/components/visual/Panel.svelte";
|
import Panel from "$lib/components/visual/Panel.svelte";
|
||||||
import ProgressBar from "$lib/components/visual/ProgressBar.svelte";
|
import ProgressBar from "$lib/components/visual/ProgressBar.svelte";
|
||||||
|
import { converters } from "$lib/converters";
|
||||||
import {
|
import {
|
||||||
effects,
|
effects,
|
||||||
files,
|
files,
|
||||||
gradientColor,
|
gradientColor,
|
||||||
showGradient,
|
showGradient,
|
||||||
|
vertdLoaded,
|
||||||
} from "$lib/store/index.svelte";
|
} from "$lib/store/index.svelte";
|
||||||
import { VertFile } from "$lib/types";
|
import { VertFile } from "$lib/types";
|
||||||
import {
|
import {
|
||||||
|
|
@ -96,12 +98,38 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{#if !file.converter}
|
{#if !file.converter}
|
||||||
|
{#if file.name.startsWith("vertd")}
|
||||||
|
<div
|
||||||
|
class="h-full flex flex-col text-center justify-center text-failure"
|
||||||
|
>
|
||||||
|
<p class="font-body font-bold">
|
||||||
|
We can't convert this file.
|
||||||
|
</p>
|
||||||
|
<p class="font-normal">
|
||||||
|
what are you doing..? you're supposed to run the vertd
|
||||||
|
server!
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div
|
||||||
|
class="h-full flex flex-col text-center justify-center text-failure"
|
||||||
|
>
|
||||||
|
<p class="font-body font-bold">
|
||||||
|
We can't convert this file.
|
||||||
|
</p>
|
||||||
|
<p class="font-normal">
|
||||||
|
Only image, video, and audio files are supported
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{:else if isVideo && !$vertdLoaded}
|
||||||
<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"
|
||||||
>
|
>
|
||||||
<p class="font-body font-bold">We can't convert this file.</p>
|
<p class="font-body font-bold">We can't convert this file.</p>
|
||||||
<p class="font-normal">
|
<p class="font-normal">
|
||||||
Only image, video, and audio files are supported
|
Could not find the vertd instance to start video conversion.
|
||||||
|
Are you sure the instance URL is set correctly?
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue