Skip to content

Commit 82f0e14

Browse files
authored
Merge pull request #310 from C4illin/refactor-elysia-router
2 parents 2490c3a + 9e759a7 commit 82f0e14

20 files changed

+1940
-2189
lines changed

.dockerignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22
.editorconfig
33
.env
44
.git
5+
.gitignore
6+
.github
57
.idea
68
.vscode
9+
biome.json
710
CHANGELOG.md
11+
compose.yaml
812
coverage*
913
data
1014
docker-compose*
1115
Dockerfile*
1216
eslint.config.js
1317
helm-charts
18+
images
1419
LICENSE
1520
Makefile
1621
node_modules
1722
prettier.config.js
1823
README.md
19-
renovate.json
24+
renovate.json
25+
SECURITY.md

bun.lock

Lines changed: 6 additions & 399 deletions
Large diffs are not rendered by default.

compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ services:
88
environment: # Defaults are listed below. All are optional.
99
- ACCOUNT_REGISTRATION=true # true or false, doesn't matter for the first account (e.g. keep this to false if you only want one account)
1010
- JWT_SECRET=aLongAndSecretStringUsedToSignTheJSONWebToken1234 # will use randomUUID() by default
11-
- HTTP_ALLOWED=true # setting this to true is unsafe, only set this to true locally
12-
- ALLOW_UNAUTHENTICATED=true # allows anyone to use the service without logging in, only set this to true locally
11+
- HTTP_ALLOWED=false # setting this to true is unsafe, only set this to true locally
12+
- ALLOW_UNAUTHENTICATED=false # allows anyone to use the service without logging in, only set this to true locally
1313
- AUTO_DELETE_EVERY_N_HOURS=1 # checks every n hours for files older then n hours and deletes them, set to 0 to disable
1414
# - FFMPEG_ARGS=-hwaccel vulkan # additional arguments to pass to ffmpeg
1515
# - WEBROOT=/convertx # the root path of the web interface, leave empty to disable

eslint.config.ts

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import js from "@eslint/js";
22
import eslintParserTypeScript from "@typescript-eslint/parser";
33
import type { Linter } from "eslint";
4-
import eslintPluginReadableTailwind from "eslint-plugin-readable-tailwind";
4+
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
55
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
66
import globals from "globals";
77
import tseslint from "typescript-eslint";
@@ -13,7 +13,7 @@ export default [
1313
{
1414
plugins: {
1515
"simple-import-sort": simpleImportSortPlugin,
16-
"readable-tailwind": eslintPluginReadableTailwind,
16+
"better-tailwindcss": eslintPluginBetterTailwindcss,
1717
},
1818
ignores: ["**/node_modules/**"],
1919
languageOptions: {
@@ -30,28 +30,37 @@ export default [
3030
},
3131
},
3232
files: ["**/*.{js,mjs,cjs,jsx,tsx,ts}"],
33+
settings: {
34+
"better-tailwindcss": {
35+
entryPoint: "src/main.css",
36+
},
37+
},
3338
rules: {
34-
...eslintPluginReadableTailwind.configs.warning.rules,
39+
...eslintPluginBetterTailwindcss.configs["recommended-warn"]?.rules,
40+
...eslintPluginBetterTailwindcss.configs["stylistic-warn"]?.rules,
3541
// "tailwindcss/classnames-order": "off",
36-
"readable-tailwind/multiline": [
42+
"better-tailwindcss/multiline": [
3743
"warn",
3844
{
3945
group: "newLine",
4046
printWidth: 100,
4147
},
4248
],
43-
// "tailwindcss/no-custom-classname": [
44-
// "warn",
45-
// {
46-
// whitelist: [
47-
// "select_container",
48-
// "convert_to_popup",
49-
// "convert_to_group",
50-
// "target",
51-
// "convert_to_target",
52-
// ],
53-
// },
54-
// ],
49+
"better-tailwindcss/no-unregistered-classes": [
50+
"warn",
51+
{
52+
ignore: [
53+
"^group(?:\\/(\\S*))?$",
54+
"^peer(?:\\/(\\S*))?$",
55+
"select_container",
56+
"convert_to_popup",
57+
"convert_to_group",
58+
"target",
59+
"convert_to_target",
60+
"job-details-toggle",
61+
],
62+
},
63+
],
5564
},
5665
},
5766
] as Linter.Config[];

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,18 @@
3232
"@tailwindcss/postcss": "^4.1.7",
3333
"@total-typescript/ts-reset": "^0.6.1",
3434
"@types/bun": "^1.2.14",
35-
"@types/eslint-plugin-tailwindcss": "^3.17.0",
3635
"@types/node": "^22.15.21",
37-
"autoprefixer": "^10.4.21",
38-
"cssnano": "^7.0.7",
3936
"eslint": "^9.27.0",
40-
"eslint-plugin-readable-tailwind": "^2.1.2",
37+
"eslint-plugin-better-tailwindcss": "^3.0.0",
4138
"eslint-plugin-simple-import-sort": "^12.1.1",
42-
"eslint-plugin-tailwindcss": "4.0.0-alpha.0",
4339
"globals": "^16.1.0",
4440
"knip": "^5.57.2",
4541
"npm-run-all2": "^8.0.3",
4642
"postcss": "^8.5.3",
47-
"postcss-cli": "^11.0.1",
4843
"prettier": "^3.5.3",
4944
"tailwind-scrollbar": "^4.0.2",
5045
"tailwindcss": "^4.1.7",
5146
"typescript": "^5.8.3",
5247
"typescript-eslint": "^8.32.1"
5348
}
54-
}
49+
}

