update readme

This commit is contained in:
C4illin
2024-05-25 15:56:34 +02:00
parent d81a3a6ab4
commit 10684a1f90
2 changed files with 13 additions and 11 deletions

View File

@@ -1,19 +1,19 @@
![ConvertX](images/logo.png) ![ConvertX](images/logo.png)
# ConvertX # 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 ## Features
- Convert files to different formats - Convert files to different formats
- Password protection - Password protection
- Multiple accounts - Multiple accounts
## Converters supported ## Converters supported
| Converter | Use case | Converts from | Converts to | | Converter | Use case | Converts from | Converts to |
|----------------|---------------|---------------|-------------| |----------------|---------------|---------------|-------------|
| Sharp | Images (fast) | 7 | 6 | | Vips | Images (fast) | 45 | 23 |
| Pandoc | Documents | 43 | 65 | | Pandoc | Documents | 43 | 65 |
| GraphicsMagick | Images | 166 | 133 | | GraphicsMagick | Images | 166 | 133 |
| FFmpeg | Video | ~473 | ~280 | | 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. 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 ## Todo
- [ ] Add messages for errors in converters - [x] Add messages for errors in converters
- [ ] Add options for converters - [ ] Add options for converters
- [ ] Add more converters - [ ] Add more converters
- [ ] Divide index.tsx into smaller components - [ ] Divide index.tsx into smaller components

View File

@@ -60,7 +60,9 @@ const dbVersion = (
db.query("PRAGMA user_version").get() as { user_version?: number } db.query("PRAGMA user_version").get() as { user_version?: number }
).user_version; ).user_version;
if (dbVersion === 0) { 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;"); db.exec("PRAGMA user_version = 1;");
} }
@@ -213,27 +215,27 @@ const app = new Elysia()
}; };
} }
const savedPassword = await Bun.password.hash(body.password); const savedPassword = await Bun.password.hash(body.password);
db.query("INSERT INTO users (email, password) VALUES (?, ?)").run( db.query("INSERT INTO users (email, password) VALUES (?, ?)").run(
body.email, body.email,
savedPassword, savedPassword,
); );
const user = (await db const user = (await db
.query("SELECT * FROM users WHERE email = ?") .query("SELECT * FROM users WHERE email = ?")
.get(body.email)) as IUser; .get(body.email)) as IUser;
const accessToken = await jwt.sign({ const accessToken = await jwt.sign({
id: String(user.id), id: String(user.id),
}); });
if (!auth) { if (!auth) {
set.status = 500; set.status = 500;
return { return {
message: "No auth cookie, perhaps your browser is blocking cookies.", message: "No auth cookie, perhaps your browser is blocking cookies.",
}; };
} }
// set cookie // set cookie
auth.set({ auth.set({
value: accessToken, value: accessToken,
@@ -242,7 +244,7 @@ const app = new Elysia()
maxAge: 60 * 60 * 24 * 7, maxAge: 60 * 60 * 24 * 7,
sameSite: "strict", sameSite: "strict",
}); });
return redirect("/"); return redirect("/");
}, },
{ body: t.Object({ email: t.String(), password: t.String() }) }, { body: t.Object({ email: t.String(), password: t.String() }) },