From 84ed7b299f13d7e30331baf48efb5bc826167d58 Mon Sep 17 00:00:00 2001 From: Bernd Storath <32197462+kaaax0815@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:17:02 +0200 Subject: [PATCH] Feat: Cli (#1818) * add cli * fix lint * add docs, include cli packages * fix docs, username instead of name --- Dockerfile | 3 + Dockerfile.dev | 1 + README.md | 9 +++ docker-compose.dev.yml | 2 +- docs/content/faq.md | 20 +++---- docs/content/guides/cli.md | 43 +++++++++++++ package.json | 3 +- src/cli/build.js | 25 ++++++++ src/cli/cli.sh | 5 ++ src/cli/index.ts | 92 ++++++++++++++++++++++++++++ src/nuxt.config.ts | 6 ++ src/package.json | 10 +++- src/pnpm-lock.yaml | 113 +++++++++++++++++++++-------------- src/server/utils/password.ts | 2 + 14 files changed, 276 insertions(+), 58 deletions(-) create mode 100644 docs/content/guides/cli.md create mode 100644 src/cli/build.js create mode 100644 src/cli/cli.sh create mode 100644 src/cli/index.ts diff --git a/Dockerfile b/Dockerfile index 1fc0b5a5..0aae23f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,9 @@ COPY --from=build /app/.output /app COPY --from=build /app/server/database/migrations /app/server/database/migrations # libsql RUN cd /app/server && npm install --no-save libsql +# cli +COPY --from=build /app/cli/cli.sh /usr/local/bin/cli +RUN chmod +x /usr/local/bin/cli # Install Linux packages RUN apk add --no-cache \ diff --git a/Dockerfile.dev b/Dockerfile.dev index 50d18112..d130ad49 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -36,3 +36,4 @@ RUN pnpm install # Copy Project COPY src ./ +ENTRYPOINT [ "pnpm", "run" ] diff --git a/README.md b/README.md index 5042bc92..dc74b7ee 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,15 @@ If you add something that should be auto-importable and VSCode complains, run: ```shell cd src pnpm install +cd .. +``` + +### Test Cli + +This starts the cli with docker + +```shell +pnpm cli:dev ``` ## License diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 8f9dad6e..8da0a83c 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -2,7 +2,7 @@ services: wg-easy: build: dockerfile: ./Dockerfile.dev - command: pnpm run dev + command: dev volumes: - ./src/:/app/ - temp:/app/.nuxt/ diff --git a/docs/content/faq.md b/docs/content/faq.md index 7fd0cd12..b2430530 100644 --- a/docs/content/faq.md +++ b/docs/content/faq.md @@ -14,13 +14,13 @@ To resolve this issue, you can try the following steps: 1. **Load the WireGuard kernel module**: If the WireGuard kernel module is not loaded, you can load it manually by running: - ```bash + ```shell sudo modprobe wireguard ``` 2. **Load the WireGuard kernel module on boot**: If you want to ensure that the WireGuard kernel module is loaded automatically on boot, you can add it to the `/etc/modules` file: - ```bash + ```shell echo "wireguard" | sudo tee -a /etc/modules ``` @@ -32,13 +32,13 @@ To resolve this issue, you can try the following steps: 1. **Load the `nat` kernel module**: If the `nat` kernel module is not loaded, you can load it manually by running: - ```bash + ```shell sudo modprobe iptable_nat ``` 2. **Load the `nat` kernel module on boot**: If you want to ensure that the `nat` kernel module is loaded automatically on boot, you can add it to the `/etc/modules` file: - ```bash + ```shell echo "iptable_nat" | sudo tee -a /etc/modules ``` @@ -50,13 +50,13 @@ To resolve this issue, you can try the following steps: 1. **Load the `nat` kernel module**: If the `nat` kernel module is not loaded, you can load it manually by running: - ```bash + ```shell sudo modprobe ip6table_nat ``` 2. **Load the `nat` kernel module on boot**: If you want to ensure that the `nat` kernel module is loaded automatically on boot, you can add it to the `/etc/modules` file: - ```bash + ```shell echo "ip6table_nat" | sudo tee -a /etc/modules ``` @@ -68,13 +68,13 @@ To resolve this issue, you can try the following steps: 1. **Load the `filter` kernel module**: If the `filter` kernel module is not loaded, you can load it manually by running: - ```bash + ```shell sudo modprobe iptable_filter ``` 2. **Load the `filter` kernel module on boot**: If you want to ensure that the `filter` kernel module is loaded automatically on boot, you can add it to the `/etc/modules` file: - ```bash + ```shell echo "iptable_filter" | sudo tee -a /etc/modules ``` @@ -86,12 +86,12 @@ To resolve this issue, you can try the following steps: 1. **Load the `filter` kernel module**: If the `filter` kernel module is not loaded, you can load it manually by running: - ```bash + ```shell sudo modprobe ip6table_filter ``` 2. **Load the `filter` kernel module on boot**: If you want to ensure that the `filter` kernel module is loaded automatically on boot, you can add it to the `/etc/modules` file: - ```bash + ```shell echo "ip6table_filter" | sudo tee -a /etc/modules ``` diff --git a/docs/content/guides/cli.md b/docs/content/guides/cli.md new file mode 100644 index 00000000..5a4b5a07 --- /dev/null +++ b/docs/content/guides/cli.md @@ -0,0 +1,43 @@ +--- +title: CLI +--- + +If you want to use the CLI, you can run it with + +### Docker Compose + +```shell +cd /etc/docker/containers/wg-easy +docker compose exec -it wg-easy cli +``` + +### Docker Run + +```shell +docker run --rm -it \ + -v ~/.wg-easy:/etc/wireguard \ + ghcr.io/wg-easy/wg-easy:15 \ + cli +``` + +### Reset Password + +If you want to reset the password for the admin user, you can run the following command: + +#### By Prompt + +```shell +cd /etc/docker/containers/wg-easy +docker compose exec -it wg-easy cli db:admin:reset +``` + +You are asked to provide the new password + +#### By Argument + +```shell +cd /etc/docker/containers/wg-easy +docker compose exec -it wg-easy cli db:admin:reset --password +``` + +This will reset the password for the admin user to the new password you provided. If you include special characters in the password, make sure to escape them properly. diff --git a/package.json b/package.json index 0c15927e..f342dc1d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "version": "1.0.0", "private": true, "scripts": { - "dev": "docker compose -f docker-compose.dev.yml up --build", + "dev": "docker compose -f docker-compose.dev.yml up wg-easy --build", + "cli:dev": "docker compose -f docker-compose.dev.yml run --build --rm -it wg-easy cli:dev", "build": "docker build -t wg-easy .", "docs:preview": "docker run --rm -it -p 8080:8080 -v ./docs:/docs squidfunk/mkdocs-material serve -a 0.0.0.0:8080", "scripts:version": "bash scripts/version.sh", diff --git a/src/cli/build.js b/src/cli/build.js new file mode 100644 index 00000000..143a47bc --- /dev/null +++ b/src/cli/build.js @@ -0,0 +1,25 @@ +// @ts-check + +import { fileURLToPath } from 'node:url'; +import esbuild from 'esbuild'; + +esbuild.build({ + entryPoints: [fileURLToPath(new URL('./index.ts', import.meta.url))], + bundle: true, + outfile: fileURLToPath(new URL('../.output/server/cli.mjs', import.meta.url)), + platform: 'node', + format: 'esm', + plugins: [ + { + name: 'make-all-packages-external', + setup(build) { + let filter = /^[^./]|^\.[^./]|^\.\.[^/]/; // Must not start with "/" or "./" or "../" + build.onResolve({ filter }, (args) => ({ + path: args.path, + external: true, + })); + }, + }, + ], + logLevel: 'info', +}); diff --git a/src/cli/cli.sh b/src/cli/cli.sh new file mode 100644 index 00000000..4b22186d --- /dev/null +++ b/src/cli/cli.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +node /app/server/cli.mjs "$@" \ No newline at end of file diff --git a/src/cli/index.ts b/src/cli/index.ts new file mode 100644 index 00000000..18c2cbd4 --- /dev/null +++ b/src/cli/index.ts @@ -0,0 +1,92 @@ +#!/usr/bin/env node + +// ! Auto Imports are not supported in this file + +import { drizzle } from 'drizzle-orm/libsql'; +import { createClient } from '@libsql/client'; +import { defineCommand, runMain } from 'citty'; +import { consola } from 'consola'; +import { eq } from 'drizzle-orm'; + +import packageJson from '../package.json'; +import * as schema from '../server/database/schema'; +import { hashPassword } from '../server/utils/password'; + +const client = createClient({ url: 'file:/etc/wireguard/wg-easy.db' }); +const db = drizzle({ client, schema }); + +const dbAdminReset = defineCommand({ + meta: { + name: 'db:admin:reset', + description: 'Reset the admin user', + }, + args: { + password: { + type: 'string', + description: 'New password for the admin user', + required: false, + }, + }, + async run(ctx) { + let password = ctx.args.password || undefined; + if (!password) { + password = await consola.prompt('Please enter a new password:', { + type: 'text', + }); + } + if (!password) { + consola.error('Password is required'); + return; + } + if (password.length < 12) { + consola.error('Password must be at least 12 characters long'); + return; + } + console.info('Setting new password for admin user...'); + const hash = await hashPassword(password); + + const user = await db.transaction(async (tx) => { + const user = await tx + .select() + .from(schema.user) + .where(eq(schema.user.id, 1)) + .get(); + + if (!user) { + consola.error('Admin user not found'); + return; + } + + await tx + .update(schema.user) + .set({ + password: hash, + }) + .where(eq(schema.user.id, 1)); + + return user; + }); + + if (!user) { + consola.error('Failed to update admin user'); + return; + } + + consola.success( + `Successfully updated admin user ${user.id} (${user.username})` + ); + }, +}); + +const main = defineCommand({ + meta: { + name: 'wg-easy', + version: packageJson.version, + description: 'Command Line Interface', + }, + subCommands: { + 'db:admin:reset': dbAdminReset, + }, +}); + +runMain(main); diff --git a/src/nuxt.config.ts b/src/nuxt.config.ts index a91578d2..e07cad71 100644 --- a/src/nuxt.config.ts +++ b/src/nuxt.config.ts @@ -41,6 +41,9 @@ export default defineNuxtConfig({ detectBrowserLanguage: { useCookie: true, }, + bundle: { + optimizeTranslationDirective: false, + }, }, nitro: { esbuild: { @@ -52,6 +55,9 @@ export default defineNuxtConfig({ alias: { '#db': fileURLToPath(new URL('./server/database/', import.meta.url)), }, + externals: { + traceInclude: [fileURLToPath(new URL('./cli/index.ts', import.meta.url))], + }, }, alias: { // for typecheck reasons (https://github.com/nuxt/cli/issues/323) diff --git a/src/package.json b/src/package.json index 8b62d092..9d3caa78 100644 --- a/src/package.json +++ b/src/package.json @@ -5,7 +5,7 @@ "private": true, "type": "module", "scripts": { - "build": "nuxt build", + "build": "nuxt build && pnpm cli:build", "dev": "nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", @@ -15,7 +15,9 @@ "format:check": "prettier . --check", "typecheck": "nuxt typecheck", "check:all": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm build", - "db:generate": "drizzle-kit generate" + "db:generate": "drizzle-kit generate", + "cli:build": "node cli/build.js", + "cli:dev": "tsx cli/index.ts" }, "dependencies": { "@eschricht/nuxt-color-mode": "^1.1.5", @@ -29,6 +31,8 @@ "apexcharts": "^4.5.0", "argon2": "^0.41.1", "cidr-tools": "^11.0.3", + "citty": "^0.1.6", + "consola": "^3.4.2", "crc-32": "^1.2.2", "debug": "^4.4.0", "drizzle-orm": "^0.41.0", @@ -54,10 +58,12 @@ "@types/phc__format": "^1.0.1", "@types/semver": "^7.7.0", "drizzle-kit": "^0.30.6", + "esbuild": "^0.25.2", "eslint": "^9.24.0", "eslint-config-prettier": "^10.1.2", "prettier": "^3.5.3", "prettier-plugin-tailwindcss": "^0.6.11", + "tsx": "^4.19.3", "typescript": "^5.8.3", "vue-tsc": "^2.2.8" }, diff --git a/src/pnpm-lock.yaml b/src/pnpm-lock.yaml index 40c7e85d..a2aadf46 100644 --- a/src/pnpm-lock.yaml +++ b/src/pnpm-lock.yaml @@ -41,6 +41,12 @@ importers: cidr-tools: specifier: ^11.0.3 version: 11.0.3 + citty: + specifier: ^0.1.6 + version: 0.1.6 + consola: + specifier: ^3.4.2 + version: 3.4.2 crc-32: specifier: ^1.2.2 version: 1.2.2 @@ -64,7 +70,7 @@ importers: version: 0.11.0 nuxt: specifier: ^3.16.2 - version: 3.16.2(@libsql/client@0.15.4)(@parcel/watcher@2.5.1)(@types/node@22.14.1)(db0@0.3.1(@libsql/client@0.15.4)(drizzle-orm@0.41.0(@libsql/client@0.15.4)(gel@2.0.2)))(drizzle-orm@0.41.0(@libsql/client@0.15.4)(gel@2.0.2))(eslint@9.24.0(jiti@2.4.2))(ioredis@5.6.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue-tsc@2.2.8(typescript@5.8.3))(yaml@2.7.1) + version: 3.16.2(@libsql/client@0.15.4)(@parcel/watcher@2.5.1)(@types/node@22.14.1)(db0@0.3.1(@libsql/client@0.15.4)(drizzle-orm@0.41.0(@libsql/client@0.15.4)(gel@2.0.2)))(drizzle-orm@0.41.0(@libsql/client@0.15.4)(gel@2.0.2))(eslint@9.24.0(jiti@2.4.2))(ioredis@5.6.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.40.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue-tsc@2.2.8(typescript@5.8.3))(yaml@2.7.1) otpauth: specifier: ^9.4.0 version: 9.4.0 @@ -98,7 +104,7 @@ importers: devDependencies: '@nuxt/eslint': specifier: 1.3.0 - version: 1.3.0(@vue/compiler-sfc@3.5.13)(eslint@9.24.0(jiti@2.4.2))(magicast@0.3.5)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)) + version: 1.3.0(@vue/compiler-sfc@3.5.13)(eslint@9.24.0(jiti@2.4.2))(magicast@0.3.5)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)) '@types/debug': specifier: ^4.1.12 version: 4.1.12 @@ -111,6 +117,9 @@ importers: drizzle-kit: specifier: ^0.30.6 version: 0.30.6 + esbuild: + specifier: ^0.25.2 + version: 0.25.2 eslint: specifier: ^9.24.0 version: 9.24.0(jiti@2.4.2) @@ -123,6 +132,9 @@ importers: prettier-plugin-tailwindcss: specifier: ^0.6.11 version: 0.6.11(prettier@3.5.3) + tsx: + specifier: ^4.19.3 + version: 4.19.3 typescript: specifier: ^5.8.3 version: 5.8.3 @@ -4658,6 +4670,11 @@ packages: resolution: {integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==} engines: {node: '>=0.6.x'} + tsx@4.19.3: + resolution: {integrity: sha512-4H8vUNGNjQ4V2EOoGw005+c+dGuPSnhpPBPHBtsZdGZBk/iJb4kguGlPWaZTZ3q5nMtFOEsY0nRDlh9PJyd6SQ==} + engines: {node: '>=18.0.0'} + hasBin: true + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -5975,12 +5992,12 @@ snapshots: '@nuxt/devalue@2.0.2': {} - '@nuxt/devtools-kit@2.4.0(magicast@0.3.5)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))': + '@nuxt/devtools-kit@2.4.0(magicast@0.3.5)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))': dependencies: '@nuxt/kit': 3.16.2(magicast@0.3.5) '@nuxt/schema': 3.16.2 execa: 8.0.1 - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) transitivePeerDependencies: - magicast @@ -5995,12 +6012,12 @@ snapshots: prompts: 2.4.2 semver: 7.7.1 - '@nuxt/devtools@2.4.0(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': + '@nuxt/devtools@2.4.0(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': dependencies: - '@nuxt/devtools-kit': 2.4.0(magicast@0.3.5)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)) + '@nuxt/devtools-kit': 2.4.0(magicast@0.3.5)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)) '@nuxt/devtools-wizard': 2.4.0 '@nuxt/kit': 3.16.2(magicast@0.3.5) - '@vue/devtools-core': 7.7.2(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) + '@vue/devtools-core': 7.7.2(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) '@vue/devtools-kit': 7.7.2 birpc: 2.3.0 consola: 3.4.2 @@ -6025,9 +6042,9 @@ snapshots: sirv: 3.0.1 structured-clone-es: 1.0.0 tinyglobby: 0.2.12 - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) - vite-plugin-inspect: 11.0.0(@nuxt/kit@3.16.2(magicast@0.3.5))(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)) - vite-plugin-vue-tracer: 0.1.3(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) + vite-plugin-inspect: 11.0.0(@nuxt/kit@3.16.2(magicast@0.3.5))(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)) + vite-plugin-vue-tracer: 0.1.3(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) which: 5.0.0 ws: 8.18.1 transitivePeerDependencies: @@ -6073,10 +6090,10 @@ snapshots: - supports-color - typescript - '@nuxt/eslint@1.3.0(@vue/compiler-sfc@3.5.13)(eslint@9.24.0(jiti@2.4.2))(magicast@0.3.5)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))': + '@nuxt/eslint@1.3.0(@vue/compiler-sfc@3.5.13)(eslint@9.24.0(jiti@2.4.2))(magicast@0.3.5)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))': dependencies: '@eslint/config-inspector': 1.0.2(eslint@9.24.0(jiti@2.4.2)) - '@nuxt/devtools-kit': 2.4.0(magicast@0.3.5)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)) + '@nuxt/devtools-kit': 2.4.0(magicast@0.3.5)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)) '@nuxt/eslint-config': 1.3.0(@vue/compiler-sfc@3.5.13)(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3) '@nuxt/eslint-plugin': 1.3.0(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3) '@nuxt/kit': 3.16.2(magicast@0.3.5) @@ -6150,12 +6167,12 @@ snapshots: transitivePeerDependencies: - magicast - '@nuxt/vite-builder@3.16.2(@types/node@22.14.1)(eslint@9.24.0(jiti@2.4.2))(magicast@0.3.5)(optionator@0.9.4)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(vue-tsc@2.2.8(typescript@5.8.3))(vue@3.5.13(typescript@5.8.3))(yaml@2.7.1)': + '@nuxt/vite-builder@3.16.2(@types/node@22.14.1)(eslint@9.24.0(jiti@2.4.2))(magicast@0.3.5)(optionator@0.9.4)(rollup@4.40.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.3)(vue-tsc@2.2.8(typescript@5.8.3))(vue@3.5.13(typescript@5.8.3))(yaml@2.7.1)': dependencies: '@nuxt/kit': 3.16.2(magicast@0.3.5) '@rollup/plugin-replace': 6.0.2(rollup@4.40.0) - '@vitejs/plugin-vue': 5.2.3(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) - '@vitejs/plugin-vue-jsx': 4.1.2(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) + '@vitejs/plugin-vue': 5.2.3(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) + '@vitejs/plugin-vue-jsx': 4.1.2(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) autoprefixer: 10.4.21(postcss@8.5.3) consola: 3.4.2 cssnano: 7.0.6(postcss@8.5.3) @@ -6181,9 +6198,9 @@ snapshots: ufo: 1.6.1 unenv: 2.0.0-rc.15 unplugin: 2.3.2 - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) - vite-node: 3.1.1(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) - vite-plugin-checker: 0.9.1(eslint@9.24.0(jiti@2.4.2))(optionator@0.9.4)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue-tsc@2.2.8(typescript@5.8.3)) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) + vite-node: 3.1.1(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) + vite-plugin-checker: 0.9.1(eslint@9.24.0(jiti@2.4.2))(optionator@0.9.4)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue-tsc@2.2.8(typescript@5.8.3)) vue: 3.5.13(typescript@5.8.3) vue-bundle-renderer: 2.1.1 transitivePeerDependencies: @@ -6815,19 +6832,19 @@ snapshots: - rollup - supports-color - '@vitejs/plugin-vue-jsx@4.1.2(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': + '@vitejs/plugin-vue-jsx@4.1.2(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': dependencies: '@babel/core': 7.26.10 '@babel/plugin-transform-typescript': 7.27.0(@babel/core@7.26.10) '@vue/babel-plugin-jsx': 1.4.0(@babel/core@7.26.10) - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) vue: 3.5.13(typescript@5.8.3) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@5.2.3(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': + '@vitejs/plugin-vue@5.2.3(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': dependencies: - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) vue: 3.5.13(typescript@5.8.3) '@volar/language-core@2.4.12': @@ -6923,14 +6940,14 @@ snapshots: dependencies: '@vue/devtools-kit': 7.7.2 - '@vue/devtools-core@7.7.2(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': + '@vue/devtools-core@7.7.2(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3))': dependencies: '@vue/devtools-kit': 7.7.2 '@vue/devtools-shared': 7.7.2 mitt: 3.0.1 nanoid: 5.1.5 pathe: 2.0.3 - vite-hot-client: 0.2.4(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)) + vite-hot-client: 0.2.4(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)) vue: 3.5.13(typescript@5.8.3) transitivePeerDependencies: - vite @@ -8852,15 +8869,15 @@ snapshots: dependencies: boolbase: 1.0.0 - nuxt@3.16.2(@libsql/client@0.15.4)(@parcel/watcher@2.5.1)(@types/node@22.14.1)(db0@0.3.1(@libsql/client@0.15.4)(drizzle-orm@0.41.0(@libsql/client@0.15.4)(gel@2.0.2)))(drizzle-orm@0.41.0(@libsql/client@0.15.4)(gel@2.0.2))(eslint@9.24.0(jiti@2.4.2))(ioredis@5.6.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue-tsc@2.2.8(typescript@5.8.3))(yaml@2.7.1): + nuxt@3.16.2(@libsql/client@0.15.4)(@parcel/watcher@2.5.1)(@types/node@22.14.1)(db0@0.3.1(@libsql/client@0.15.4)(drizzle-orm@0.41.0(@libsql/client@0.15.4)(gel@2.0.2)))(drizzle-orm@0.41.0(@libsql/client@0.15.4)(gel@2.0.2))(eslint@9.24.0(jiti@2.4.2))(ioredis@5.6.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.40.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue-tsc@2.2.8(typescript@5.8.3))(yaml@2.7.1): dependencies: '@nuxt/cli': 3.24.1(magicast@0.3.5) '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 2.4.0(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) + '@nuxt/devtools': 2.4.0(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)) '@nuxt/kit': 3.16.2(magicast@0.3.5) '@nuxt/schema': 3.16.2 '@nuxt/telemetry': 2.6.6(magicast@0.3.5) - '@nuxt/vite-builder': 3.16.2(@types/node@22.14.1)(eslint@9.24.0(jiti@2.4.2))(magicast@0.3.5)(optionator@0.9.4)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(vue-tsc@2.2.8(typescript@5.8.3))(vue@3.5.13(typescript@5.8.3))(yaml@2.7.1) + '@nuxt/vite-builder': 3.16.2(@types/node@22.14.1)(eslint@9.24.0(jiti@2.4.2))(magicast@0.3.5)(optionator@0.9.4)(rollup@4.40.0)(terser@5.39.0)(tsx@4.19.3)(typescript@5.8.3)(vue-tsc@2.2.8(typescript@5.8.3))(vue@3.5.13(typescript@5.8.3))(yaml@2.7.1) '@oxc-parser/wasm': 0.60.0 '@unhead/vue': 2.0.5(vue@3.5.13(typescript@5.8.3)) '@vue/shared': 3.5.13 @@ -9932,6 +9949,13 @@ snapshots: tsscmp@1.0.6: {} + tsx@4.19.3: + dependencies: + esbuild: 0.25.2 + get-tsconfig: 4.10.0 + optionalDependencies: + fsevents: 2.3.3 + type-check@0.4.0: dependencies: prelude-ls: 1.2.1 @@ -10127,27 +10151,27 @@ snapshots: vary@1.1.2: {} - vite-dev-rpc@1.0.7(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)): + vite-dev-rpc@1.0.7(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)): dependencies: birpc: 2.3.0 - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) - vite-hot-client: 2.0.4(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) + vite-hot-client: 2.0.4(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)) - vite-hot-client@0.2.4(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)): + vite-hot-client@0.2.4(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)): dependencies: - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) - vite-hot-client@2.0.4(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)): + vite-hot-client@2.0.4(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)): dependencies: - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) - vite-node@3.1.1(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1): + vite-node@3.1.1(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1): dependencies: cac: 6.7.14 debug: 4.4.0 es-module-lexer: 1.6.0 pathe: 2.0.3 - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) transitivePeerDependencies: - '@types/node' - jiti @@ -10162,7 +10186,7 @@ snapshots: - tsx - yaml - vite-plugin-checker@0.9.1(eslint@9.24.0(jiti@2.4.2))(optionator@0.9.4)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue-tsc@2.2.8(typescript@5.8.3)): + vite-plugin-checker@0.9.1(eslint@9.24.0(jiti@2.4.2))(optionator@0.9.4)(typescript@5.8.3)(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue-tsc@2.2.8(typescript@5.8.3)): dependencies: '@babel/code-frame': 7.26.2 chokidar: 4.0.3 @@ -10172,7 +10196,7 @@ snapshots: strip-ansi: 7.1.0 tiny-invariant: 1.3.3 tinyglobby: 0.2.12 - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) vscode-uri: 3.1.0 optionalDependencies: eslint: 9.24.0(jiti@2.4.2) @@ -10180,7 +10204,7 @@ snapshots: typescript: 5.8.3 vue-tsc: 2.2.8(typescript@5.8.3) - vite-plugin-inspect@11.0.0(@nuxt/kit@3.16.2(magicast@0.3.5))(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)): + vite-plugin-inspect@11.0.0(@nuxt/kit@3.16.2(magicast@0.3.5))(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)): dependencies: ansis: 3.17.0 debug: 4.4.0 @@ -10190,24 +10214,24 @@ snapshots: perfect-debounce: 1.0.0 sirv: 3.0.1 unplugin-utils: 0.2.4 - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) - vite-dev-rpc: 1.0.7(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1)) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) + vite-dev-rpc: 1.0.7(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1)) optionalDependencies: '@nuxt/kit': 3.16.2(magicast@0.3.5) transitivePeerDependencies: - supports-color - vite-plugin-vue-tracer@0.1.3(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)): + vite-plugin-vue-tracer@0.1.3(vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1))(vue@3.5.13(typescript@5.8.3)): dependencies: estree-walker: 3.0.3 exsolve: 1.0.4 magic-string: 0.30.17 pathe: 2.0.3 source-map-js: 1.2.1 - vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1) + vite: 6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1) vue: 3.5.13(typescript@5.8.3) - vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(yaml@2.7.1): + vite@6.2.6(@types/node@22.14.1)(jiti@2.4.2)(terser@5.39.0)(tsx@4.19.3)(yaml@2.7.1): dependencies: esbuild: 0.25.2 postcss: 8.5.3 @@ -10217,6 +10241,7 @@ snapshots: fsevents: 2.3.3 jiti: 2.4.2 terser: 5.39.0 + tsx: 4.19.3 yaml: 2.7.1 vscode-uri@3.1.0: {} diff --git a/src/server/utils/password.ts b/src/server/utils/password.ts index 11ce37e4..915795c7 100644 --- a/src/server/utils/password.ts +++ b/src/server/utils/password.ts @@ -1,3 +1,5 @@ +// ! Auto Imports are not supported in this file + import argon2 from 'argon2'; import { deserialize } from '@phc/format';