diff --git a/Dockerfile b/Dockerfile index b217477f..5cf0a8d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,7 +72,7 @@ RUN update-alternatives --install /usr/sbin/iptables iptables /usr/sbin/iptables RUN update-alternatives --install /usr/sbin/ip6tables ip6tables /usr/sbin/ip6tables-legacy 10 --slave /usr/sbin/ip6tables-restore ip6tables-restore /usr/sbin/ip6tables-legacy-restore --slave /usr/sbin/ip6tables-save ip6tables-save /usr/sbin/ip6tables-legacy-save # Set Environment -ENV DEBUG=Server,WireGuard,Database,CMD +ENV DEBUG=Server,WireGuard,Database,CMD,Firewall ENV PORT=51821 ENV HOST=0.0.0.0 ENV INSECURE=false diff --git a/Dockerfile.dev b/Dockerfile.dev index e6f50045..428e0368 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -24,7 +24,7 @@ RUN update-alternatives --install /usr/sbin/iptables iptables /usr/sbin/iptables RUN update-alternatives --install /usr/sbin/ip6tables ip6tables /usr/sbin/ip6tables-legacy 10 --slave /usr/sbin/ip6tables-restore ip6tables-restore /usr/sbin/ip6tables-legacy-restore --slave /usr/sbin/ip6tables-save ip6tables-save /usr/sbin/ip6tables-legacy-save # Set Environment -ENV DEBUG=Server,WireGuard,Database,CMD +ENV DEBUG=Server,WireGuard,Database,CMD,Firewall ENV PORT=51821 ENV HOST=0.0.0.0 ENV INSECURE=true diff --git a/src/package.json b/src/package.json index 5b6eddb5..091627ac 100644 --- a/src/package.json +++ b/src/package.json @@ -37,13 +37,13 @@ "citty": "^0.2.2", "consola": "^3.4.2", "crc-32": "^1.2.2", - "debug": "^4.4.3", "drizzle-orm": "^0.45.2", "ip-bigint": "^9.0.4", "is-cidr": "^7.0.0", "is-ip": "^5.0.1", "js-sha256": "^0.11.1", "nuxt": "^3.21.5", + "obug": "^2.1.1", "otpauth": "^9.5.1", "pinia": "^3.0.4", "qr": "^0.6.0", @@ -58,7 +58,6 @@ "devDependencies": { "@nuxt/eslint": "^1.15.2", "@nuxt/test-utils": "^4.0.3", - "@types/debug": "^4.1.13", "@types/phc__format": "^1.0.1", "@types/semver": "^7.7.1", "@vitest/coverage-v8": "^4.1.6", diff --git a/src/pnpm-lock.yaml b/src/pnpm-lock.yaml index f8ab0dfa..26a0704a 100644 --- a/src/pnpm-lock.yaml +++ b/src/pnpm-lock.yaml @@ -56,9 +56,6 @@ importers: crc-32: specifier: ^1.2.2 version: 1.2.2 - debug: - specifier: ^4.4.3 - version: 4.4.3 drizzle-orm: specifier: ^0.45.2 version: 0.45.2(@libsql/client@0.17.3) @@ -77,6 +74,9 @@ importers: nuxt: specifier: ^3.21.5 version: 3.21.5(@libsql/client@0.17.3)(@parcel/watcher@2.5.6)(@types/node@25.8.0)(@vue/compiler-sfc@3.5.34)(cac@6.7.14)(db0@0.3.4(@libsql/client@0.17.3)(drizzle-orm@0.45.2(@libsql/client@0.17.3)))(drizzle-orm@0.45.2(@libsql/client@0.17.3))(eslint@9.39.4(jiti@1.21.7))(ioredis@5.10.1)(magicast@0.5.3)(optionator@0.9.4)(rollup-plugin-visualizer@7.0.1(rollup@4.60.4))(rollup@4.60.4)(srvx@0.11.15)(terser@5.47.1)(tsx@4.22.1)(typescript@6.0.3)(vite@7.3.3(@types/node@25.8.0)(jiti@1.21.7)(terser@5.47.1)(tsx@4.22.1)(yaml@2.9.0))(vue-tsc@3.2.9(typescript@6.0.3))(yaml@2.9.0) + obug: + specifier: ^2.1.1 + version: 2.1.1 otpauth: specifier: ^9.5.1 version: 9.5.1 @@ -114,9 +114,6 @@ importers: '@nuxt/test-utils': specifier: ^4.0.3 version: 4.0.3(@vitest/ui@4.1.6)(crossws@0.4.5(srvx@0.11.15))(magicast@0.5.3)(typescript@6.0.3)(vite@7.3.3(@types/node@25.8.0)(jiti@1.21.7)(terser@5.47.1)(tsx@4.22.1)(yaml@2.9.0))(vitest@4.1.6) - '@types/debug': - specifier: ^4.1.13 - version: 4.1.13 '@types/phc__format': specifier: ^1.0.1 version: 1.0.1 @@ -2510,9 +2507,6 @@ packages: '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} - '@types/debug@4.1.13': - resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==} - '@types/deep-eql@4.0.2': resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} @@ -2531,9 +2525,6 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/ms@2.1.0': - resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} - '@types/node@25.8.0': resolution: {integrity: sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ==} @@ -8477,10 +8468,6 @@ snapshots: '@types/deep-eql': 4.0.2 assertion-error: 2.0.1 - '@types/debug@4.1.13': - dependencies: - '@types/ms': 2.1.0 - '@types/deep-eql@4.0.2': {} '@types/esrecurse@4.3.1': {} @@ -8493,8 +8480,6 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/ms@2.1.0': {} - '@types/node@25.8.0': dependencies: undici-types: 7.24.6 diff --git a/src/server/database/sqlite.ts b/src/server/database/sqlite.ts index bae94133..4b0f6723 100644 --- a/src/server/database/sqlite.ts +++ b/src/server/database/sqlite.ts @@ -1,7 +1,7 @@ import { drizzle } from 'drizzle-orm/libsql'; import { migrate as drizzleMigrate } from 'drizzle-orm/libsql/migrator'; import { createClient } from '@libsql/client'; -import debug from 'debug'; +import { createDebug } from 'obug'; import { eq } from 'drizzle-orm'; import * as schema from './schema'; @@ -13,7 +13,7 @@ import { InterfaceService } from './repositories/interface/service'; import { HooksService } from './repositories/hooks/service'; import { OneTimeLinkService } from './repositories/oneTimeLink/service'; -const DB_DEBUG = debug('Database'); +const DB_DEBUG = createDebug('Database'); const client = createClient({ url: 'file:/etc/wireguard/wg-easy.db' }); const db = drizzle({ client, schema }); diff --git a/src/server/utils/WireGuard.ts b/src/server/utils/WireGuard.ts index b5f0dd42..9ffc8ccb 100644 --- a/src/server/utils/WireGuard.ts +++ b/src/server/utils/WireGuard.ts @@ -1,8 +1,8 @@ import fs from 'node:fs/promises'; -import debug from 'debug'; +import { createDebug } from 'obug'; import type { InterfaceType } from '#db/repositories/interface/types'; -const WG_DEBUG = debug('WireGuard'); +const WG_DEBUG = createDebug('WireGuard'); const generateRandomHeaderValue = () => Math.floor(Math.random() * 2147483642) + 5; diff --git a/src/server/utils/cmd.ts b/src/server/utils/cmd.ts index 6fd4ad9b..70c979c9 100644 --- a/src/server/utils/cmd.ts +++ b/src/server/utils/cmd.ts @@ -1,7 +1,7 @@ import childProcess from 'child_process'; -import debug from 'debug'; +import { createDebug } from 'obug'; -const CMD_DEBUG = debug('CMD'); +const CMD_DEBUG = createDebug('CMD'); export function exec( cmd: string, diff --git a/src/server/utils/config.ts b/src/server/utils/config.ts index 322b7ae6..1c5b2081 100644 --- a/src/server/utils/config.ts +++ b/src/server/utils/config.ts @@ -1,9 +1,9 @@ -import debug from 'debug'; +import { createDebug } from 'obug'; import packageJson from '@@/package.json'; export const RELEASE = 'v' + packageJson.version; -export const SERVER_DEBUG = debug('Server'); +export const SERVER_DEBUG = createDebug('Server'); export const OLD_ENV = { /** @deprecated Only for migration purposes */ diff --git a/src/server/utils/firewall.ts b/src/server/utils/firewall.ts index 95f50414..76ad1c64 100644 --- a/src/server/utils/firewall.ts +++ b/src/server/utils/firewall.ts @@ -1,11 +1,11 @@ -import debug from 'debug'; +import { createDebug } from 'obug'; import { isIPv6 } from 'is-ip'; import type { ClientType } from '#db/repositories/client/types'; import type { InterfaceType } from '#db/repositories/interface/types'; import type { UserConfigType } from '#db/repositories/userConfig/types'; -const FW_DEBUG = debug('Firewall'); +const FW_DEBUG = createDebug('Firewall'); const CHAIN_NAME = 'WG_CLIENTS'; // Mutex to prevent concurrent rule rebuilds