From 10684a1f90ec130e93fe684d4e83ff971bd34c44 Mon Sep 17 00:00:00 2001 From: C4illin Date: Sat, 25 May 2024 15:56:34 +0200 Subject: [PATCH] update readme --- README.md | 8 ++++---- src/index.tsx | 16 +++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3d12f43..737aae6 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ ![ConvertX](images/logo.png) # ConvertX -A self-hosted online file converter. Supports 808 different formats. +A self-hosted online file converter. Supports 808 different formats. Written with Bun and Elysia. + ## Features - Convert files to different formats - Password protection - Multiple accounts - ## Converters supported | Converter | Use case | Converts from | Converts to | |----------------|---------------|---------------|-------------| -| Sharp | Images (fast) | 7 | 6 | +| Vips | Images (fast) | 45 | 23 | | Pandoc | Documents | 43 | 65 | | GraphicsMagick | Images | 166 | 133 | | FFmpeg | Video | ~473 | ~280 | @@ -45,7 +45,7 @@ docker run ghcr.io/c4illin/convertx:master -p 3000:3000 -e ACCOUNT_REGISTRATION= Then visit `http://localhost:3000` in your browser and create your account. Don't leave it unconfigured and open, as anyone can register the first account. ## Todo -- [ ] Add messages for errors in converters +- [x] Add messages for errors in converters - [ ] Add options for converters - [ ] Add more converters - [ ] Divide index.tsx into smaller components diff --git a/src/index.tsx b/src/index.tsx index e11cdb8..def2dcc 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -60,7 +60,9 @@ const dbVersion = ( db.query("PRAGMA user_version").get() as { user_version?: number } ).user_version; if (dbVersion === 0) { - db.exec("ALTER TABLE file_names ADD COLUMN status TEXT DEFAULT 'not started';"); + db.exec( + "ALTER TABLE file_names ADD COLUMN status TEXT DEFAULT 'not started';", + ); db.exec("PRAGMA user_version = 1;"); } @@ -213,27 +215,27 @@ const app = new Elysia() }; } const savedPassword = await Bun.password.hash(body.password); - + db.query("INSERT INTO users (email, password) VALUES (?, ?)").run( body.email, savedPassword, ); - + const user = (await db .query("SELECT * FROM users WHERE email = ?") .get(body.email)) as IUser; - + const accessToken = await jwt.sign({ id: String(user.id), }); - + if (!auth) { set.status = 500; return { message: "No auth cookie, perhaps your browser is blocking cookies.", }; } - + // set cookie auth.set({ value: accessToken, @@ -242,7 +244,7 @@ const app = new Elysia() maxAge: 60 * 60 * 24 * 7, sameSite: "strict", }); - + return redirect("/"); }, { body: t.Object({ email: t.String(), password: t.String() }) },