Browse Source

replaces debug with obug

reverts unenv patch
pull/2619/head
Bernd Storath 3 weeks ago
parent
commit
f5501e14ae
  1. 1
      Dockerfile
  2. 1
      Dockerfile.dev
  3. 3
      src/package.json
  4. 23
      src/patches/unenv.patch
  5. 30
      src/pnpm-lock.yaml
  6. 2
      src/pnpm-workspace.yaml
  7. 4
      src/server/database/sqlite.ts
  8. 4
      src/server/utils/WireGuard.ts
  9. 4
      src/server/utils/cmd.ts
  10. 4
      src/server/utils/config.ts
  11. 4
      src/server/utils/firewall.ts

1
Dockerfile

@ -8,7 +8,6 @@ RUN corepack enable pnpm
# Copy Web UI
COPY src/package.json src/pnpm-lock.yaml src/pnpm-workspace.yaml ./
COPY src/patches ./patches
RUN pnpm install
# Build UI

1
Dockerfile.dev

@ -33,7 +33,6 @@ ENV DISABLE_IPV6=false
# Install Dependencies
COPY src/package.json src/pnpm-lock.yaml src/pnpm-workspace.yaml ./
COPY src/patches ./patches
RUN pnpm install
# Copy Project

3
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",

23
src/patches/unenv.patch

@ -1,23 +0,0 @@
diff --git a/dist/runtime/npm/debug.mjs b/dist/runtime/npm/debug.mjs
index 62fa13e3a5e96ee835dfe7363e7451e987ef11bc..85b923f5f5597519486b5a11604af6dbfadb0a0d 100644
--- a/dist/runtime/npm/debug.mjs
+++ b/dist/runtime/npm/debug.mjs
@@ -1,7 +1,17 @@
function createDebug(namespace) {
return Object.assign((...args) => {
const env = globalThis.process?.env.DEBUG;
- if (!env || env !== "*" && !env.startsWith(namespace)) return;
+ if (!env) return;
+ if (env !== "*") {
+ const patterns = env.split(",").map((n) => n.trim());
+ const isMatch = patterns.some((pattern) => {
+ if (pattern.endsWith("*")) {
+ return namespace.startsWith(pattern.slice(0, -1));
+ }
+ return pattern === namespace;
+ });
+ if (!isMatch) return;
+ }
console.debug(...args);
}, {
color: "#000000",

30
src/pnpm-lock.yaml

@ -4,9 +4,6 @@ settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
patchedDependencies:
unenv: 0caa5c5d7b4e6f60d88785861150e490da5445d2c6f3b33d505962721162b87d
importers:
.:
@ -59,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/[email protected])
@ -80,6 +74,9 @@ importers:
nuxt:
specifier: ^3.21.5
version: 3.21.5(@libsql/[email protected])(@parcel/[email protected])(@types/[email protected])(@vue/[email protected])([email protected])([email protected](@libsql/[email protected])([email protected](@libsql/[email protected])))([email protected](@libsql/[email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))([email protected])
obug:
specifier: ^2.1.1
version: 2.1.1
otpauth:
specifier: ^9.5.1
version: 9.5.1
@ -117,9 +114,6 @@ importers:
'@nuxt/test-utils':
specifier: ^4.0.3
version: 4.0.3(@vitest/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])
'@types/debug':
specifier: ^4.1.13
version: 4.1.13
'@types/phc__format':
specifier: ^1.0.1
version: 1.0.1
@ -2513,9 +2507,6 @@ packages:
'@types/[email protected]':
resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
'@types/[email protected]':
resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==}
'@types/[email protected]':
resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
@ -2534,9 +2525,6 @@ packages:
'@types/[email protected]':
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
'@types/[email protected]':
resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
'@types/[email protected]':
resolution: {integrity: sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ==}
@ -7742,7 +7730,7 @@ snapshots:
seroval: 1.5.4
std-env: 4.1.0
ufo: 1.6.4
unenv: 2.0.0-rc.24(patch_hash=0caa5c5d7b4e6f60d88785861150e490da5445d2c6f3b33d505962721162b87d)
unenv: 2.0.0-rc.24
vite: 7.3.3(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
vite-node: 5.3.0(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
vite-plugin-checker: 0.13.0([email protected]([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))
@ -8480,10 +8468,6 @@ snapshots:
'@types/deep-eql': 4.0.2
assertion-error: 2.0.1
'@types/[email protected]':
dependencies:
'@types/ms': 2.1.0
'@types/[email protected]': {}
'@types/[email protected]': {}
@ -8496,8 +8480,6 @@ snapshots:
'@types/[email protected]': {}
'@types/[email protected]': {}
'@types/[email protected]':
dependencies:
undici-types: 7.24.6
@ -10853,7 +10835,7 @@ snapshots:
ultrahtml: 1.6.0
uncrypto: 0.1.3
unctx: 2.5.0
unenv: 2.0.0-rc.24(patch_hash=0caa5c5d7b4e6f60d88785861150e490da5445d2c6f3b33d505962721162b87d)
unenv: 2.0.0-rc.24
unimport: 6.3.0([email protected])
unplugin-utils: 0.3.1
unstorage: 1.17.5([email protected](@libsql/[email protected])([email protected](@libsql/[email protected])))([email protected])
@ -12178,7 +12160,7 @@ snapshots:
[email protected]: {}
[email protected](patch_hash=0caa5c5d7b4e6f60d88785861150e490da5445d2c6f3b33d505962721162b87d):
[email protected]:
dependencies:
pathe: 2.0.3

2
src/pnpm-workspace.yaml

@ -4,5 +4,3 @@ allowBuilds:
esbuild: false
unrs-resolver: false
vue-demi: false
patchedDependencies:
unenv: patches/unenv.patch

4
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 });

4
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;

4
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,

4
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 */

4
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

Loading…
Cancel
Save