src/components/base.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const BaseHtml = ({
4444
<a
4545
href="https://github.com/C4illin/ConvertX"
4646
class={`
47-
hover:text-accent-500
4847
text-neutral-400
48+
hover:text-accent-500
4949
`}
5050
>
5151
ConvertX{" "}

src/db/db.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Database } from "bun:sqlite";
2+
const db = new Database("./data/mydb.sqlite", { create: true });
3+
4+
if (!db.query("SELECT * FROM sqlite_master WHERE type='table'").get()) {
5+
db.exec(`
6+
CREATE TABLE IF NOT EXISTS users (
7+
id INTEGER PRIMARY KEY AUTOINCREMENT,
8+
email TEXT NOT NULL,
9+
password TEXT NOT NULL
10+
);
11+
CREATE TABLE IF NOT EXISTS file_names (
12+
id INTEGER PRIMARY KEY AUTOINCREMENT,
13+
job_id INTEGER NOT NULL,
14+
file_name TEXT NOT NULL,
15+
output_file_name TEXT NOT NULL,
16+
status TEXT DEFAULT 'not started',
17+
FOREIGN KEY (job_id) REFERENCES jobs(id)
18+
);
19+
CREATE TABLE IF NOT EXISTS jobs (
20+
id INTEGER PRIMARY KEY AUTOINCREMENT,
21+
user_id INTEGER NOT NULL,
22+
date_created TEXT NOT NULL,
23+
status TEXT DEFAULT 'not started',
24+
num_files INTEGER DEFAULT 0,
25+
FOREIGN KEY (user_id) REFERENCES users(id)
26+
);
27+
PRAGMA user_version = 1;`);
28+
}
29+
30+
const dbVersion = (
31+
db.query("PRAGMA user_version").get() as { user_version?: number }
32+
).user_version;
33+
if (dbVersion === 0) {
34+
db.exec(
35+
"ALTER TABLE file_names ADD COLUMN status TEXT DEFAULT 'not started';",
36+
);
37+
db.exec("PRAGMA user_version = 1;");
38+
console.log("Updated database to version 1.");
39+
}
40+
41+
// enable WAL mode
42+
db.exec("PRAGMA journal_mode = WAL;");
43+
44+
export default db;

src/helpers/env.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export const ACCOUNT_REGISTRATION =
2+
process.env.ACCOUNT_REGISTRATION?.toLowerCase() === "true" || false;
3+
4+
export const HTTP_ALLOWED =
5+
process.env.HTTP_ALLOWED?.toLowerCase() === "true" || false;
6+
7+
export const ALLOW_UNAUTHENTICATED =
8+
process.env.ALLOW_UNAUTHENTICATED?.toLowerCase() === "true" || false;
9+
10+
export const AUTO_DELETE_EVERY_N_HOURS = process.env.AUTO_DELETE_EVERY_N_HOURS
11+
? Number(process.env.AUTO_DELETE_EVERY_N_HOURS)
12+
: 24;
13+
14+
export const HIDE_HISTORY =
15+
process.env.HIDE_HISTORY?.toLowerCase() === "true" || false;
16+
17+
export const WEBROOT = process.env.WEBROOT ?? "";

0 commit comments

Comments
 (0)