mirror of https://github.com/VERT-sh/VERT.git
parent
dbc3774c5b
commit
d63c2e60a7
12
README.md
12
README.md
|
@ -1,13 +1,15 @@
|
||||||
# VERT
|
# VERT
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
VERT is a file conversion utility for the web that uses WebAssembly to convert files directly on your device instead of on a cloud. Check out the live instance at [vert.sh](https://vert.sh).
|
VERT is a file conversion utility for the web that uses WebAssembly to convert files directly on your device instead of on a cloud. Check out the live instance at [vert.sh](https://vert.sh).
|
||||||
|
|
||||||
VERT is built with Svelte & TypeScript (using [bun](https://bun.sh)).
|
VERT is built with Svelte & TypeScript (using [bun](https://bun.sh)).
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
- Clone the project - `git clone https://github.com/not-nullptr/VERT.git`
|
- Clone the project - `git clone https://github.com/not-nullptr/VERT.git`
|
||||||
- Use [bun](https://bun.sh) to install the dependencies - `bun install`
|
- Use [bun](https://bun.sh) to install the dependencies - `bun install`
|
||||||
- Copy the contents of `.env.example` into `.env` and make any changes (if wanted)
|
- Copy the contents of `.env.example` into `.env` and make any changes (if wanted)
|
||||||
- Start a dev environment & make your changes - `bun run dev`
|
- Start a dev environment & make your changes - `bun run dev`
|
||||||
- Build and preview for production - `bun run build` & `bun run preview`
|
- Build and preview for production - `bun run build` & `bun run preview`
|
||||||
|
|
|
@ -21,7 +21,12 @@
|
||||||
let fileInput = $state<HTMLInputElement>();
|
let fileInput = $state<HTMLInputElement>();
|
||||||
let dragOver = $state(false);
|
let dragOver = $state(false);
|
||||||
|
|
||||||
let { files = $bindable(), onupload, isMobile, acceptedFormats }: Props = $props();
|
let {
|
||||||
|
files = $bindable(),
|
||||||
|
onupload,
|
||||||
|
isMobile,
|
||||||
|
acceptedFormats,
|
||||||
|
}: Props = $props();
|
||||||
|
|
||||||
function upload() {
|
function upload() {
|
||||||
if (!fileInput) return;
|
if (!fileInput) return;
|
||||||
|
|
|
@ -19,4 +19,4 @@ class Files {
|
||||||
|
|
||||||
export const files = new Files();
|
export const files = new Files();
|
||||||
|
|
||||||
export const outputFilenameOption = ['default', 'original'];
|
export const outputFilenameOption = ["default", "original"];
|
||||||
|
|
|
@ -86,7 +86,9 @@
|
||||||
isMobile={data.isMobile}
|
isMobile={data.isMobile}
|
||||||
bind:files={ourFiles}
|
bind:files={ourFiles}
|
||||||
onupload={runUpload}
|
onupload={runUpload}
|
||||||
acceptedFormats={[...new Set(converters.flatMap((c) => c.supportedFormats))]}
|
acceptedFormats={[
|
||||||
|
...new Set(converters.flatMap((c) => c.supportedFormats)),
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
const allConvertersReady = $derived(
|
const allConvertersReady = $derived(
|
||||||
convertersRequired.every((c) => c.ready),
|
convertersRequired.every((c) => c.ready),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
let outputFilename = $state(outputFilenameOption[0]);
|
let outputFilename = $state(outputFilenameOption[0]);
|
||||||
|
|
||||||
|
@ -56,10 +56,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// reloads the "output filename" option
|
// reloads the "output filename" option
|
||||||
const savedOption = localStorage.getItem('outputFilename');
|
const savedOption = localStorage.getItem("outputFilename");
|
||||||
if (savedOption) {
|
if (savedOption) {
|
||||||
outputFilename = savedOption;
|
outputFilename = savedOption;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let disabled = $derived(files.files.some((f) => !f.result));
|
let disabled = $derived(files.files.some((f) => !f.result));
|
||||||
|
@ -134,9 +134,10 @@
|
||||||
if (files.files.length === 0) return;
|
if (files.files.length === 0) return;
|
||||||
if (files.files.length === 1) {
|
if (files.files.length === 1) {
|
||||||
// download the image only
|
// download the image only
|
||||||
const filename = outputFilename === "default"
|
const filename =
|
||||||
? `VERT-Converted_${date}`
|
outputFilename === "default"
|
||||||
: files.files[0].file.name.replace(/\.[^/.]+$/, "");
|
? `VERT-Converted_${date}`
|
||||||
|
: files.files[0].file.name.replace(/\.[^/.]+$/, "");
|
||||||
const blob = URL.createObjectURL(
|
const blob = URL.createObjectURL(
|
||||||
new Blob([dlFiles[0].input], {
|
new Blob([dlFiles[0].input], {
|
||||||
type: files.files[0].to.slice(1),
|
type: files.files[0].to.slice(1),
|
||||||
|
@ -204,7 +205,10 @@
|
||||||
selected={outputFilename}
|
selected={outputFilename}
|
||||||
onselect={(o) => {
|
onselect={(o) => {
|
||||||
outputFilename = o;
|
outputFilename = o;
|
||||||
localStorage.setItem('outputFilename', o);
|
localStorage.setItem(
|
||||||
|
"outputFilename",
|
||||||
|
o,
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue