Browse Source

add prettier eslint config

pull/1250/head
Bernd Storath 9 months ago
parent
commit
bc73d54a9d
  1. 3
      src/eslint.config.mjs
  2. 1
      src/package.json
  3. 16
      src/pnpm-lock.yaml
  4. 14
      src/server/utils/WireGuard.ts

3
src/eslint.config.mjs

@ -1,3 +1,4 @@
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'; import { createConfigForNuxt } from '@nuxt/eslint-config/flat';
import eslintConfigPrettier from 'eslint-config-prettier';
export default createConfigForNuxt({}); export default createConfigForNuxt().append(eslintConfigPrettier);

1
src/package.json

@ -35,6 +35,7 @@
"@types/debug": "^4.1.12", "@types/debug": "^4.1.12",
"@types/qrcode": "^1.5.5", "@types/qrcode": "^1.5.5",
"eslint": "^9.8.0", "eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"typescript": "^5.5.4", "typescript": "^5.5.4",
"vue-tsc": "^2.0.29" "vue-tsc": "^2.0.29"

16
src/pnpm-lock.yaml

@ -56,6 +56,9 @@ importers:
eslint: eslint:
specifier: ^9.8.0 specifier: ^9.8.0
version: 9.8.0 version: 9.8.0
eslint-config-prettier:
specifier: ^9.1.0
version: 9.1.0([email protected])
prettier: prettier:
specifier: ^3.3.3 specifier: ^3.3.3
version: 3.3.3 version: 3.3.3
@ -3458,6 +3461,15 @@ packages:
integrity: sha512-OEUbS2wzzYtUfshjOqzFo4Bl4lHykXUdM08TCnYNl7ki+niW4Q1R0j0FDFDr0vjVsI5ZFOz5LvluxOP+Ew+dYw==, integrity: sha512-OEUbS2wzzYtUfshjOqzFo4Bl4lHykXUdM08TCnYNl7ki+niW4Q1R0j0FDFDr0vjVsI5ZFOz5LvluxOP+Ew+dYw==,
} }
[email protected]:
resolution:
{
integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==,
}
hasBin: true
peerDependencies:
eslint: '>=7.0.0'
[email protected]: [email protected]:
resolution: resolution:
{ {
@ -9631,6 +9643,10 @@ snapshots:
find-up-simple: 1.0.0 find-up-simple: 1.0.0
parse-gitignore: 2.0.0 parse-gitignore: 2.0.0
[email protected]([email protected]):
dependencies:
eslint: 9.8.0
[email protected]: [email protected]:
dependencies: dependencies:
'@types/eslint': 9.6.0 '@types/eslint': 9.6.0

14
src/server/utils/WireGuard.ts

@ -73,7 +73,7 @@ class WireGuard {
const config = await this.__buildConfig(); const config = await this.__buildConfig();
await this.__saveConfig(config); await this.__saveConfig(config);
await exec('wg-quick down wg0').catch(() => { }); await exec('wg-quick down wg0').catch(() => {});
await exec('wg-quick up wg0').catch((err) => { await exec('wg-quick up wg0').catch((err) => {
if ( if (
err && err &&
@ -125,8 +125,9 @@ PostDown = ${WG_POST_DOWN}
# Client: ${client.name} (${clientId}) # Client: ${client.name} (${clientId})
[Peer] [Peer]
PublicKey = ${client.publicKey} PublicKey = ${client.publicKey}
${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' ${
}AllowedIPs = ${client.address}/32`; client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : ''
}AllowedIPs = ${client.address}/32`;
} }
debug('Config saving...'); debug('Config saving...');
@ -227,8 +228,9 @@ ${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\
[Peer] [Peer]
PublicKey = ${config.server.publicKey} PublicKey = ${config.server.publicKey}
${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' ${
}AllowedIPs = ${WG_ALLOWED_IPS} client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : ''
}AllowedIPs = ${WG_ALLOWED_IPS}
PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE} PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE}
Endpoint = ${WG_HOST}:${WG_CONFIG_PORT}`; Endpoint = ${WG_HOST}:${WG_CONFIG_PORT}`;
} }
@ -378,7 +380,7 @@ Endpoint = ${WG_HOST}:${WG_CONFIG_PORT}`;
// Shutdown wireguard // Shutdown wireguard
async Shutdown() { async Shutdown() {
await exec('wg-quick down wg0').catch(() => { }); await exec('wg-quick down wg0').catch(() => {});
} }
} }

Loading…
Cancel
Save