From 00e38b6e2ccd8dfbb91dcacb6db03a83d1f920bf Mon Sep 17 00:00:00 2001 From: Maya Date: Mon, 20 Oct 2025 18:47:13 +0300 Subject: [PATCH] fix: prevent conversion on one-way oops --- messages/en.json | 1 + src/routes/convert/+page.svelte | 297 +++++++++++++++++--------------- 2 files changed, 159 insertions(+), 139 deletions(-) diff --git a/messages/en.json b/messages/en.json index 620a1e4..a6a31a7 100644 --- a/messages/en.json +++ b/messages/en.json @@ -94,6 +94,7 @@ "vertd_details_error_message": "Error message: [view_link]View error logs[/view_link]", "vertd_details_close": "Close", "unsupported_format": "Only image, video, audio, and document files are supported", + "format_output_only": "This format can currently only be used as output (converted to), not as input.", "vertd_not_found": "Could not find the vertd instance to start video conversion. Are you sure the instance URL is set correctly?", "worker_downloading": "The {type} converter is currently being initialized, please wait a few moments.", "worker_error": "The {type} converter had an error during initialization, please try again later.", diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelte index d616fa2..13c4875 100644 --- a/src/routes/convert/+page.svelte +++ b/src/routes/convert/+page.svelte @@ -216,161 +216,180 @@

{/if} - {:else if currentConverter.status === "downloading"} -
-

- {m["convert.errors.cant_convert"]()} -

-

- {m["convert.errors.worker_downloading"]({ - type: isAudio - ? m["convert.errors.audio"]() - : isVideo - ? "Video" - : isDocument - ? m["convert.errors.doc"]() - : m["convert.errors.image"](), - })} -

-
- {:else if currentConverter.status === "error"} -
-

- {m["convert.errors.cant_convert"]()} -

-

- {m["convert.errors.worker_error"]({ - type: isAudio - ? m["convert.errors.audio"]() - : isVideo - ? "Video" - : isDocument - ? m["convert.errors.doc"]() - : m["convert.errors.image"](), - })} -

-
- {:else if currentConverter.status === "not-ready"} -
-

- {m["convert.errors.cant_convert"]()} -

-

- {m["convert.errors.worker_timeout"]({ - type: isAudio - ? m["convert.errors.audio"]() - : isVideo - ? "Video" - : isDocument - ? m["convert.errors.doc"]() - : m["convert.errors.image"](), - })} -

-
- {:else if isVideo && !$vertdLoaded && !isAudio && !isImage && !isDocument} -
-

- {m["convert.errors.cant_convert"]()} -

-

- {m["convert.errors.vertd_not_found"]()} -

-
{:else} -
+ {@const formatInfo = currentConverter.supportedFormats.find( + (f) => f.name === file.from, + )} + {#if formatInfo && !formatInfo.fromSupported}
-
- {#if file.blobUrl} - {file.name} - {:else} -
- {#if isAudio} - - {:else if isVideo} - - {:else if isDocument} - - {:else} - - {/if} -
- {/if} -
+

+ {m["convert.errors.cant_convert"]()} +

+

+ {m["convert.errors.format_output_only"]()} +

+ {:else if currentConverter.status === "downloading"}
+

+ {m["convert.errors.cant_convert"]()} +

+

+ {m["convert.errors.worker_downloading"]({ + type: isAudio + ? m["convert.errors.audio"]() + : isVideo + ? "Video" + : isDocument + ? m["convert.errors.doc"]() + : m["convert.errors.image"](), + })} +

+
+ {:else if currentConverter.status === "error"} +
+

+ {m["convert.errors.cant_convert"]()} +

+

+ {m["convert.errors.worker_error"]({ + type: isAudio + ? m["convert.errors.audio"]() + : isVideo + ? "Video" + : isDocument + ? m["convert.errors.doc"]() + : m["convert.errors.image"](), + })} +

+
+ {:else if currentConverter.status === "not-ready"} +
+

+ {m["convert.errors.cant_convert"]()} +

+

+ {m["convert.errors.worker_timeout"]({ + type: isAudio + ? m["convert.errors.audio"]() + : isVideo + ? "Video" + : isDocument + ? m["convert.errors.doc"]() + : m["convert.errors.image"](), + })} +

+
+ {:else if isVideo && !$vertdLoaded && !isAudio && !isImage && !isDocument} +
+

+ {m["convert.errors.cant_convert"]()} +

+

+ {m["convert.errors.vertd_not_found"]()} +

+
+ {:else} +
- handleSelect(option, file)} - /> -
- - - - + {:else if isVideo} + + {:else if isDocument} + + {:else} + + {/if} +
+ {/if} +
+
+
+
+ + handleSelect(option, file)} + /> +
- - + + + + + +
- + {/if} {/if} {/snippet}