From e8a160b14ff05444ea3066abdd205ab9d33398f2 Mon Sep 17 00:00:00 2001 From: cany748 Date: Wed, 28 Feb 2024 15:48:09 +0700 Subject: [PATCH 001/115] refactor!: migrate from express to h3 --- src/lib/Server.js | 217 ++++++++++++++++++++++++++--------------- src/lib/ServerError.js | 10 -- src/package-lock.json | 115 ++++++++++++++++++++++ src/package.json | 1 + src/www/index.html | 3 +- 5 files changed, 256 insertions(+), 90 deletions(-) delete mode 100644 src/lib/ServerError.js diff --git a/src/lib/Server.js b/src/lib/Server.js index 1f00a6b4..82ab94e7 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -1,15 +1,27 @@ 'use strict'; -const path = require('path'); const bcrypt = require('bcryptjs'); const crypto = require('node:crypto'); +const { createServer } = require('node:http'); +const { stat, readFile } = require('node:fs/promises'); +const { join } = require('node:path'); -const express = require('express'); const expressSession = require('express-session'); const debug = require('debug')('Server'); -const Util = require('./Util'); -const ServerError = require('./ServerError'); +const { + createApp, + createError, + createRouter, + defineEventHandler, + fromNodeMiddleware, + getRouterParam, + toNodeListener, + readBody, + setHeader, + serveStatic, +} = require('h3'); + const WireGuard = require('../services/WireGuard'); const { @@ -23,33 +35,39 @@ const { module.exports = class Server { constructor() { - // Express - this.app = express() - .disable('etag') - .use('/', express.static(path.join(__dirname, '..', 'www'))) - .use(express.json()) - .use(expressSession({ - secret: crypto.randomBytes(256).toString('hex'), - resave: true, - saveUninitialized: true, - cookie: { - httpOnly: true, - }, - })) + const app = createApp(); + this.app = app; + + app.use(fromNodeMiddleware(expressSession({ + secret: crypto.randomBytes(256).toString('hex'), + resave: true, + saveUninitialized: true, + cookie: { + httpOnly: true, + }, + }))); + + const router = createRouter(); + app.use(router); + + router + .get('/api/release', defineEventHandler((event) => { + setHeader(event, 'Content-Type', 'application/json'); - .get('/api/release', (Util.promisify(async () => { return RELEASE; - }))) + })) - .get('/api/lang', (Util.promisify(async () => { - return LANG; - }))) + .get('/api/lang', defineEventHandler((event) => { + setHeader(event, 'Content-Type', 'application/json'); + + return `"${LANG}"`; + })) // Authentication - .get('/api/session', Util.promisify(async (req) => { + .get('/api/session', defineEventHandler((event) => { const requiresPassword = !!process.env.PASSWORD; const authenticated = requiresPassword - ? !!(req.session && req.session.authenticated) + ? !!(event.node.req.session && event.node.req.session.authenticated) : true; return { @@ -57,28 +75,35 @@ module.exports = class Server { authenticated, }; })) - .post('/api/session', Util.promisify(async (req) => { - const { - password, - } = req.body; + .post('/api/session', defineEventHandler(async (event) => { + const { password } = await readBody(event); if (typeof password !== 'string') { - throw new ServerError('Missing: Password', 401); + throw createError({ + status: 401, + message: 'Missing: Password', + }); } if (password !== PASSWORD) { - throw new ServerError('Incorrect Password', 401); + throw createError({ + status: 401, + message: 'Incorrect Password', + }); } - req.session.authenticated = true; - req.session.save(); + event.node.req.session.authenticated = true; + event.node.req.session.save(); - debug(`New Session: ${req.session.id}`); - })) + debug(`New Session: ${event.node.req.session.id}`); + + return { succcess: true }; + })); // WireGuard - .use((req, res, next) => { - if (!PASSWORD) { + app.use( + fromNodeMiddleware((req, res, next) => { + if (!PASSWORD || !req.url.startsWith('/api/')) { return next(); } @@ -86,7 +111,7 @@ module.exports = class Server { return next(); } - if (req.path.startsWith('/api/') && req.headers['authorization']) { + if (req.url.startsWith('/api/') && req.headers['authorization']) { if (bcrypt.compareSync(req.headers['authorization'], bcrypt.hashSync(PASSWORD, 10))) { return next(); } @@ -98,25 +123,32 @@ module.exports = class Server { return res.status(401).json({ error: 'Not Logged In', }); - }) - .delete('/api/session', Util.promisify(async (req) => { - const sessionId = req.session.id; + }), + ); - req.session.destroy(); + const router2 = createRouter(); + app.use(router2); + + router2 + .delete('/api/session', defineEventHandler((event) => { + const sessionId = event.node.req.session.id; + + event.node.req.session.destroy(); debug(`Deleted Session: ${sessionId}`); + return { success: true }; })) - .get('/api/wireguard/client', Util.promisify(async (req) => { + .get('/api/wireguard/client', defineEventHandler(() => { return WireGuard.getClients(); })) - .get('/api/wireguard/client/:clientId/qrcode.svg', Util.promisify(async (req, res) => { - const { clientId } = req.params; + .get('/api/wireguard/client/:clientId/qrcode.svg', defineEventHandler(async (event) => { + const clientId = getRouterParam(event, 'clientId'); const svg = await WireGuard.getClientQRCodeSVG({ clientId }); - res.header('Content-Type', 'image/svg+xml'); - res.send(svg); + setHeader(event, 'Content-Type', 'image/svg+xml'); + return svg; })) - .get('/api/wireguard/client/:clientId/configuration', Util.promisify(async (req, res) => { - const { clientId } = req.params; + .get('/api/wireguard/client/:clientId/configuration', defineEventHandler(async (event) => { + const clientId = getRouterParam(event, 'clientId'); const client = await WireGuard.getClient({ clientId }); const config = await WireGuard.getClientConfiguration({ clientId }); const configName = client.name @@ -124,52 +156,79 @@ module.exports = class Server { .replace(/(-{2,}|-$)/g, '-') .replace(/-$/, '') .substring(0, 32); - res.header('Content-Disposition', `attachment; filename="${configName || clientId}.conf"`); - res.header('Content-Type', 'text/plain'); - res.send(config); + setHeader(event, 'Content-Disposition', `attachment; filename="${configName || clientId}.conf"`); + setHeader(event, 'Content-Type', 'text/plain'); + return config; })) - .post('/api/wireguard/client', Util.promisify(async (req) => { - const { name } = req.body; - return WireGuard.createClient({ name }); + .post('/api/wireguard/client', defineEventHandler(async (event) => { + const { name } = await readBody(event); + await WireGuard.createClient({ name }); + return { success: true }; })) - .delete('/api/wireguard/client/:clientId', Util.promisify(async (req) => { - const { clientId } = req.params; - return WireGuard.deleteClient({ clientId }); + .delete('/api/wireguard/client/:clientId', defineEventHandler(async (event) => { + const clientId = getRouterParam(event, 'clientId'); + await WireGuard.deleteClient({ clientId }); + return { success: true }; })) - .post('/api/wireguard/client/:clientId/enable', Util.promisify(async (req, res) => { - const { clientId } = req.params; + .post('/api/wireguard/client/:clientId/enable', defineEventHandler(async (event) => { + const clientId = getRouterParam(event, 'clientId'); if (clientId === '__proto__' || clientId === 'constructor' || clientId === 'prototype') { - res.end(403); + throw createError({ status: 403 }); } - return WireGuard.enableClient({ clientId }); + await WireGuard.enableClient({ clientId }); + return { success: true }; })) - .post('/api/wireguard/client/:clientId/disable', Util.promisify(async (req, res) => { - const { clientId } = req.params; + .post('/api/wireguard/client/:clientId/disable', defineEventHandler(async (event) => { + const clientId = getRouterParam(event, 'clientId'); if (clientId === '__proto__' || clientId === 'constructor' || clientId === 'prototype') { - res.end(403); + throw createError({ status: 403 }); } - return WireGuard.disableClient({ clientId }); + await WireGuard.disableClient({ clientId }); + return { success: true }; })) - .put('/api/wireguard/client/:clientId/name', Util.promisify(async (req, res) => { - const { clientId } = req.params; + .put('/api/wireguard/client/:clientId/name', defineEventHandler(async (event) => { + const clientId = getRouterParam(event, 'clientId'); if (clientId === '__proto__' || clientId === 'constructor' || clientId === 'prototype') { - res.end(403); + throw createError({ status: 403 }); } - const { name } = req.body; - return WireGuard.updateClientName({ clientId, name }); + const { name } = await readBody(event); + await WireGuard.updateClientName({ clientId, name }); + return { success: true }; })) - .put('/api/wireguard/client/:clientId/address', Util.promisify(async (req, res) => { - const { clientId } = req.params; + .put('/api/wireguard/client/:clientId/address', defineEventHandler(async (event) => { + const clientId = getRouterParam(event, 'clientId'); if (clientId === '__proto__' || clientId === 'constructor' || clientId === 'prototype') { - res.end(403); + throw createError({ status: 403 }); } - const { address } = req.body; - return WireGuard.updateClientAddress({ clientId, address }); - })) + const { address } = await readBody(event); + await WireGuard.updateClientAddress({ clientId, address }); + return { success: true }; + })); + + // Static assets + const publicDir = 'www'; + app.use( + defineEventHandler((event) => { + return serveStatic(event, { + getContents: (id) => readFile(join(publicDir, id)), + getMeta: async (id) => { + const stats = await stat(join(publicDir, id)).catch(() => {}); + + if (!stats || !stats.isFile()) { + return; + } + + return { + size: stats.size, + mtime: stats.mtimeMs, + }; + }, + }); + }), + ); - .listen(PORT, WEBUI_HOST, () => { - debug(`Listening on http://${WEBUI_HOST}:${PORT}`); - }); + createServer(toNodeListener(app)).listen(PORT, WEBUI_HOST); + debug(`Listening on http://${WEBUI_HOST}:${PORT}`); } }; diff --git a/src/lib/ServerError.js b/src/lib/ServerError.js deleted file mode 100644 index 1e567f4b..00000000 --- a/src/lib/ServerError.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = class ServerError extends Error { - - constructor(message, statusCode = 500) { - super(message); - this.statusCode = statusCode; - } - -}; diff --git a/src/package-lock.json b/src/package-lock.json index 2c23b2ee..d72da391 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -13,6 +13,7 @@ "debug": "^4.3.4", "express": "^4.18.2", "express-session": "^1.18.0", + "h3": "^1.11.1", "qrcode": "^1.5.3", "uuid": "^9.0.1" }, @@ -1200,6 +1201,14 @@ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", "dev": true }, + "node_modules/consola": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz", + "integrity": "sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -1227,6 +1236,11 @@ "node": ">= 0.6" } }, + "node_modules/cookie-es": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.0.0.tgz", + "integrity": "sha512-mWYvfOLrfEc996hlKcdABeIiPHUPC6DM2QYZdGGOvhOTbA3tjm2eBwqlJpoFdjC89NI4Qt6h0Pu06Mp+1Pj5OQ==" + }, "node_modules/cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", @@ -1246,6 +1260,19 @@ "node": ">= 8" } }, + "node_modules/crossws": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.2.4.tgz", + "integrity": "sha512-DAxroI2uSOgUKLz00NX6A8U/8EE3SZHmIND+10jkVSaypvyt57J5JEOxAQOL6lQxyzi/wZbTIwssU1uy69h5Vg==", + "peerDependencies": { + "uWebSockets.js": "*" + }, + "peerDependenciesMeta": { + "uWebSockets.js": { + "optional": true + } + } + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -1322,6 +1349,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/defu": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", + "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==" + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -1330,6 +1362,11 @@ "node": ">= 0.8" } }, + "node_modules/destr": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.3.tgz", + "integrity": "sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==" + }, "node_modules/destroy": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", @@ -2623,6 +2660,23 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "node_modules/h3": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.11.1.tgz", + "integrity": "sha512-AbaH6IDnZN6nmbnJOH72y3c5Wwh9P97soSVdGSBbcDACRdkC0FEWf25pzx4f/NuOCK6quHmW18yF2Wx+G4Zi1A==", + "dependencies": { + "cookie-es": "^1.0.0", + "crossws": "^0.2.2", + "defu": "^6.1.4", + "destr": "^2.0.3", + "iron-webcrypto": "^1.0.0", + "ohash": "^1.1.3", + "radix3": "^1.1.0", + "ufo": "^1.4.0", + "uncrypto": "^0.1.3", + "unenv": "^1.9.0" + } + }, "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", @@ -2801,6 +2855,14 @@ "node": ">= 0.10" } }, + "node_modules/iron-webcrypto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.0.0.tgz", + "integrity": "sha512-anOK1Mktt8U1Xi7fCM3RELTuYbnFikQY5VtrDj7kPgpejV7d43tWKhzgioO0zpkazLEL/j/iayRqnJhrGfqUsg==", + "funding": { + "url": "https://github.com/sponsors/brc-dd" + } + }, "node_modules/is-array-buffer": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", @@ -3372,6 +3434,11 @@ "node": ">= 0.6" } }, + "node_modules/node-fetch-native": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.2.tgz", + "integrity": "sha512-69mtXOFZ6hSkYiXAVB5SqaRvrbITC/NPyqv7yuu/qw0nmgPyYbIMYYNIDhNtwPrzk0ptrimrLz/hhjvm4w5Z+w==" + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -3495,6 +3562,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ohash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.3.tgz", + "integrity": "sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==" + }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -3668,6 +3740,11 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==" + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -3963,6 +4040,11 @@ } ] }, + "node_modules/radix3": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.0.tgz", + "integrity": "sha512-pNsHDxbGORSvuSScqNJ+3Km6QAVqk8CfsCBIEoDgpqLrkD2f3QM4I7d1ozJJ172OmIcoUcerZaNWqtLkRXTV3A==" + }, "node_modules/ramda": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.2.tgz", @@ -4888,6 +4970,11 @@ "node": ">=4.2.0" } }, + "node_modules/ufo": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.4.0.tgz", + "integrity": "sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==" + }, "node_modules/uid-safe": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", @@ -4914,6 +5001,34 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/uncrypto": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz", + "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==" + }, + "node_modules/unenv": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/unenv/-/unenv-1.9.0.tgz", + "integrity": "sha512-QKnFNznRxmbOF1hDgzpqrlIf6NC5sbZ2OJ+5Wl3OX8uM+LUJXbj4TXvLJCtwbPTmbMHCLIz6JLKNinNsMShK9g==", + "dependencies": { + "consola": "^3.2.3", + "defu": "^6.1.3", + "mime": "^3.0.0", + "node-fetch-native": "^1.6.1", + "pathe": "^1.1.1" + } + }, + "node_modules/unenv/node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", diff --git a/src/package.json b/src/package.json index 68056acb..585a40c9 100644 --- a/src/package.json +++ b/src/package.json @@ -17,6 +17,7 @@ "debug": "^4.3.4", "express": "^4.18.2", "express-session": "^1.18.0", + "h3": "^1.11.1", "qrcode": "^1.5.3", "uuid": "^9.0.1" }, diff --git a/src/www/index.html b/src/www/index.html index 5f8c653f..f8eae27c 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -3,6 +3,7 @@ WireGuard + @@ -490,7 +491,7 @@ -

WireGuard Easy © 2021-2024 by Emile Nijssen is licensed under CC BY-NC-SA 4.0 · Date: Wed, 28 Feb 2024 16:27:33 +0700 Subject: [PATCH 002/115] fix: revert ServerError.js --- src/lib/ServerError.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/lib/ServerError.js diff --git a/src/lib/ServerError.js b/src/lib/ServerError.js new file mode 100644 index 00000000..1e567f4b --- /dev/null +++ b/src/lib/ServerError.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = class ServerError extends Error { + + constructor(message, statusCode = 500) { + super(message); + this.statusCode = statusCode; + } + +}; From 577af9947d77232082d45a456e3df252c3e151dd Mon Sep 17 00:00:00 2001 From: Thomas Willems Date: Mon, 29 Jan 2024 12:51:44 +0100 Subject: [PATCH 003/115] introduce WG_DEFAULT_ADDRESS_RANGE (CIDR notation) This PR allows the use of Address Ranges using the CIDR notation. To make it backward compatible, i introduced a new env variable WG_DEFAULT_ADDRESS_RANGE (defaults to the previous default of 24). This allows the usage of smaller subnets (or possibly larger; but i didn't test that due to restrictions on my network). Client IPs will be calculated with correct IP addresses instead of making assumptions of the address space. --- README.md | 1 + docker-compose.yml | 1 + src/config.js | 10 +++++++++- src/lib/WireGuard.js | 21 ++++++++++++++------- src/package-lock.json | 6 ++++++ src/package.json | 1 + wg-easy.service | 1 + 7 files changed, 33 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 95810441..49fc42ff 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ These options can be configured by setting environment variables using `-e KEY=" | `WG_MTU` | `null` | `1420` | The MTU the clients will use. Server uses default WG MTU. | | `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open. If this value is 0, then connections won't be kept alive. | | `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range. | +| `WG_DEFAULT_ADDRESS_RANGE` | `24` | `28` | CIDR notation block of range. Default equals `10.8.0.1/24` | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. If set to blank value, clients will not use any DNS. | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use. | | `WG_PRE_UP` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L19) for the default value. | diff --git a/docker-compose.yml b/docker-compose.yml index a6738832..22e73cdb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: # - PASSWORD=foobar123 # - WG_PORT=51820 # - WG_DEFAULT_ADDRESS=10.8.0.x + # - WG_DEFAULT_ADDRESS_RANGE=24 # - WG_DEFAULT_DNS=1.1.1.1 # - WG_MTU=1420 # - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24 diff --git a/src/config.js b/src/config.js index 33ff7832..5245a348 100644 --- a/src/config.js +++ b/src/config.js @@ -1,5 +1,7 @@ 'use strict'; +const ip = require('ip'); + const { release } = require('./package.json'); module.exports.RELEASE = release; @@ -13,14 +15,20 @@ module.exports.WG_PORT = process.env.WG_PORT || 51820; module.exports.WG_MTU = process.env.WG_MTU || null; module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || 0; module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x'; +module.exports.WG_DEFAULT_ADDRESS_RANGE = process.env.WG_DEFAULT_ADDRESS_RANGE || 24; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS : '1.1.1.1'; module.exports.WG_ALLOWED_IPS = process.env.WG_ALLOWED_IPS || '0.0.0.0/0, ::/0'; +module.exports.WG_SUBNET = ip.subnet(module.exports.WG_DEFAULT_ADDRESS.replace('x', '1'), `255.255.255.${256 - 2 ** (32 - module.exports.WG_DEFAULT_ADDRESS_RANGE)}`); +module.exports.WG_SERVER_ADDRESS = module.exports.WG_SUBNET.firstAddress; +module.exports.WG_CLIENT_FIRST_ADDRESS = ip.toLong(module.exports.WG_SERVER_ADDRESS) + 1; +module.exports.WG_CLIENT_LAST_ADDRESS = ip.toLong(module.exports.WG_SUBNET.lastAddress) - 1; // Exclude the broadcast address + module.exports.WG_PRE_UP = process.env.WG_PRE_UP || ''; module.exports.WG_POST_UP = process.env.WG_POST_UP || ` -iptables -t nat -A POSTROUTING -s ${module.exports.WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ${module.exports.WG_DEVICE} -j MASQUERADE; +iptables -t nat -A POSTROUTING -s ${module.exports.WG_SERVER_ADDRESS}/${module.exports.WG_DEFAULT_ADDRESS_RANGE} -o ${module.exports.WG_DEVICE} -j MASQUERADE; iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 89246a73..a0beddeb 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -4,6 +4,7 @@ const fs = require('fs').promises; const path = require('path'); const debug = require('debug')('WireGuard'); +const ip = require('ip'); const uuid = require('uuid'); const QRCode = require('qrcode'); @@ -16,9 +17,12 @@ const { WG_PORT, WG_MTU, WG_DEFAULT_DNS, - WG_DEFAULT_ADDRESS, + WG_DEFAULT_ADDRESS_RANGE, WG_PERSISTENT_KEEPALIVE, WG_ALLOWED_IPS, + WG_SERVER_ADDRESS, + WG_CLIENT_FIRST_ADDRESS, + WG_CLIENT_LAST_ADDRESS, WG_PRE_UP, WG_POST_UP, WG_PRE_DOWN, @@ -45,13 +49,15 @@ module.exports = class WireGuard { const publicKey = await Util.exec(`echo ${privateKey} | wg pubkey`, { log: 'echo ***hidden*** | wg pubkey', }); - const address = WG_DEFAULT_ADDRESS.replace('x', '1'); + const address = WG_SERVER_ADDRESS; + const cidrBlock = WG_DEFAULT_ADDRESS_RANGE; config = { server: { privateKey, publicKey, address, + cidrBlock, }, clients: {}, }; @@ -94,7 +100,7 @@ module.exports = class WireGuard { # Server [Interface] PrivateKey = ${config.server.privateKey} -Address = ${config.server.address}/24 +Address = ${config.server.address}/${config.server.cidrBlock} ListenPort = 51820 PreUp = ${WG_PRE_UP} PostUp = ${WG_POST_UP} @@ -229,15 +235,16 @@ Endpoint = ${WG_HOST}:${WG_PORT}`; const publicKey = await Util.exec(`echo ${privateKey} | wg pubkey`); const preSharedKey = await Util.exec('wg genpsk'); - // Calculate next IP + // find next IP let address; - for (let i = 2; i < 255; i++) { + for (let i = WG_CLIENT_FIRST_ADDRESS; i <= WG_CLIENT_LAST_ADDRESS; i++) { + const currentIp = ip.fromLong(i); const client = Object.values(config.clients).find((client) => { - return client.address === WG_DEFAULT_ADDRESS.replace('x', i); + return client.address === currentIp; }); if (!client) { - address = WG_DEFAULT_ADDRESS.replace('x', i); + address = currentIp; break; } } diff --git a/src/package-lock.json b/src/package-lock.json index 532fa5bb..85d8420b 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -13,6 +13,7 @@ "debug": "^4.3.4", "express": "^4.18.3", "express-session": "^1.18.0", + "ip": "^1.1.8", "qrcode": "^1.5.3", "uuid": "^9.0.1" }, @@ -2793,6 +2794,11 @@ "node": ">= 0.4" } }, + "node_modules/ip": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", diff --git a/src/package.json b/src/package.json index 14cf5183..fe676ce3 100644 --- a/src/package.json +++ b/src/package.json @@ -17,6 +17,7 @@ "debug": "^4.3.4", "express": "^4.18.3", "express-session": "^1.18.0", + "ip": "^1.1.8", "qrcode": "^1.5.3", "uuid": "^9.0.1" }, diff --git a/wg-easy.service b/wg-easy.service index bcdf72fd..9b842b39 100644 --- a/wg-easy.service +++ b/wg-easy.service @@ -6,6 +6,7 @@ After=network-online.target nss-lookup.target Environment="WG_HOST=raspberrypi.local" # Change this to your host's public address or static public ip. Environment="PASSWORD=REPLACEME" # When set, requires a password when logging in to the Web UI, to disable add a hashtag #Environment="WG_DEFAULT_ADDRESS=10.0.8.x" #Clients IP address range. +#Environment="WG_DEFAULT_ADDRESS_RANGE=24" #Clients IP address range block. #Environment="WG_DEFAULT_DNS=10.0.8.1, 1.1.1.1" #DNS server clients will use. If set to blank value, clients will not use any DNS. #Environment="WG_ALLOWED_IPS=0.0.0.0/0,::/0" #Allowed IPs clients will use. #Environment="WG_DEVICE=ens1" #Ethernet device the wireguard traffic should be forwarded through. From 89415a2258e7167e44b06b2f436e24f141f5af77 Mon Sep 17 00:00:00 2001 From: Thomas Willems Date: Tue, 6 Feb 2024 09:25:23 +0100 Subject: [PATCH 004/115] refactor to support CIDR and legacy notation for WG_DEFAULT_ADDRESS --- README.md | 3 +-- docker-compose.yml | 3 +-- src/config.js | 26 +++++++++++++++++++++++--- src/lib/Util.js | 13 ------------- src/lib/WireGuard.js | 4 ++-- wg-easy.service | 3 +-- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 49fc42ff..5a664203 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,7 @@ These options can be configured by setting environment variables using `-e KEY=" | `WG_PORT` | `51820` | `12345` | The public UDP port of your VPN server. WireGuard will always listen on 51820 inside the Docker container. | | `WG_MTU` | `null` | `1420` | The MTU the clients will use. Server uses default WG MTU. | | `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open. If this value is 0, then connections won't be kept alive. | -| `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range. | -| `WG_DEFAULT_ADDRESS_RANGE` | `24` | `28` | CIDR notation block of range. Default equals `10.8.0.1/24` | +| `WG_DEFAULT_ADDRESS` | `10.8.0.1/24` | `10.6.0.x` | Clients IP address range. (For Legacy reasons x in last place is supported (e.g. 10.8.0.x)) | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. If set to blank value, clients will not use any DNS. | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use. | | `WG_PRE_UP` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L19) for the default value. | diff --git a/docker-compose.yml b/docker-compose.yml index 22e73cdb..9495b9b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,8 +15,7 @@ services: # Optional: # - PASSWORD=foobar123 # - WG_PORT=51820 - # - WG_DEFAULT_ADDRESS=10.8.0.x - # - WG_DEFAULT_ADDRESS_RANGE=24 + # - WG_DEFAULT_ADDRESS=10.8.0.1/24 # - WG_DEFAULT_DNS=1.1.1.1 # - WG_MTU=1420 # - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24 diff --git a/src/config.js b/src/config.js index 5245a348..f1779fe3 100644 --- a/src/config.js +++ b/src/config.js @@ -4,6 +4,26 @@ const ip = require('ip'); const { release } = require('./package.json'); +function parseDefaultAddress(defaultAddress) { + // Set the default full address with subnet if it's not provided + const defaultFullAddress = defaultAddress || '10.8.0.1/24'; + + // Check if the address ends with '.x', if so, replace with '.1/24' + const addressWithSubnet = defaultFullAddress.endsWith('.x') + ? defaultFullAddress.replace('.x', '.1/24') + : defaultFullAddress; + + const [ipAddress, subnetRange] = addressWithSubnet.split('/'); + + return { + ipAddress, + subnetRange: subnetRange || '24', // Default subnet range to 24 if not provided + }; +} + +// Use the function to parse the environment variable or default to '10.8.0.1/24' +const { ipAddress, subnetRange } = parseDefaultAddress(process.env.WG_DEFAULT_ADDRESS); + module.exports.RELEASE = release; module.exports.PORT = process.env.PORT || 51821; module.exports.WEBUI_HOST = process.env.WEBUI_HOST || '0.0.0.0'; @@ -14,14 +34,14 @@ module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || 51820; module.exports.WG_MTU = process.env.WG_MTU || null; module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || 0; -module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x'; -module.exports.WG_DEFAULT_ADDRESS_RANGE = process.env.WG_DEFAULT_ADDRESS_RANGE || 24; +module.exports.WG_DEFAULT_ADDRESS = ipAddress; +module.exports.WG_DEFAULT_ADDRESS_RANGE = subnetRange; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS : '1.1.1.1'; module.exports.WG_ALLOWED_IPS = process.env.WG_ALLOWED_IPS || '0.0.0.0/0, ::/0'; -module.exports.WG_SUBNET = ip.subnet(module.exports.WG_DEFAULT_ADDRESS.replace('x', '1'), `255.255.255.${256 - 2 ** (32 - module.exports.WG_DEFAULT_ADDRESS_RANGE)}`); +module.exports.WG_SUBNET = ip.subnet(module.exports.WG_DEFAULT_ADDRESS, `255.255.255.${256 - 2 ** (32 - module.exports.WG_DEFAULT_ADDRESS_RANGE)}`); module.exports.WG_SERVER_ADDRESS = module.exports.WG_SUBNET.firstAddress; module.exports.WG_CLIENT_FIRST_ADDRESS = ip.toLong(module.exports.WG_SERVER_ADDRESS) + 1; module.exports.WG_CLIENT_LAST_ADDRESS = ip.toLong(module.exports.WG_SUBNET.lastAddress) - 1; // Exclude the broadcast address diff --git a/src/lib/Util.js b/src/lib/Util.js index cc6e89c2..82942599 100644 --- a/src/lib/Util.js +++ b/src/lib/Util.js @@ -4,19 +4,6 @@ const childProcess = require('child_process'); module.exports = class Util { - static isValidIPv4(str) { - const blocks = str.split('.'); - if (blocks.length !== 4) return false; - - for (let value of blocks) { - value = parseInt(value, 10); - if (Number.isNaN(value)) return false; - if (value < 0 || value > 255) return false; - } - - return true; - } - static promisify(fn) { // eslint-disable-next-line func-names return function(req, res) { diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index a0beddeb..640741cd 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -73,7 +73,7 @@ module.exports = class WireGuard { throw err; }); - // await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ' + WG_DEVICE + ' -j MASQUERADE`); + // await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_SERVER_ADDRESS/${WG_DEFAULT_ADDRESS_RANGE} -o ' + WG_DEVICE + ' -j MASQUERADE`); // await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT'); // await Util.exec('iptables -A FORWARD -i wg0 -j ACCEPT'); // await Util.exec('iptables -A FORWARD -o wg0 -j ACCEPT'); @@ -315,7 +315,7 @@ Endpoint = ${WG_HOST}:${WG_PORT}`; async updateClientAddress({ clientId, address }) { const client = await this.getClient({ clientId }); - if (!Util.isValidIPv4(address)) { + if (!ip.isV4Format(address)) { throw new ServerError(`Invalid Address: ${address}`, 400); } diff --git a/wg-easy.service b/wg-easy.service index 9b842b39..91b35206 100644 --- a/wg-easy.service +++ b/wg-easy.service @@ -5,8 +5,7 @@ After=network-online.target nss-lookup.target [Service] Environment="WG_HOST=raspberrypi.local" # Change this to your host's public address or static public ip. Environment="PASSWORD=REPLACEME" # When set, requires a password when logging in to the Web UI, to disable add a hashtag -#Environment="WG_DEFAULT_ADDRESS=10.0.8.x" #Clients IP address range. -#Environment="WG_DEFAULT_ADDRESS_RANGE=24" #Clients IP address range block. +#Environment="WG_DEFAULT_ADDRESS=10.0.8.1/24" #Clients IP address range. #Environment="WG_DEFAULT_DNS=10.0.8.1, 1.1.1.1" #DNS server clients will use. If set to blank value, clients will not use any DNS. #Environment="WG_ALLOWED_IPS=0.0.0.0/0,::/0" #Allowed IPs clients will use. #Environment="WG_DEVICE=ens1" #Ethernet device the wireguard traffic should be forwarded through. From c4d4da38e7ba9521657056ebcf3b714551354900 Mon Sep 17 00:00:00 2001 From: Thomas Willems Date: Tue, 13 Feb 2024 13:55:00 +0100 Subject: [PATCH 005/115] correct CIDR notation --- README.md | 2 +- docker-compose.yml | 2 +- src/config.js | 8 ++++---- wg-easy.service | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5a664203..b2d2bc88 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ These options can be configured by setting environment variables using `-e KEY=" | `WG_PORT` | `51820` | `12345` | The public UDP port of your VPN server. WireGuard will always listen on 51820 inside the Docker container. | | `WG_MTU` | `null` | `1420` | The MTU the clients will use. Server uses default WG MTU. | | `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open. If this value is 0, then connections won't be kept alive. | -| `WG_DEFAULT_ADDRESS` | `10.8.0.1/24` | `10.6.0.x` | Clients IP address range. (For Legacy reasons x in last place is supported (e.g. 10.8.0.x)) | +| `WG_DEFAULT_ADDRESS` | `10.8.0.0/24` | `10.6.0.0/24` | Clients IP address range. (For Legacy reasons x in last place is supported and will be replaced with 0/24 (e.g. 10.8.0.x)) | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. If set to blank value, clients will not use any DNS. | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use. | | `WG_PRE_UP` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L19) for the default value. | diff --git a/docker-compose.yml b/docker-compose.yml index 9495b9b5..766ed697 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: # Optional: # - PASSWORD=foobar123 # - WG_PORT=51820 - # - WG_DEFAULT_ADDRESS=10.8.0.1/24 + # - WG_DEFAULT_ADDRESS=10.8.0.0/24 # - WG_DEFAULT_DNS=1.1.1.1 # - WG_MTU=1420 # - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24 diff --git a/src/config.js b/src/config.js index f1779fe3..21470be6 100644 --- a/src/config.js +++ b/src/config.js @@ -6,11 +6,11 @@ const { release } = require('./package.json'); function parseDefaultAddress(defaultAddress) { // Set the default full address with subnet if it's not provided - const defaultFullAddress = defaultAddress || '10.8.0.1/24'; + const defaultFullAddress = defaultAddress || '10.8.0.0/24'; - // Check if the address ends with '.x', if so, replace with '.1/24' + // Check if the address ends with '.x', if so, replace with '.0/24' const addressWithSubnet = defaultFullAddress.endsWith('.x') - ? defaultFullAddress.replace('.x', '.1/24') + ? defaultFullAddress.replace('.x', '.0/24') : defaultFullAddress; const [ipAddress, subnetRange] = addressWithSubnet.split('/'); @@ -21,7 +21,7 @@ function parseDefaultAddress(defaultAddress) { }; } -// Use the function to parse the environment variable or default to '10.8.0.1/24' +// Use the function to parse the environment variable or default to '10.8.0.0/24' const { ipAddress, subnetRange } = parseDefaultAddress(process.env.WG_DEFAULT_ADDRESS); module.exports.RELEASE = release; diff --git a/wg-easy.service b/wg-easy.service index 91b35206..6adee95e 100644 --- a/wg-easy.service +++ b/wg-easy.service @@ -5,7 +5,7 @@ After=network-online.target nss-lookup.target [Service] Environment="WG_HOST=raspberrypi.local" # Change this to your host's public address or static public ip. Environment="PASSWORD=REPLACEME" # When set, requires a password when logging in to the Web UI, to disable add a hashtag -#Environment="WG_DEFAULT_ADDRESS=10.0.8.1/24" #Clients IP address range. +#Environment="WG_DEFAULT_ADDRESS=10.0.8.0/24" # Clients IP address range. #Environment="WG_DEFAULT_DNS=10.0.8.1, 1.1.1.1" #DNS server clients will use. If set to blank value, clients will not use any DNS. #Environment="WG_ALLOWED_IPS=0.0.0.0/0,::/0" #Allowed IPs clients will use. #Environment="WG_DEVICE=ens1" #Ethernet device the wireguard traffic should be forwarded through. From cb45bc1c4317e8a1f5a0f096fb59737da2f46e2d Mon Sep 17 00:00:00 2001 From: Thomas Willems Date: Mon, 19 Feb 2024 11:02:38 +0100 Subject: [PATCH 006/115] update ip package to 2.0.1 --- src/package-lock.json | 8 ++++---- src/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 85d8420b..e527e473 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -13,7 +13,7 @@ "debug": "^4.3.4", "express": "^4.18.3", "express-session": "^1.18.0", - "ip": "^1.1.8", + "ip": "^2.0.1", "qrcode": "^1.5.3", "uuid": "^9.0.1" }, @@ -2795,9 +2795,9 @@ } }, "node_modules/ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==" }, "node_modules/ipaddr.js": { "version": "1.9.1", diff --git a/src/package.json b/src/package.json index fe676ce3..05964c9a 100644 --- a/src/package.json +++ b/src/package.json @@ -17,7 +17,7 @@ "debug": "^4.3.4", "express": "^4.18.3", "express-session": "^1.18.0", - "ip": "^1.1.8", + "ip": "^2.0.1", "qrcode": "^1.5.3", "uuid": "^9.0.1" }, From 2f8976511278fab305ed351cda0571e8a4d63a22 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:55:10 +0100 Subject: [PATCH 007/115] WireGuard.js: fixup undefined CIDR --- src/lib/WireGuard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 640741cd..6c7f0d59 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -204,7 +204,7 @@ ${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' return `[Interface] PrivateKey = ${client.privateKey} -Address = ${client.address}/24 +Address = ${client.address}/${config.server.cidrBlock} ${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}\n` : ''}\ ${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\ From bbc919608c581772eb6134cf3ea217439bc5c0ae Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:57:49 +0100 Subject: [PATCH 008/115] Update docker-compose.yml --- docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 766ed697..b5907bde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,8 @@ services: # Optional: # - PASSWORD=foobar123 # - WG_PORT=51820 - # - WG_DEFAULT_ADDRESS=10.8.0.0/24 + # - WG_DEFAULT_ADDRESS=10.8.0.0 + # - WG_DEFAULT_ADDRESS_RANGE=24 # - WG_DEFAULT_DNS=1.1.1.1 # - WG_MTU=1420 # - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24 From 76a3d7f81dfd3101acdc772045634267d49c9a67 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:15:42 +0100 Subject: [PATCH 009/115] fixing stuff and formating --- src/config.js | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/config.js b/src/config.js index 21470be6..46da2aa6 100644 --- a/src/config.js +++ b/src/config.js @@ -4,38 +4,18 @@ const ip = require('ip'); const { release } = require('./package.json'); -function parseDefaultAddress(defaultAddress) { - // Set the default full address with subnet if it's not provided - const defaultFullAddress = defaultAddress || '10.8.0.0/24'; - - // Check if the address ends with '.x', if so, replace with '.0/24' - const addressWithSubnet = defaultFullAddress.endsWith('.x') - ? defaultFullAddress.replace('.x', '.0/24') - : defaultFullAddress; - - const [ipAddress, subnetRange] = addressWithSubnet.split('/'); - - return { - ipAddress, - subnetRange: subnetRange || '24', // Default subnet range to 24 if not provided - }; -} - -// Use the function to parse the environment variable or default to '10.8.0.0/24' -const { ipAddress, subnetRange } = parseDefaultAddress(process.env.WG_DEFAULT_ADDRESS); - module.exports.RELEASE = release; -module.exports.PORT = process.env.PORT || 51821; +module.exports.PORT = process.env.PORT || '51821'; module.exports.WEBUI_HOST = process.env.WEBUI_HOST || '0.0.0.0'; module.exports.PASSWORD = process.env.PASSWORD; module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/'; module.exports.WG_DEVICE = process.env.WG_DEVICE || 'eth0'; module.exports.WG_HOST = process.env.WG_HOST; -module.exports.WG_PORT = process.env.WG_PORT || 51820; +module.exports.WG_PORT = process.env.WG_PORT || '51820'; module.exports.WG_MTU = process.env.WG_MTU || null; -module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || 0; -module.exports.WG_DEFAULT_ADDRESS = ipAddress; -module.exports.WG_DEFAULT_ADDRESS_RANGE = subnetRange; +module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || '0'; +module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.0'; +module.exports.WG_DEFAULT_ADDRESS_RANGE = process.env.WG_DEFAULT_ADDRESS_RANGE || '24'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS : '1.1.1.1'; From 63faf4c507a0238daef95230fda1246978785d28 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:24:42 +0100 Subject: [PATCH 010/115] fixup: WireGuard.js --- src/lib/WireGuard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 6c7f0d59..5f742574 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -204,7 +204,7 @@ ${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' return `[Interface] PrivateKey = ${client.privateKey} -Address = ${client.address}/${config.server.cidrBlock} +Address = ${client.address}/${client.cidrBlock} ${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}\n` : ''}\ ${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\ From 754b5f29af19e329945f7cd4c37b8d5d86b6383f Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:29:14 +0100 Subject: [PATCH 011/115] fixup: WireGuard.js well I was on the client side so I hope I get all stuff fixed now. --- src/lib/WireGuard.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 5f742574..ad5e7973 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -143,6 +143,7 @@ ${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' name: client.name, enabled: client.enabled, address: client.address, + cidrBlock: client.cidrBlock, publicKey: client.publicKey, createdAt: new Date(client.createdAt), updatedAt: new Date(client.updatedAt), @@ -259,6 +260,7 @@ Endpoint = ${WG_HOST}:${WG_PORT}`; id, name, address, + cidrBlock, privateKey, publicKey, preSharedKey, From 5ee284b973131aae37b48466188293dce986c7ee Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:35:38 +0100 Subject: [PATCH 012/115] fixup: WireGuard.js --- src/lib/WireGuard.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index ad5e7973..9ff77464 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -256,6 +256,7 @@ Endpoint = ${WG_HOST}:${WG_PORT}`; // Create Client const id = uuid.v4(); + const cidrBlock = WG_DEFAULT_ADDRESS_RANGE; const client = { id, name, From a36ab8891ed9594101cee258c42b9634e4990e29 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:43:07 +0100 Subject: [PATCH 013/115] fixup: WireGuard.js --- src/lib/WireGuard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 9ff77464..b1dfe0af 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -73,7 +73,7 @@ module.exports = class WireGuard { throw err; }); - // await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_SERVER_ADDRESS/${WG_DEFAULT_ADDRESS_RANGE} -o ' + WG_DEVICE + ' -j MASQUERADE`); + // await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_SERVER_ADDRESS}/${WG_DEFAULT_ADDRESS_RANGE} -o ' + WG_DEVICE + ' -j MASQUERADE`); // await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT'); // await Util.exec('iptables -A FORWARD -i wg0 -j ACCEPT'); // await Util.exec('iptables -A FORWARD -o wg0 -j ACCEPT'); From 2ffb68eeb255c8710e36aae8989ed5bd8dfeb2d2 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:46:50 +0100 Subject: [PATCH 014/115] [update] package.json and changelog to current release 12 Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com> --- docs/changelog.json | 3 ++- src/package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog.json b/docs/changelog.json index fe4431f4..ac5208a6 100644 --- a/docs/changelog.json +++ b/docs/changelog.json @@ -9,5 +9,6 @@ "8": "Updated to Node.js v18.", "9": "Fixed issue running on devices with older kernels.", "10": "Added sessionless HTTP API auth & automatic dark mode.", - "11": "Multilanguage Support & various bugfixes" + "11": "Multilanguage Support & various bugfixes", + "12": "UI_TRAFFIC_STATS, Import json configurations with no PreShared-Key, allow clients with no privateKey & more." } diff --git a/src/package.json b/src/package.json index 14cf5183..c3861f99 100644 --- a/src/package.json +++ b/src/package.json @@ -1,5 +1,5 @@ { - "release": "11", + "release": "12", "name": "wg-easy", "version": "1.0.1", "description": "The easiest way to run WireGuard VPN + Web-based Admin UI.", From a4c3bf029180985ab2db136652d558aea4821fc9 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 13 Mar 2024 13:05:08 +0100 Subject: [PATCH 015/115] PR: Build Docker images Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com> --- .github/workflows/deploy-development.yml | 1 - .github/workflows/deploy-pr.yml | 38 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-pr.yml diff --git a/.github/workflows/deploy-development.yml b/.github/workflows/deploy-development.yml index 21547c7e..fa912f77 100644 --- a/.github/workflows/deploy-development.yml +++ b/.github/workflows/deploy-development.yml @@ -2,7 +2,6 @@ name: Build & Publish Development on: workflow_dispatch: - pull_request: jobs: deploy: diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml new file mode 100644 index 00000000..96118c6e --- /dev/null +++ b/.github/workflows/deploy-pr.yml @@ -0,0 +1,38 @@ +name: Build & Publish Development + +on: + workflow_dispatch: + pull_request: + +jobs: + deploy: + name: Build & Deploy + runs-on: ubuntu-latest + if: github.repository_owner == 'wg-easy' + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v4 + with: + ref: production + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker Image + uses: docker/build-push-action@v5 + with: + push: false + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 + tags: ghcr.io/wg-easy/wg-easy:pr From bad7bff98ee06ce32f3aa816fd549b65830e3765 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 13 Mar 2024 13:09:32 +0100 Subject: [PATCH 016/115] Update deploy-pr.yml --- .github/workflows/deploy-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index 96118c6e..3a3cdb13 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -1,4 +1,4 @@ -name: Build & Publish Development +name: Build Pull Request on: workflow_dispatch: From 11a56ffdc5dfdceacc73a07bd00f6c229d865c1a Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 13 Mar 2024 13:12:16 +0100 Subject: [PATCH 017/115] needed for testing on our test branches --- .github/workflows/deploy-development.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-development.yml b/.github/workflows/deploy-development.yml index fa912f77..21547c7e 100644 --- a/.github/workflows/deploy-development.yml +++ b/.github/workflows/deploy-development.yml @@ -2,6 +2,7 @@ name: Build & Publish Development on: workflow_dispatch: + pull_request: jobs: deploy: From 4dc439f041f1d82a5b718de6f4f7afceac9dfe22 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Wed, 13 Mar 2024 17:49:02 +0000 Subject: [PATCH 018/115] npm: package updates --- src/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 836cc747..e5a62c08 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -3852,9 +3852,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.0.15", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.15.tgz", - "integrity": "sha512-rEYkQOMUCEMhsKbK66tbEU9QVIxbhN18YiniAwA7XQYTVBqrBy+P2p5JcdqsHgKM2zWylp8d7J6eszocfds5Sw==", + "version": "6.0.16", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.16.tgz", + "integrity": "sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw==", "dev": true, "dependencies": { "cssesc": "^3.0.0", From 2f5878d406f0ed520d6139b38117220b27387cd1 Mon Sep 17 00:00:00 2001 From: Edgars Date: Tue, 12 Mar 2024 16:10:50 +0200 Subject: [PATCH 019/115] Add setup and update instructions for Compose `README.md` was updated to provide installation and update instructions for Docker Compose as well. --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 95810441..30753cea 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ You have found the easiest way to install & manage WireGuard on any Linux host! If you haven't installed Docker yet, install it by running: ```bash -$ curl -sSL https://get.docker.com | sh -$ sudo usermod -aG docker $(whoami) -$ exit +curl -sSL https://get.docker.com | sh +sudo usermod -aG docker $(whoami) +exit ``` And log in again. @@ -72,6 +72,10 @@ The Web UI will now be available on `http://0.0.0.0:51821`. > 💡 Your configuration files will be saved in `~/.wg-easy` +WireGuard Easy can be launched with Docker Compose as well - just download +[`docker-compose.yml`](docker-compose.yml), make necessary adjustments and +execute `docker compose up --detach`. + ### 3. Sponsor Are you enjoying this project? [Buy Emile a beer!](https://github.com/sponsors/WeeJeWel) 🍻 @@ -114,6 +118,16 @@ docker pull ghcr.io/wg-easy/wg-easy And then run the `docker run -d \ ...` command above again. +To update using Docker Compose: + +```shell +docker compose pull +docker compose up --detach +``` + +The WireGuared Easy container will be automatically recreated if a newer image +was pulled. + ## Common Use Cases * [Using WireGuard-Easy with Pi-Hole](https://github.com/wg-easy/wg-easy/wiki/Using-WireGuard-Easy-with-Pi-Hole) From d91f08eb1bb6f4b4806cef3ea49f52be14295f59 Mon Sep 17 00:00:00 2001 From: Rahil Bhimjiani Date: Tue, 12 Mar 2024 21:03:07 +0530 Subject: [PATCH 020/115] i18n.js: add Hindi language translation Signed-off-by: Rahil Bhimjiani --- README.md | 2 +- docker-compose.yml | 2 +- src/www/js/i18n.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30753cea..6d16154f 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ These options can be configured by setting environment variables using `-e KEY=" | `WG_POST_UP` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L20) for the default value. | | `WG_PRE_DOWN` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L27) for the default value. | | `WG_POST_DOWN` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L28) for the default value. | -| `LANG` | `en` | `de` | Web UI language (Supports: en, ua, ru, tr, no, pl, fr, de, ca, es, ko, vi, nl, is, pt, chs, cht, it, th). | +| `LANG` | `en` | `de` | Web UI language (Supports: en, ua, ru, tr, no, pl, fr, de, ca, es, ko, vi, nl, is, pt, chs, cht, it, th, hi). | | `UI_TRAFFIC_STATS` | `false` | `true` | Enable detailed RX / TX client stats in Web UI | > If you change `WG_PORT`, make sure to also change the exposed port. diff --git a/docker-compose.yml b/docker-compose.yml index a6738832..a489356f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: wg-easy: environment: # Change Language: - # (Supports: en, ua, ru, tr, no, pl, fr, de, ca, es, ko, vi, nl, is, pt, chs, cht, it, th) + # (Supports: en, ua, ru, tr, no, pl, fr, de, ca, es, ko, vi, nl, is, pt, chs, cht, it, th, hi) - LANG=de # ⚠️ Required: # Change this to your host's public address diff --git a/src/www/js/i18n.js b/src/www/js/i18n.js index bde7441d..a1962708 100644 --- a/src/www/js/i18n.js +++ b/src/www/js/i18n.js @@ -517,4 +517,32 @@ const messages = { // eslint-disable-line no-unused-vars madeBy: 'สร้างโดย', donate: 'บริจาค', }, + hi: { // github.com/rahilarious + name: 'नाम', + password: 'पासवर्ड', + signIn: 'लॉगिन', + logout: 'लॉगआउट', + updateAvailable: 'अपडेट उपलब्ध है!', + update: 'अपडेट', + clients: 'उपयोगकर्ताये', + new: 'नया', + deleteClient: 'उपयोगकर्ता हटाएँ', + deleteDialog1: 'क्या आपको पक्का हटाना है', + deleteDialog2: 'यह निर्णय पलट नहीं सकता।', + cancel: 'कुछ ना करें', + create: 'बनाएं', + createdOn: 'सर्जन तारीख ', + lastSeen: 'पिछली बार देखे गए थे ', + totalDownload: 'कुल डाउनलोड: ', + totalUpload: 'कुल अपलोड: ', + newClient: 'नया उपयोगकर्ता', + disableClient: 'उपयोगकर्ता स्थगित कीजिये', + enableClient: 'उपयोगकर्ता शुरू कीजिये', + noClients: 'अभी तक कोई भी उपयोगकर्ता नहीं है।', + noPrivKey: 'ये उपयोगकर्ता की कोई भी गुप्त चाबी नहीं हे। बना नहीं सकते।', + showQR: 'क्यू आर कोड देखिये', + downloadConfig: 'डाउनलोड कॉन्फीग्यूरेशन', + madeBy: 'सर्जक', + donate: 'दान करें', + }, }; From e9480a5ed593b6052395851191f6f3b2a8754c74 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:50:31 +0100 Subject: [PATCH 021/115] fixup Server.js: even to master --- src/lib/Server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/Server.js b/src/lib/Server.js index 82ab94e7..8d1050a0 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -30,6 +30,7 @@ const { RELEASE, PASSWORD, LANG, + UI_TRAFFIC_STATS, } = require('../config'); module.exports = class Server { From 8c771b054cad6cbbdaeb0ae977a3ebb7eb6ae776 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:55:15 +0100 Subject: [PATCH 022/115] Server.js: add UI_TRAFFIC_STATS --- src/lib/Server.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index 8d1050a0..fea688b7 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -63,7 +63,10 @@ module.exports = class Server { return `"${LANG}"`; })) - + .get('/api/ui-traffic-stats', (Util.promisify(async () => { + return UI_TRAFFIC_STATS === 'true'; + })) + // Authentication .get('/api/session', defineEventHandler((event) => { const requiresPassword = !!process.env.PASSWORD; From 08c412fd14c8fbf8dff1e421bd980b434636c03b Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:57:38 +0100 Subject: [PATCH 023/115] Server.js: remove white-space --- src/lib/Server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index fea688b7..c1140852 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -66,7 +66,7 @@ module.exports = class Server { .get('/api/ui-traffic-stats', (Util.promisify(async () => { return UI_TRAFFIC_STATS === 'true'; })) - + // Authentication .get('/api/session', defineEventHandler((event) => { const requiresPassword = !!process.env.PASSWORD; From 064e264ce8b3d7d528bb68d6639badf1c99f46a3 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:59:31 +0100 Subject: [PATCH 024/115] Server.js: add missing ')' --- src/lib/Server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index c1140852..5704f30f 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -102,7 +102,7 @@ module.exports = class Server { debug(`New Session: ${event.node.req.session.id}`); return { succcess: true }; - })); + }))); // WireGuard app.use( From b7c2c81cc7a50a702c99da7c165093dc7251348d Mon Sep 17 00:00:00 2001 From: "Philip H." <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:05:09 +0000 Subject: [PATCH 025/115] fixup: lint errors --- src/lib/Server.js | 65 ++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index 5704f30f..bbdf045b 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -21,6 +21,7 @@ const { setHeader, serveStatic, } = require('h3'); +const Util = require('./Util'); const WireGuard = require('../services/WireGuard'); @@ -67,42 +68,42 @@ module.exports = class Server { return UI_TRAFFIC_STATS === 'true'; })) - // Authentication - .get('/api/session', defineEventHandler((event) => { - const requiresPassword = !!process.env.PASSWORD; - const authenticated = requiresPassword - ? !!(event.node.req.session && event.node.req.session.authenticated) - : true; - - return { - requiresPassword, - authenticated, - }; - })) - .post('/api/session', defineEventHandler(async (event) => { - const { password } = await readBody(event); - - if (typeof password !== 'string') { - throw createError({ - status: 401, - message: 'Missing: Password', - }); - } + // Authentication + .get('/api/session', defineEventHandler((event) => { + const requiresPassword = !!process.env.PASSWORD; + const authenticated = requiresPassword + ? !!(event.node.req.session && event.node.req.session.authenticated) + : true; + + return { + requiresPassword, + authenticated, + }; + })) + .post('/api/session', defineEventHandler(async (event) => { + const { password } = await readBody(event); + + if (typeof password !== 'string') { + throw createError({ + status: 401, + message: 'Missing: Password', + }); + } - if (password !== PASSWORD) { - throw createError({ - status: 401, - message: 'Incorrect Password', - }); - } + if (password !== PASSWORD) { + throw createError({ + status: 401, + message: 'Incorrect Password', + }); + } - event.node.req.session.authenticated = true; - event.node.req.session.save(); + event.node.req.session.authenticated = true; + event.node.req.session.save(); - debug(`New Session: ${event.node.req.session.id}`); + debug(`New Session: ${event.node.req.session.id}`); - return { succcess: true }; - }))); + return { succcess: true }; + }))); // WireGuard app.use( From 3f2495a0ea7c6342bb7f45788c9c3db5fd585e4d Mon Sep 17 00:00:00 2001 From: "Philip H." <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:14:52 +0000 Subject: [PATCH 026/115] fixup: UI_TRAFFIC_STATS --- src/lib/Server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index bbdf045b..a5fc7520 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -64,9 +64,10 @@ module.exports = class Server { return `"${LANG}"`; })) - .get('/api/ui-traffic-stats', (Util.promisify(async () => { - return UI_TRAFFIC_STATS === 'true'; - })) + .get('/api/ui-traffic-stats', defineEventHandler((event) => { + setHeader(event, 'Content-Type', 'application/json'); + return `"${UI_TRAFFIC_STATS}"`; + }) // Authentication .get('/api/session', defineEventHandler((event) => { From 10f246ea59e9ab50ff2a95f7bb6e593a546406aa Mon Sep 17 00:00:00 2001 From: "Philip H." <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:19:29 +0000 Subject: [PATCH 027/115] fixup: Server.js --- src/lib/Server.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index a5fc7520..571b51ac 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -21,7 +21,6 @@ const { setHeader, serveStatic, } = require('h3'); -const Util = require('./Util'); const WireGuard = require('../services/WireGuard'); From 9a35b56f5c8269209c5a55a93cde59245c93d399 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 09:33:08 +0100 Subject: [PATCH 028/115] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6d16154f..e0163d0e 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ You have found the easiest way to install & manage WireGuard on any Linux host! * Tx/Rx charts for each connected client. * Gravatar support. * Automatic Light / Dark Mode +* Multilanguage Support +* UI_TRAFFIC_STATS (default off) ## Requirements From 7596385d5aff3ef40c64ece779b5907b5e39dcf9 Mon Sep 17 00:00:00 2001 From: "Philip H." <47042125+pheiduck@users.noreply.github.com> Date: Thu, 14 Mar 2024 12:18:47 +0000 Subject: [PATCH 029/115] fixup: lint errors and uninstall express --- src/lib/Server.js | 64 +++--- src/package-lock.json | 521 ++---------------------------------------- src/package.json | 1 - 3 files changed, 49 insertions(+), 537 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index 571b51ac..292c3085 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -66,44 +66,44 @@ module.exports = class Server { .get('/api/ui-traffic-stats', defineEventHandler((event) => { setHeader(event, 'Content-Type', 'application/json'); return `"${UI_TRAFFIC_STATS}"`; - }) + })) // Authentication - .get('/api/session', defineEventHandler((event) => { - const requiresPassword = !!process.env.PASSWORD; - const authenticated = requiresPassword - ? !!(event.node.req.session && event.node.req.session.authenticated) - : true; - - return { - requiresPassword, - authenticated, - }; - })) - .post('/api/session', defineEventHandler(async (event) => { - const { password } = await readBody(event); - - if (typeof password !== 'string') { - throw createError({ - status: 401, - message: 'Missing: Password', - }); - } + .get('/api/session', defineEventHandler((event) => { + const requiresPassword = !!process.env.PASSWORD; + const authenticated = requiresPassword + ? !!(event.node.req.session && event.node.req.session.authenticated) + : true; + + return { + requiresPassword, + authenticated, + }; + })) + .post('/api/session', defineEventHandler(async (event) => { + const { password } = await readBody(event); - if (password !== PASSWORD) { - throw createError({ - status: 401, - message: 'Incorrect Password', - }); - } + if (typeof password !== 'string') { + throw createError({ + status: 401, + message: 'Missing: Password', + }); + } - event.node.req.session.authenticated = true; - event.node.req.session.save(); + if (password !== PASSWORD) { + throw createError({ + status: 401, + message: 'Incorrect Password', + }); + } - debug(`New Session: ${event.node.req.session.id}`); + event.node.req.session.authenticated = true; + event.node.req.session.save(); - return { succcess: true }; - }))); + debug(`New Session: ${event.node.req.session.id}`); + + return { succcess: true }; + })); // WireGuard app.use( diff --git a/src/package-lock.json b/src/package-lock.json index 58f54225..6a84bcdf 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -11,7 +11,6 @@ "dependencies": { "bcryptjs": "^2.4.3", "debug": "^4.3.4", - "express": "^4.18.3", "express-session": "^1.18.0", "h3": "^1.11.1", "qrcode": "^1.5.3", @@ -682,18 +681,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -817,11 +804,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" - }, "node_modules/array-includes": { "version": "3.1.7", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", @@ -991,42 +973,6 @@ "node": ">=8" } }, - "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/body-parser/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/body-parser/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -1048,18 +994,11 @@ "node": ">=8" } }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/call-bind": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -1209,43 +1148,11 @@ "node": "^14.18.0 || >=16.10.0" } }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/cookie-es": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.0.0.tgz", "integrity": "sha512-mWYvfOLrfEc996hlKcdABeIiPHUPC6DM2QYZdGGOvhOTbA3tjm2eBwqlJpoFdjC89NI4Qt6h0Pu06Mp+1Pj5OQ==" }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1320,6 +1227,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -1367,15 +1275,6 @@ "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.3.tgz", "integrity": "sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==" }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -1424,11 +1323,6 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -1439,14 +1333,6 @@ "resolved": "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz", "integrity": "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==" }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/enquirer": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", @@ -1526,6 +1412,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, "dependencies": { "get-intrinsic": "^1.2.4" }, @@ -1537,6 +1424,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, "engines": { "node": ">= 0.4" } @@ -1581,11 +1469,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -2135,55 +2018,6 @@ "node": ">=0.10.0" } }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "4.18.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.3.tgz", - "integrity": "sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw==", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.2", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, "node_modules/express-session": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.0.tgz", @@ -2228,19 +2062,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "node_modules/express/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/express/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2324,36 +2145,6 @@ "node": ">=8" } }, - "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/finalhandler/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/finalhandler/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -2413,22 +2204,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2454,6 +2229,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -2504,6 +2280,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dev": true, "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", @@ -2647,6 +2424,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -2700,6 +2478,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0" }, @@ -2711,6 +2490,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -2722,6 +2502,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -2748,6 +2529,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, "dependencies": { "function-bind": "^1.1.2" }, @@ -2755,32 +2537,6 @@ "node": ">= 0.4" } }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -2831,7 +2587,9 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "peer": true }, "node_modules/internal-slot": { "version": "1.0.7", @@ -2847,14 +2605,6 @@ "node": ">= 0.4" } }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/iron-webcrypto": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.0.0.tgz", @@ -3280,19 +3030,6 @@ "node": ">=10" } }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -3302,14 +3039,6 @@ "node": ">= 8" } }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -3323,36 +3052,6 @@ "node": ">=8.6" } }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -3426,14 +3125,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/node-fetch-native": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.2.tgz", @@ -3470,6 +3161,7 @@ "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3567,17 +3259,6 @@ "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.3.tgz", "integrity": "sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==" }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/on-headers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", @@ -3726,11 +3407,6 @@ "node": "14 || >=16.14" } }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -3967,18 +3643,6 @@ "node": ">=0.4.0" } }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -4006,20 +3670,6 @@ "node": ">=10.13.0" } }, - "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -4059,28 +3709,6 @@ "node": ">= 0.8" } }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -4285,11 +3913,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, "node_modules/semver": { "version": "7.6.0", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", @@ -4305,61 +3928,6 @@ "node": ">=10" } }, - "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -4369,6 +3937,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -4396,11 +3965,6 @@ "node": ">= 0.4" } }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -4426,6 +3990,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dev": true, "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -4494,14 +4059,6 @@ "dev": true, "peer": true }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -4808,14 +4365,6 @@ "node": ">=8.0" } }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "engines": { - "node": ">=0.6" - } - }, "node_modules/ts-api-utils": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", @@ -4872,18 +4421,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/typed-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", @@ -5029,14 +4566,6 @@ "node": ">=10.0.0" } }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -5053,14 +4582,6 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/uuid": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", @@ -5080,14 +4601,6 @@ "dev": true, "peer": true }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/src/package.json b/src/package.json index 09cbfaa1..dc659c31 100644 --- a/src/package.json +++ b/src/package.json @@ -15,7 +15,6 @@ "dependencies": { "bcryptjs": "^2.4.3", "debug": "^4.3.4", - "express": "^4.18.3", "express-session": "^1.18.0", "h3": "^1.11.1", "qrcode": "^1.5.3", From ee5a2c6c5a63631f8d3b8b435a98cca98ee7a088 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Fri, 15 Mar 2024 15:17:41 +0100 Subject: [PATCH 030/115] Server.js: remove cookie setting Proxy is recommended else use only internally --- src/lib/Server.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index 13a5d51d..bf8c50e6 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -33,9 +33,6 @@ module.exports = class Server { secret: crypto.randomBytes(256).toString('hex'), resave: true, saveUninitialized: true, - cookie: { - httpOnly: true, - }, })) .get('/api/release', (Util.promisify(async () => { From e2242daef125fcfae2b721f9dbef605235879c6c Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Fri, 15 Mar 2024 14:18:17 +0000 Subject: [PATCH 031/115] npm: package updates --- src/package-lock.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index e5a62c08..ba8d3011 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -982,12 +982,15 @@ "integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==" }, "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/body-parser": { From 3cb83dc53aa5a401f689319d10ceab69333af85d Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:07:42 +0100 Subject: [PATCH 032/115] deploy.yml: rebuild v11 mistake --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 332b3a76..1d73dcfc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: production + ref: 80310bfd95cd023db30ed11152bbef5fc7c4436a - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 8ce2d44c0873c641c451f3c8172ae201cbe03fd4 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:21:25 +0100 Subject: [PATCH 033/115] Update deploy.yml --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1d73dcfc..332b3a76 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: 80310bfd95cd023db30ed11152bbef5fc7c4436a + ref: production - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 3d117309263d93397a84f46afa14b7ef747aec5d Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 12:15:50 +0300 Subject: [PATCH 034/115] Fix traffic charts. Add chart vars Add UI_TRAFFIC_STATS, UI_CHART_TYPE --- src/.env | 3 ++ src/config.js | 1 + src/lib/Server.js | 4 ++ src/www/index.html | 8 ++-- src/www/js/api.js | 7 +++ src/www/js/app.js | 111 ++++++++++++++++++++++++++++++++++++++------- 6 files changed, 113 insertions(+), 21 deletions(-) create mode 100644 src/.env diff --git a/src/.env b/src/.env new file mode 100644 index 00000000..122fe628 --- /dev/null +++ b/src/.env @@ -0,0 +1,3 @@ +WG_HOST=127.0.0.1 +UI_TRAFFIC_STATS=true +UI_CHART_TYPE=2 \ No newline at end of file diff --git a/src/config.js b/src/config.js index a8fe2c38..1fff4c27 100644 --- a/src/config.js +++ b/src/config.js @@ -35,3 +35,4 @@ iptables -D FORWARD -o wg0 -j ACCEPT; `.split('\n').join(' '); module.exports.LANG = process.env.LANG || 'en'; module.exports.UI_TRAFFIC_STATS = process.env.UI_TRAFFIC_STATS || 'false'; +module.exports.UI_CHART_TYPE = process.env.UI_CHART_TYPE || 0; diff --git a/src/lib/Server.js b/src/lib/Server.js index bf8c50e6..901f1a05 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -19,6 +19,7 @@ const { PASSWORD, LANG, UI_TRAFFIC_STATS, + UI_CHART_TYPE, } = require('../config'); module.exports = class Server { @@ -45,6 +46,9 @@ module.exports = class Server { .get('/api/ui-traffic-stats', (Util.promisify(async () => { return UI_TRAFFIC_STATS === 'true'; }))) + .get('/api/ui-chart-type', (Util.promisify(async () => { + return UI_CHART_TYPE || 0; + }))) // Authentication .get('/api/session', Util.promisify(async (req) => { diff --git a/src/www/index.html b/src/www/index.html index 826cf526..25173644 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -77,12 +77,12 @@ class="relative overflow-hidden border-b last:border-b-0 border-gray-100 dark:border-neutral-600 border-solid"> -

- +
+
-
- +
diff --git a/src/www/js/api.js b/src/www/js/api.js index e69e5a3a..356164c5 100644 --- a/src/www/js/api.js +++ b/src/www/js/api.js @@ -50,6 +50,13 @@ class API { }); } + async getChartType() { + return this.call({ + method: 'get', + path: '/ui-chart-type', + }); + } + async getSession() { return this.call({ method: 'get', diff --git a/src/www/js/app.js b/src/www/js/app.js index 22fe3bfc..23252663 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -23,14 +23,33 @@ function bytes(bytes, decimals, kib, maxunit) { return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; } +const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); +const theme = darkModeMediaQuery.matches ? 'dark' : 'light'; + const i18n = new VueI18n({ locale: localStorage.getItem('lang') || 'en', fallbackLocale: 'en', messages, }); +const UI_CHART_TYPES = [ + { type: false, strokeWidth: 0 }, + { type: 'line', strokeWidth: 3 }, + { type: 'area', strokeWidth: 0 }, + { type: 'bar', strokeWidth: 0 }, +] + +const CHART_COLORS = { + rx: { light: 'rgba(0,0,0,0.2)', dark: 'rgba(255,255,255,0.3)' }, + tx: { light: 'rgba(0,0,0,0.3)', dark: 'rgba(255,255,255,0.5)' }, + gradient: {light: ['rgba(0,0,0,0.1)', 'rgba(0,0,0,0)'], dark: ['rgba(255,255,255,0.1)', 'rgba(255,255,255,0)']}, +} + new Vue({ el: '#app', + components: { + apexchart: VueApexCharts, + }, i18n, data: { authenticated: null, @@ -55,10 +74,11 @@ new Vue({ isDark: null, uiTrafficStats: false, + uiChartType: 0, + chartOptions: { chart: { background: 'transparent', - type: 'bar', stacked: false, toolbar: { show: false, @@ -67,10 +87,23 @@ new Vue({ enabled: false, }, }, - colors: [ - '#DDDDDD', // rx - '#EEEEEE', // tx - ], + colors: [], + stroke: { + curve: 'smooth', + }, + fill: { + type: 'gradient', + gradient: { + shade: 'dark', + type: 'vertical', + shadeIntensity: 1, + gradientToColors: CHART_COLORS.gradient[theme], + inverseColors: true, + opacityFrom: 1, + opacityTo: 1, + stops: [0, 100], + }, + }, dataLabels: { enabled: false, }, @@ -135,7 +168,7 @@ new Vue({ updateCharts = false, } = {}) { if (!this.authenticated) return; - + const clients = await this.api.getClients(); this.clients = clients.map((client) => { if (client.name.includes('@') && client.name.includes('.')) { @@ -154,26 +187,40 @@ new Vue({ // client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; // client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; + this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; + this.clientsPersist[client.id].transferRxPrevious = client.transferRx; + this.clientsPersist[client.id].transferTxCurrent = client.transferTx - this.clientsPersist[client.id].transferTxPrevious; + this.clientsPersist[client.id].transferTxPrevious = client.transferTx; + if (updateCharts) { - this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; - this.clientsPersist[client.id].transferRxPrevious = client.transferRx; - this.clientsPersist[client.id].transferTxCurrent = client.transferTx - this.clientsPersist[client.id].transferTxPrevious; - this.clientsPersist[client.id].transferTxPrevious = client.transferTx; this.clientsPersist[client.id].transferRxHistory.push(this.clientsPersist[client.id].transferRxCurrent); this.clientsPersist[client.id].transferRxHistory.shift(); this.clientsPersist[client.id].transferTxHistory.push(this.clientsPersist[client.id].transferTxCurrent); this.clientsPersist[client.id].transferTxHistory.shift(); + + this.clientsPersist[client.id].transferTxSeries = [{ + name: 'Tx', + data: this.clientsPersist[client.id].transferTxHistory, + }]; + + this.clientsPersist[client.id].transferRxSeries = [{ + name: 'Rx', + data: this.clientsPersist[client.id].transferRxHistory, + }]; + + client.transferTxHistory = this.clientsPersist[client.id].transferTxHistory; + client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory; + client.transferMax = Math.max(...client.transferTxHistory, ...client.transferRxHistory); + + client.transferTxSeries = this.clientsPersist[client.id].transferTxSeries; + client.transferRxSeries = this.clientsPersist[client.id].transferRxSeries; } client.transferTxCurrent = this.clientsPersist[client.id].transferTxCurrent; client.transferRxCurrent = this.clientsPersist[client.id].transferRxCurrent; - client.transferTxHistory = this.clientsPersist[client.id].transferTxHistory; - client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory; - client.transferMax = Math.max(...client.transferTxHistory, ...client.transferRxHistory); - client.hoverTx = this.clientsPersist[client.id].hoverTx; client.hoverRx = this.clientsPersist[client.id].hoverRx; @@ -278,7 +325,7 @@ new Vue({ this.authenticated = session.authenticated; this.requiresPassword = session.requiresPassword; this.refresh({ - updateCharts: true, + updateCharts: this.updateCharts, }).catch((err) => { alert(err.message || err.toString()); }); @@ -289,7 +336,7 @@ new Vue({ setInterval(() => { this.refresh({ - updateCharts: true, + updateCharts: this.updateCharts, }).catch(console.error); }, 1000); @@ -298,9 +345,16 @@ new Vue({ this.uiTrafficStats = res; }) .catch(() => { - console.log('Failed to get ui-traffic-stats'); this.uiTrafficStats = false; }); + + this.api.getChartType() + .then((res) => { + this.uiChartType = parseInt(res); + }) + .catch(() => { + this.uiChartType = 0; + }); Promise.resolve().then(async () => { const lang = await this.api.getLang(); @@ -333,4 +387,27 @@ new Vue({ this.latestRelease = latestRelease; }).catch((err) => console.error(err)); }, + computed: { + chartOptionsTX() { + const opts = { + ...this.chartOptions, + colors: [CHART_COLORS.tx[theme]], + }; + opts.chart.type = UI_CHART_TYPES[this.uiChartType].type || false; + opts.stroke.width = UI_CHART_TYPES[this.uiChartType].strokeWidth; + return opts; + }, + chartOptionsRX() { + const opts = { + ...this.chartOptions, + colors: [CHART_COLORS.rx[theme]], + }; + opts.chart.type = UI_CHART_TYPES[this.uiChartType].type || false; + opts.stroke.width = UI_CHART_TYPES[this.uiChartType].strokeWidth; + return opts; + }, + updateCharts() { + return this.uiChartType > 0; + } + }, }); From 73242c61c382f85bd9bf675305ce7f7536ca4424 Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 12:28:21 +0300 Subject: [PATCH 035/115] Remove .env from repo --- src/.env | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/.env diff --git a/src/.env b/src/.env deleted file mode 100644 index 122fe628..00000000 --- a/src/.env +++ /dev/null @@ -1,3 +0,0 @@ -WG_HOST=127.0.0.1 -UI_TRAFFIC_STATS=true -UI_CHART_TYPE=2 \ No newline at end of file From 166a58a68513734ae5d1191c33bb9f760d84d5d6 Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 13:24:24 +0300 Subject: [PATCH 036/115] Fix charts on mobile --- src/www/css/app.css | 10 +++++----- src/www/index.html | 6 +++--- src/www/js/app.js | 13 +++++++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/www/css/app.css b/src/www/css/app.css index 00837d4c..9c6c85fd 100644 --- a/src/www/css/app.css +++ b/src/www/css/app.css @@ -1141,11 +1141,6 @@ video { padding-bottom: 0.75rem; } -.py-5 { - padding-top: 1.25rem; - padding-bottom: 1.25rem; -} - .pb-1 { padding-bottom: 0.25rem; } @@ -1597,6 +1592,11 @@ video { padding-right: 0px; } + .md\:py-5 { + padding-top: 1.25rem; + padding-bottom: 1.25rem; + } + .md\:pb-0 { padding-bottom: 0px; } diff --git a/src/www/index.html b/src/www/index.html index 25173644..2b1b7ba8 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -77,17 +77,17 @@ class="relative overflow-hidden border-b last:border-b-0 border-gray-100 dark:border-neutral-600 border-solid"> -
+
-
+
-
+
diff --git a/src/www/js/app.js b/src/www/js/app.js index 23252663..b0166129 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -86,6 +86,10 @@ new Vue({ animations: { enabled: false, }, + parentHeightOffset: 0, + sparkline: { + enabled: true, + } }, colors: [], stroke: { @@ -117,10 +121,10 @@ new Vue({ show: false, }, axisTicks: { - show: true, + show: false, }, axisBorder: { - show: true, + show: false, }, }, yaxis: { @@ -184,8 +188,9 @@ new Vue({ } // Debug - // client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; - // client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; + client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; + client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; + client.latestHandshakeAt = new Date(); this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; this.clientsPersist[client.id].transferRxPrevious = client.transferRx; From ccde2fdfd369e6df964827331fe0b0adc8a8b10a Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 13:26:27 +0300 Subject: [PATCH 037/115] Disable debug --- src/www/js/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/www/js/app.js b/src/www/js/app.js index b0166129..61d1ceeb 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -188,9 +188,9 @@ new Vue({ } // Debug - client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; - client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; - client.latestHandshakeAt = new Date(); + // client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; + // client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; + // client.latestHandshakeAt = new Date(); this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; this.clientsPersist[client.id].transferRxPrevious = client.transferRx; From 12b72cf3894dc2ee667b1676ad3ac5915ea96ef8 Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 13:51:32 +0300 Subject: [PATCH 038/115] Fix lint errors --- src/www/js/app.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/www/js/app.js b/src/www/js/app.js index 61d1ceeb..a2536ed6 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -37,13 +37,13 @@ const UI_CHART_TYPES = [ { type: 'line', strokeWidth: 3 }, { type: 'area', strokeWidth: 0 }, { type: 'bar', strokeWidth: 0 }, -] +]; const CHART_COLORS = { rx: { light: 'rgba(0,0,0,0.2)', dark: 'rgba(255,255,255,0.3)' }, tx: { light: 'rgba(0,0,0,0.3)', dark: 'rgba(255,255,255,0.5)' }, - gradient: {light: ['rgba(0,0,0,0.1)', 'rgba(0,0,0,0)'], dark: ['rgba(255,255,255,0.1)', 'rgba(255,255,255,0)']}, -} + gradient: { light: ['rgba(0,0,0,0.1)', 'rgba(0,0,0,0)'], dark: ['rgba(255,255,255,0.1)', 'rgba(255,255,255,0)'] }, +}; new Vue({ el: '#app', @@ -89,7 +89,7 @@ new Vue({ parentHeightOffset: 0, sparkline: { enabled: true, - } + }, }, colors: [], stroke: { @@ -107,7 +107,7 @@ new Vue({ opacityTo: 1, stops: [0, 100], }, - }, + }, dataLabels: { enabled: false, }, @@ -172,7 +172,7 @@ new Vue({ updateCharts = false, } = {}) { if (!this.authenticated) return; - + const clients = await this.api.getClients(); this.clients = clients.map((client) => { if (client.name.includes('@') && client.name.includes('.')) { @@ -198,7 +198,6 @@ new Vue({ this.clientsPersist[client.id].transferTxPrevious = client.transferTx; if (updateCharts) { - this.clientsPersist[client.id].transferRxHistory.push(this.clientsPersist[client.id].transferRxCurrent); this.clientsPersist[client.id].transferRxHistory.shift(); @@ -352,10 +351,10 @@ new Vue({ .catch(() => { this.uiTrafficStats = false; }); - + this.api.getChartType() .then((res) => { - this.uiChartType = parseInt(res); + this.uiChartType = parseInt(res, 10); }) .catch(() => { this.uiChartType = 0; @@ -413,6 +412,6 @@ new Vue({ }, updateCharts() { return this.uiChartType > 0; - } + }, }, }); From 4d5a5c9e0d9e7c0f3fb416c6030f95e4f9422b9d Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:43:51 +0100 Subject: [PATCH 039/115] docker-compose.yml: add UI_CHART_TYPE --- docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a489356f..e118115f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,8 @@ services: # - WG_POST_UP=echo "Post Up" > /etc/wireguard/post-up.txt # - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt # - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt - # - UI_TRAFFIC_STATS=true + # - UI_TRAFFIC_STATS=true + # - UI_CHART_TYPE=0 (0 # Charts disabled, 1 # Line chart, 2 # Area chart, 3 # Bar chart) image: ghcr.io/wg-easy/wg-easy container_name: wg-easy From f7bd362538848f0c2806133ca1466ea72a265e50 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Fri, 15 Mar 2024 15:23:12 +0100 Subject: [PATCH 040/115] fixup: Server.js --- src/lib/Server.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index 292c3085..1ccf005a 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -43,9 +43,6 @@ module.exports = class Server { secret: crypto.randomBytes(256).toString('hex'), resave: true, saveUninitialized: true, - cookie: { - httpOnly: true, - }, }))); const router = createRouter(); From f3a8ff649071c53e863403d1d5c09cc0137c81d4 Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Sun, 17 Mar 2024 11:26:38 +0300 Subject: [PATCH 041/115] Add dark/light mode toggle. Add chart toggle Change dark/light mode detection Add saving uiShowCharts to local storage Add saving uiTheme to local storage Add ui buttons --- src/tailwind.config.js | 2 +- src/www/css/app.css | 391 ++++++++++++++++++++++++----------------- src/www/index.html | 65 +++++-- src/www/js/app.js | 65 ++++--- src/www/js/i18n.js | 2 + 5 files changed, 314 insertions(+), 211 deletions(-) diff --git a/src/tailwind.config.js b/src/tailwind.config.js index 33ba6746..bc7b40da 100644 --- a/src/tailwind.config.js +++ b/src/tailwind.config.js @@ -3,7 +3,7 @@ 'use strict'; module.exports = { - darkMode: 'media', + darkMode: 'selector', content: ['./www/**/*.{html,js}'], theme: { screens: { diff --git a/src/www/css/app.css b/src/www/css/app.css index 9c6c85fd..2564cdd8 100644 --- a/src/www/css/app.css +++ b/src/www/css/app.css @@ -590,6 +590,18 @@ video { } } +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + .visible { visibility: visible; } @@ -692,8 +704,8 @@ video { margin-bottom: 2.5rem; } -.mb-2 { - margin-bottom: 0.5rem; +.mb-4 { + margin-bottom: 1rem; } .mb-5 { @@ -736,6 +748,10 @@ video { margin-top: 1.25rem; } +.mt-6 { + margin-top: 1.5rem; +} + .mt-px { margin-top: 1px; } @@ -804,10 +820,18 @@ video { height: 1rem; } +.h-5 { + height: 1.25rem; +} + .h-6 { height: 1.5rem; } +.h-8 { + height: 2rem; +} + .min-h-screen { min-height: 100vh; } @@ -925,6 +949,10 @@ video { flex-wrap: wrap; } +.items-end { + align-items: flex-end; +} + .items-center { align-items: center; } @@ -1087,6 +1115,14 @@ video { --tw-bg-opacity: 0.5; } +.fill-gray-400 { + fill: #9ca3af; +} + +.fill-gray-600 { + fill: #4b5563; +} + .p-1 { padding: 0.25rem; } @@ -1271,6 +1307,11 @@ video { color: rgb(17 24 39 / var(--tw-text-opacity)); } +.text-neutral-400 { + --tw-text-opacity: 1; + color: rgb(163 163 163 / var(--tw-text-opacity)); +} + .text-red-600 { --tw-text-opacity: 1; color: rgb(220 38 38 / var(--tw-text-opacity)); @@ -1458,6 +1499,10 @@ video { opacity: 1; } +.peer:checked ~ .peer-checked\:fill-gray-600 { + fill: #4b5563; +} + @media (min-width: 450px) { .xxs\:flex-row { flex-direction: row; @@ -1607,208 +1652,222 @@ video { } } -@media (prefers-color-scheme: dark) { - .dark\:border-neutral-500 { - --tw-border-opacity: 1; - border-color: rgb(115 115 115 / var(--tw-border-opacity)); - } +.dark\:border-neutral-500:where(.dark, .dark *) { + --tw-border-opacity: 1; + border-color: rgb(115 115 115 / var(--tw-border-opacity)); +} - .dark\:border-neutral-600 { - --tw-border-opacity: 1; - border-color: rgb(82 82 82 / var(--tw-border-opacity)); - } +.dark\:border-neutral-600:where(.dark, .dark *) { + --tw-border-opacity: 1; + border-color: rgb(82 82 82 / var(--tw-border-opacity)); +} - .dark\:border-neutral-800 { - --tw-border-opacity: 1; - border-color: rgb(38 38 38 / var(--tw-border-opacity)); - } +.dark\:border-neutral-800:where(.dark, .dark *) { + --tw-border-opacity: 1; + border-color: rgb(38 38 38 / var(--tw-border-opacity)); +} - .dark\:border-red-600 { - --tw-border-opacity: 1; - border-color: rgb(220 38 38 / var(--tw-border-opacity)); - } +.dark\:border-red-600:where(.dark, .dark *) { + --tw-border-opacity: 1; + border-color: rgb(220 38 38 / var(--tw-border-opacity)); +} - .dark\:bg-black { - --tw-bg-opacity: 1; - background-color: rgb(0 0 0 / var(--tw-bg-opacity)); - } +.dark\:bg-black:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); +} - .dark\:bg-neutral-400 { - --tw-bg-opacity: 1; - background-color: rgb(163 163 163 / var(--tw-bg-opacity)); - } +.dark\:bg-neutral-400:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(163 163 163 / var(--tw-bg-opacity)); +} - .dark\:bg-neutral-500 { - --tw-bg-opacity: 1; - background-color: rgb(115 115 115 / var(--tw-bg-opacity)); - } +.dark\:bg-neutral-500:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(115 115 115 / var(--tw-bg-opacity)); +} - .dark\:bg-neutral-600 { - --tw-bg-opacity: 1; - background-color: rgb(82 82 82 / var(--tw-bg-opacity)); - } +.dark\:bg-neutral-600:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(82 82 82 / var(--tw-bg-opacity)); +} - .dark\:bg-neutral-700 { - --tw-bg-opacity: 1; - background-color: rgb(64 64 64 / var(--tw-bg-opacity)); - } +.dark\:bg-neutral-700:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(64 64 64 / var(--tw-bg-opacity)); +} - .dark\:bg-neutral-800 { - --tw-bg-opacity: 1; - background-color: rgb(38 38 38 / var(--tw-bg-opacity)); - } +.dark\:bg-neutral-800:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(38 38 38 / var(--tw-bg-opacity)); +} - .dark\:bg-red-100 { - --tw-bg-opacity: 1; - background-color: rgb(254 226 226 / var(--tw-bg-opacity)); - } +.dark\:bg-red-100:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(254 226 226 / var(--tw-bg-opacity)); +} - .dark\:bg-red-600 { - --tw-bg-opacity: 1; - background-color: rgb(220 38 38 / var(--tw-bg-opacity)); - } +.dark\:bg-red-600:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(220 38 38 / var(--tw-bg-opacity)); +} - .dark\:bg-red-800 { - --tw-bg-opacity: 1; - background-color: rgb(153 27 27 / var(--tw-bg-opacity)); - } +.dark\:bg-red-800:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(153 27 27 / var(--tw-bg-opacity)); +} - .dark\:text-gray-500 { - --tw-text-opacity: 1; - color: rgb(107 114 128 / var(--tw-text-opacity)); - } +.dark\:fill-neutral-400:where(.dark, .dark *) { + fill: #a3a3a3; +} - .dark\:text-neutral-200 { - --tw-text-opacity: 1; - color: rgb(229 229 229 / var(--tw-text-opacity)); - } +.dark\:fill-neutral-600:where(.dark, .dark *) { + fill: #525252; +} - .dark\:text-neutral-300 { - --tw-text-opacity: 1; - color: rgb(212 212 212 / var(--tw-text-opacity)); - } +.dark\:text-gray-500:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity)); +} - .dark\:text-neutral-400 { - --tw-text-opacity: 1; - color: rgb(163 163 163 / var(--tw-text-opacity)); - } +.dark\:text-neutral-200:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(229 229 229 / var(--tw-text-opacity)); +} - .dark\:text-neutral-50 { - --tw-text-opacity: 1; - color: rgb(250 250 250 / var(--tw-text-opacity)); - } +.dark\:text-neutral-300:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(212 212 212 / var(--tw-text-opacity)); +} - .dark\:text-neutral-500 { - --tw-text-opacity: 1; - color: rgb(115 115 115 / var(--tw-text-opacity)); - } +.dark\:text-neutral-400:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(163 163 163 / var(--tw-text-opacity)); +} - .dark\:text-neutral-600 { - --tw-text-opacity: 1; - color: rgb(82 82 82 / var(--tw-text-opacity)); - } +.dark\:text-neutral-50:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(250 250 250 / var(--tw-text-opacity)); +} - .dark\:text-red-300 { - --tw-text-opacity: 1; - color: rgb(252 165 165 / var(--tw-text-opacity)); - } +.dark\:text-neutral-500:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(115 115 115 / var(--tw-text-opacity)); +} - .dark\:text-red-600 { - --tw-text-opacity: 1; - color: rgb(220 38 38 / var(--tw-text-opacity)); - } +.dark\:text-neutral-600:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(82 82 82 / var(--tw-text-opacity)); +} - .dark\:text-white { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); - } +.dark\:text-red-300:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(252 165 165 / var(--tw-text-opacity)); +} - .dark\:opacity-50 { - opacity: 0.5; - } +.dark\:text-red-600:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(220 38 38 / var(--tw-text-opacity)); +} - .dark\:placeholder\:text-neutral-400::-moz-placeholder { - --tw-text-opacity: 1; - color: rgb(163 163 163 / var(--tw-text-opacity)); - } +.dark\:text-white:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} - .dark\:placeholder\:text-neutral-400::placeholder { - --tw-text-opacity: 1; - color: rgb(163 163 163 / var(--tw-text-opacity)); - } +.dark\:opacity-50:where(.dark, .dark *) { + opacity: 0.5; +} - .dark\:placeholder\:text-neutral-500::-moz-placeholder { - --tw-text-opacity: 1; - color: rgb(115 115 115 / var(--tw-text-opacity)); - } +.dark\:placeholder\:text-neutral-400:where(.dark, .dark *)::-moz-placeholder { + --tw-text-opacity: 1; + color: rgb(163 163 163 / var(--tw-text-opacity)); +} - .dark\:placeholder\:text-neutral-500::placeholder { - --tw-text-opacity: 1; - color: rgb(115 115 115 / var(--tw-text-opacity)); - } +.dark\:placeholder\:text-neutral-400:where(.dark, .dark *)::placeholder { + --tw-text-opacity: 1; + color: rgb(163 163 163 / var(--tw-text-opacity)); +} - .dark\:hover\:border-neutral-600:hover { - --tw-border-opacity: 1; - border-color: rgb(82 82 82 / var(--tw-border-opacity)); - } +.dark\:placeholder\:text-neutral-500:where(.dark, .dark *)::-moz-placeholder { + --tw-text-opacity: 1; + color: rgb(115 115 115 / var(--tw-text-opacity)); +} - .dark\:hover\:border-red-600:hover { - --tw-border-opacity: 1; - border-color: rgb(220 38 38 / var(--tw-border-opacity)); - } +.dark\:placeholder\:text-neutral-500:where(.dark, .dark *)::placeholder { + --tw-text-opacity: 1; + color: rgb(115 115 115 / var(--tw-text-opacity)); +} - .dark\:hover\:bg-neutral-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(115 115 115 / var(--tw-bg-opacity)); - } +.dark\:hover\:border-neutral-600:hover:where(.dark, .dark *) { + --tw-border-opacity: 1; + border-color: rgb(82 82 82 / var(--tw-border-opacity)); +} - .dark\:hover\:bg-neutral-600:hover { - --tw-bg-opacity: 1; - background-color: rgb(82 82 82 / var(--tw-bg-opacity)); - } +.dark\:hover\:border-red-600:hover:where(.dark, .dark *) { + --tw-border-opacity: 1; + border-color: rgb(220 38 38 / var(--tw-border-opacity)); +} - .dark\:hover\:bg-red-600:hover { - --tw-bg-opacity: 1; - background-color: rgb(220 38 38 / var(--tw-bg-opacity)); - } +.dark\:hover\:bg-neutral-500:hover:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(115 115 115 / var(--tw-bg-opacity)); +} - .dark\:hover\:bg-red-700:hover { - --tw-bg-opacity: 1; - background-color: rgb(185 28 28 / var(--tw-bg-opacity)); - } +.dark\:hover\:bg-neutral-600:hover:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(82 82 82 / var(--tw-bg-opacity)); +} - .dark\:hover\:bg-red-800:hover { - --tw-bg-opacity: 1; - background-color: rgb(153 27 27 / var(--tw-bg-opacity)); - } +.dark\:hover\:bg-red-600:hover:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(220 38 38 / var(--tw-bg-opacity)); +} - .dark\:hover\:text-neutral-700:hover { - --tw-text-opacity: 1; - color: rgb(64 64 64 / var(--tw-text-opacity)); - } +.dark\:hover\:bg-red-700:hover:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(185 28 28 / var(--tw-bg-opacity)); +} - .dark\:hover\:text-red-100:hover { - --tw-text-opacity: 1; - color: rgb(254 226 226 / var(--tw-text-opacity)); - } +.dark\:hover\:bg-red-800:hover:where(.dark, .dark *) { + --tw-bg-opacity: 1; + background-color: rgb(153 27 27 / var(--tw-bg-opacity)); +} - .dark\:hover\:text-white:hover { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); - } +.dark\:hover\:text-neutral-700:hover:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(64 64 64 / var(--tw-text-opacity)); +} - .dark\:focus\:border-neutral-500:focus { - --tw-border-opacity: 1; - border-color: rgb(115 115 115 / var(--tw-border-opacity)); - } +.dark\:hover\:text-red-100:hover:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(254 226 226 / var(--tw-text-opacity)); +} - .dark\:focus\:border-red-800:focus { - --tw-border-opacity: 1; - border-color: rgb(153 27 27 / var(--tw-border-opacity)); - } +.dark\:hover\:text-white:hover:where(.dark, .dark *) { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} - .focus\:dark\:border-neutral-500:focus { - --tw-border-opacity: 1; - border-color: rgb(115 115 115 / var(--tw-border-opacity)); - } +.dark\:focus\:border-neutral-500:focus:where(.dark, .dark *) { + --tw-border-opacity: 1; + border-color: rgb(115 115 115 / var(--tw-border-opacity)); +} + +.dark\:focus\:border-red-800:focus:where(.dark, .dark *) { + --tw-border-opacity: 1; + border-color: rgb(153 27 27 / var(--tw-border-opacity)); +} + +.focus\:dark\:border-neutral-500:where(.dark, .dark *):focus { + --tw-border-opacity: 1; + border-color: rgb(115 115 115 / var(--tw-border-opacity)); +} + +.group:hover .group-hover\:dark\:fill-neutral-500:where(.dark, .dark *) { + fill: #737373; +} + +.peer:checked ~ .peer-checked\:dark\:fill-neutral-400:where(.dark, .dark *) { + fill: #a3a3a3; } diff --git a/src/www/index.html b/src/www/index.html index 2b1b7ba8..d5fdd956 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -18,25 +18,54 @@
-
+
- - {{$t("logout")}} - - - - - -

- - WireGuard -

-

- +
+

+ WireGuard +

+ + + + + + {{$t("logout")}} + + + + +
+
diff --git a/src/www/js/app.js b/src/www/js/app.js index a2536ed6..472c6d3d 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -23,9 +23,6 @@ function bytes(bytes, decimals, kib, maxunit) { return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; } -const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); -const theme = darkModeMediaQuery.matches ? 'dark' : 'light'; - const i18n = new VueI18n({ locale: localStorage.getItem('lang') || 'en', fallbackLocale: 'en', @@ -40,9 +37,9 @@ const UI_CHART_TYPES = [ ]; const CHART_COLORS = { - rx: { light: 'rgba(0,0,0,0.2)', dark: 'rgba(255,255,255,0.3)' }, - tx: { light: 'rgba(0,0,0,0.3)', dark: 'rgba(255,255,255,0.5)' }, - gradient: { light: ['rgba(0,0,0,0.1)', 'rgba(0,0,0,0)'], dark: ['rgba(255,255,255,0.1)', 'rgba(255,255,255,0)'] }, + rx: { light: 'rgba(128,128,128,0.3)', dark: 'rgba(255,255,255,0.3)' }, + tx: { light: 'rgba(128,128,128,0.4)', dark: 'rgba(255,255,255,0.3)' }, + gradient: { light: ['rgba(0,0,0,1.0)', 'rgba(0,0,0,1.0)'], dark: ['rgba(128,128,128,0)', 'rgba(128,128,128,0)'] }, }; new Vue({ @@ -71,10 +68,12 @@ new Vue({ currentRelease: null, latestRelease: null, - isDark: null, uiTrafficStats: false, uiChartType: 0, + uiShowCharts: localStorage.getItem('uiShowCharts') === "1" ? true : false, + uiTheme: localStorage.theme || 'auto', + prefersDarkScheme: window.matchMedia('(prefers-color-scheme: dark)'), chartOptions: { chart: { @@ -100,11 +99,10 @@ new Vue({ gradient: { shade: 'dark', type: 'vertical', - shadeIntensity: 1, - gradientToColors: CHART_COLORS.gradient[theme], - inverseColors: true, - opacityFrom: 1, - opacityTo: 1, + shadeIntensity: 0, + gradientToColors: CHART_COLORS.gradient[this.theme], + inverseColors: false, + opacityTo: 0, stops: [0, 100], }, }, @@ -301,15 +299,26 @@ new Vue({ .finally(() => this.refresh().catch(console.error)); }, toggleTheme() { - if (this.isDark) { - localStorage.theme = 'light'; - document.documentElement.classList.remove('dark'); - } else { - localStorage.theme = 'dark'; - document.documentElement.classList.add('dark'); + const themes = ['light', 'dark', 'auto']; + const currentIndex = themes.indexOf(this.uiTheme); + const newIndex = (currentIndex + 1) % themes.length; + this.uiTheme = themes[newIndex]; + localStorage.theme = this.uiTheme; + this.setTheme(this.uiTheme); + }, + setTheme(theme) { + const { classList } = document.documentElement; + const shouldAddDarkClass = theme === 'dark' || (theme === 'auto' && this.prefersDarkScheme.matches); + classList.toggle('dark', shouldAddDarkClass); + }, + handlePrefersChange(e) { + if (localStorage.theme === 'auto') { + this.setTheme(e.matches ? 'dark' : 'light'); } - this.isDark = !this.isDark; }, + toggleCharts() { + localStorage.setItem('uiShowCharts', this.uiShowCharts ? 1 : 0); + } }, filters: { bytes, @@ -318,10 +327,8 @@ new Vue({ }, }, mounted() { - this.isDark = false; - if (localStorage.theme === 'dark') { - this.isDark = true; - } + this.prefersDarkScheme.addListener(this.handlePrefersChange); + this.setTheme(this.uiTheme); this.api = new API(); this.api.getSession() @@ -395,7 +402,7 @@ new Vue({ chartOptionsTX() { const opts = { ...this.chartOptions, - colors: [CHART_COLORS.tx[theme]], + colors: [CHART_COLORS.tx[this.theme]], }; opts.chart.type = UI_CHART_TYPES[this.uiChartType].type || false; opts.stroke.width = UI_CHART_TYPES[this.uiChartType].strokeWidth; @@ -404,14 +411,20 @@ new Vue({ chartOptionsRX() { const opts = { ...this.chartOptions, - colors: [CHART_COLORS.rx[theme]], + colors: [CHART_COLORS.rx[this.theme]], }; opts.chart.type = UI_CHART_TYPES[this.uiChartType].type || false; opts.stroke.width = UI_CHART_TYPES[this.uiChartType].strokeWidth; return opts; }, updateCharts() { - return this.uiChartType > 0; + return this.uiChartType > 0 && this.uiShowCharts; + }, + theme() { + if (this.uiTheme === 'auto') { + return this.prefersDarkScheme.matches ? 'dark' : 'light'; + } + return this.uiTheme; }, }, }); diff --git a/src/www/js/i18n.js b/src/www/js/i18n.js index a1962708..82fe64c8 100644 --- a/src/www/js/i18n.js +++ b/src/www/js/i18n.js @@ -28,6 +28,8 @@ const messages = { // eslint-disable-line no-unused-vars downloadConfig: 'Download Configuration', madeBy: 'Made by', donate: 'Donate', + toggleCharts: 'Show/hide Charts', + theme: { dark: 'Dark theme', light: 'Light theme', auto: 'Auto theme' } }, ua: { name: 'Ім`я', From 32fc78589afdd1a83de00cb62a5a596426c05a9a Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Sun, 17 Mar 2024 17:30:52 +0300 Subject: [PATCH 042/115] Lint --- src/www/js/app.js | 6 +++--- src/www/js/i18n.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/www/js/app.js b/src/www/js/app.js index 472c6d3d..4a30dc63 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -71,7 +71,7 @@ new Vue({ uiTrafficStats: false, uiChartType: 0, - uiShowCharts: localStorage.getItem('uiShowCharts') === "1" ? true : false, + uiShowCharts: localStorage.getItem('uiShowCharts') === '1', uiTheme: localStorage.theme || 'auto', prefersDarkScheme: window.matchMedia('(prefers-color-scheme: dark)'), @@ -189,6 +189,7 @@ new Vue({ // client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; // client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; // client.latestHandshakeAt = new Date(); + // this.requiresPassword = true; this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; this.clientsPersist[client.id].transferRxPrevious = client.transferRx; @@ -211,7 +212,6 @@ new Vue({ name: 'Rx', data: this.clientsPersist[client.id].transferRxHistory, }]; - client.transferTxHistory = this.clientsPersist[client.id].transferTxHistory; client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory; client.transferMax = Math.max(...client.transferTxHistory, ...client.transferRxHistory); @@ -318,7 +318,7 @@ new Vue({ }, toggleCharts() { localStorage.setItem('uiShowCharts', this.uiShowCharts ? 1 : 0); - } + }, }, filters: { bytes, diff --git a/src/www/js/i18n.js b/src/www/js/i18n.js index 82fe64c8..c976a204 100644 --- a/src/www/js/i18n.js +++ b/src/www/js/i18n.js @@ -29,7 +29,7 @@ const messages = { // eslint-disable-line no-unused-vars madeBy: 'Made by', donate: 'Donate', toggleCharts: 'Show/hide Charts', - theme: { dark: 'Dark theme', light: 'Light theme', auto: 'Auto theme' } + theme: { dark: 'Dark theme', light: 'Light theme', auto: 'Auto theme' }, }, ua: { name: 'Ім`я', From 90431ff9c5df68dbaed8eed7c3715716b8197675 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Mon, 18 Mar 2024 00:03:46 +0000 Subject: [PATCH 043/115] npm: package updates --- src/package-lock.json | 134 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 109 insertions(+), 25 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index ba8d3011..c3862633 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -1261,6 +1261,57 @@ "node": ">=4" } }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -1428,17 +1479,21 @@ } }, "node_modules/es-abstract": { - "version": "1.22.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.5.tgz", - "integrity": "sha512-oW69R+4q2wG+Hc3KZePPZxOiisRIqfKBVo/HLx94QcJeWGU/8sZhCvc829rd1kS366vlJbzBfXf9yWwf0+Ko7w==", + "version": "1.23.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.1.tgz", + "integrity": "sha512-r+YVn6hTqQb+P5kK0u3KeDqrmhHKm+OhU/Mw4jSL4eQtOxXmp75fXIUUb3sUqFZOlb/YtW5JRaIfEC3UyjYUZQ==", "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", "arraybuffer.prototype.slice": "^1.0.3", "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", "es-define-property": "^1.0.0", "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", "es-set-tostringtag": "^2.0.3", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", @@ -1449,10 +1504,11 @@ "has-property-descriptors": "^1.0.2", "has-proto": "^1.0.3", "has-symbols": "^1.0.3", - "hasown": "^2.0.1", + "hasown": "^2.0.2", "internal-slot": "^1.0.7", "is-array-buffer": "^3.0.4", "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", "is-negative-zero": "^2.0.3", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.3", @@ -1463,7 +1519,7 @@ "object-keys": "^1.1.1", "object.assign": "^4.1.5", "regexp.prototype.flags": "^1.5.2", - "safe-array-concat": "^1.1.0", + "safe-array-concat": "^1.1.2", "safe-regex-test": "^1.0.3", "string.prototype.trim": "^1.2.8", "string.prototype.trimend": "^1.0.7", @@ -1473,7 +1529,7 @@ "typed-array-byte-offset": "^1.0.2", "typed-array-length": "^1.0.5", "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.14" + "which-typed-array": "^1.1.15" }, "engines": { "node": ">= 0.4" @@ -1507,6 +1563,18 @@ "node": ">= 0.4" } }, + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-set-tostringtag": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", @@ -2884,6 +2952,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dev": true, + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-date-object": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", @@ -3725,9 +3808,9 @@ } }, "node_modules/postcss": { - "version": "8.4.35", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", - "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", + "version": "8.4.36", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.36.tgz", + "integrity": "sha512-/n7eumA6ZjFHAsbX30yhHup/IMkOmlmvtEi7P+6RMYf+bGJSUHc3geH4a0NSZxAz/RJfiS9tooCTs9LAVYUZKw==", "dev": true, "funding": [ { @@ -3746,7 +3829,7 @@ "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "source-map-js": "^1.1.0" }, "engines": { "node": "^10 || ^12 || >=14" @@ -4400,9 +4483,9 @@ } }, "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.1.0.tgz", + "integrity": "sha512-9vC2SfsJzlej6MAaMPLu8HiBSHGdRAJ9hVFYN1ibZoNkeanmDmLUcIrj6G9DGL7XMJ54AKg/G75akXl1/izTOw==", "dev": true, "engines": { "node": ">=0.10.0" @@ -4452,14 +4535,15 @@ } }, "node_modules/string.prototype.trim": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", - "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -4469,14 +4553,14 @@ } }, "node_modules/string.prototype.trimend": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", - "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" From 81ccf8762dff986a332de2ea8090b8c4b9ee5160 Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Mon, 18 Mar 2024 10:05:12 +0300 Subject: [PATCH 044/115] Header mobile layout --- src/www/index.html | 86 ++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/src/www/index.html b/src/www/index.html index d5fdd956..a3fa6837 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -18,52 +18,54 @@
-
+
-
-

+
+

WireGuard

- - - -
Date: Tue, 12 Mar 2024 19:07:42 +0100 Subject: [PATCH 045/115] deploy.yml: rebuild v11 mistake --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 332b3a76..1d73dcfc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: production + ref: 80310bfd95cd023db30ed11152bbef5fc7c4436a - name: Set up QEMU uses: docker/setup-qemu-action@v3 From ed0e46788a351d289d2d32df95fbde0d189605a5 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:21:25 +0100 Subject: [PATCH 046/115] Update deploy.yml --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1d73dcfc..332b3a76 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: 80310bfd95cd023db30ed11152bbef5fc7c4436a + ref: production - name: Set up QEMU uses: docker/setup-qemu-action@v3 From aedb691b2bc8c06de7d9e45cdba910024fe25f32 Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 12:15:50 +0300 Subject: [PATCH 047/115] Fix traffic charts. Add chart vars Add UI_TRAFFIC_STATS, UI_CHART_TYPE --- src/.env | 3 ++ src/config.js | 1 + src/lib/Server.js | 4 ++ src/www/index.html | 8 ++-- src/www/js/api.js | 7 +++ src/www/js/app.js | 111 ++++++++++++++++++++++++++++++++++++++------- 6 files changed, 113 insertions(+), 21 deletions(-) create mode 100644 src/.env diff --git a/src/.env b/src/.env new file mode 100644 index 00000000..122fe628 --- /dev/null +++ b/src/.env @@ -0,0 +1,3 @@ +WG_HOST=127.0.0.1 +UI_TRAFFIC_STATS=true +UI_CHART_TYPE=2 \ No newline at end of file diff --git a/src/config.js b/src/config.js index a8fe2c38..1fff4c27 100644 --- a/src/config.js +++ b/src/config.js @@ -35,3 +35,4 @@ iptables -D FORWARD -o wg0 -j ACCEPT; `.split('\n').join(' '); module.exports.LANG = process.env.LANG || 'en'; module.exports.UI_TRAFFIC_STATS = process.env.UI_TRAFFIC_STATS || 'false'; +module.exports.UI_CHART_TYPE = process.env.UI_CHART_TYPE || 0; diff --git a/src/lib/Server.js b/src/lib/Server.js index bf8c50e6..901f1a05 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -19,6 +19,7 @@ const { PASSWORD, LANG, UI_TRAFFIC_STATS, + UI_CHART_TYPE, } = require('../config'); module.exports = class Server { @@ -45,6 +46,9 @@ module.exports = class Server { .get('/api/ui-traffic-stats', (Util.promisify(async () => { return UI_TRAFFIC_STATS === 'true'; }))) + .get('/api/ui-chart-type', (Util.promisify(async () => { + return UI_CHART_TYPE || 0; + }))) // Authentication .get('/api/session', Util.promisify(async (req) => { diff --git a/src/www/index.html b/src/www/index.html index 826cf526..25173644 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -77,12 +77,12 @@ class="relative overflow-hidden border-b last:border-b-0 border-gray-100 dark:border-neutral-600 border-solid"> -
- +
+
-
- +
diff --git a/src/www/js/api.js b/src/www/js/api.js index e69e5a3a..356164c5 100644 --- a/src/www/js/api.js +++ b/src/www/js/api.js @@ -50,6 +50,13 @@ class API { }); } + async getChartType() { + return this.call({ + method: 'get', + path: '/ui-chart-type', + }); + } + async getSession() { return this.call({ method: 'get', diff --git a/src/www/js/app.js b/src/www/js/app.js index 22fe3bfc..23252663 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -23,14 +23,33 @@ function bytes(bytes, decimals, kib, maxunit) { return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; } +const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); +const theme = darkModeMediaQuery.matches ? 'dark' : 'light'; + const i18n = new VueI18n({ locale: localStorage.getItem('lang') || 'en', fallbackLocale: 'en', messages, }); +const UI_CHART_TYPES = [ + { type: false, strokeWidth: 0 }, + { type: 'line', strokeWidth: 3 }, + { type: 'area', strokeWidth: 0 }, + { type: 'bar', strokeWidth: 0 }, +] + +const CHART_COLORS = { + rx: { light: 'rgba(0,0,0,0.2)', dark: 'rgba(255,255,255,0.3)' }, + tx: { light: 'rgba(0,0,0,0.3)', dark: 'rgba(255,255,255,0.5)' }, + gradient: {light: ['rgba(0,0,0,0.1)', 'rgba(0,0,0,0)'], dark: ['rgba(255,255,255,0.1)', 'rgba(255,255,255,0)']}, +} + new Vue({ el: '#app', + components: { + apexchart: VueApexCharts, + }, i18n, data: { authenticated: null, @@ -55,10 +74,11 @@ new Vue({ isDark: null, uiTrafficStats: false, + uiChartType: 0, + chartOptions: { chart: { background: 'transparent', - type: 'bar', stacked: false, toolbar: { show: false, @@ -67,10 +87,23 @@ new Vue({ enabled: false, }, }, - colors: [ - '#DDDDDD', // rx - '#EEEEEE', // tx - ], + colors: [], + stroke: { + curve: 'smooth', + }, + fill: { + type: 'gradient', + gradient: { + shade: 'dark', + type: 'vertical', + shadeIntensity: 1, + gradientToColors: CHART_COLORS.gradient[theme], + inverseColors: true, + opacityFrom: 1, + opacityTo: 1, + stops: [0, 100], + }, + }, dataLabels: { enabled: false, }, @@ -135,7 +168,7 @@ new Vue({ updateCharts = false, } = {}) { if (!this.authenticated) return; - + const clients = await this.api.getClients(); this.clients = clients.map((client) => { if (client.name.includes('@') && client.name.includes('.')) { @@ -154,26 +187,40 @@ new Vue({ // client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; // client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; + this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; + this.clientsPersist[client.id].transferRxPrevious = client.transferRx; + this.clientsPersist[client.id].transferTxCurrent = client.transferTx - this.clientsPersist[client.id].transferTxPrevious; + this.clientsPersist[client.id].transferTxPrevious = client.transferTx; + if (updateCharts) { - this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; - this.clientsPersist[client.id].transferRxPrevious = client.transferRx; - this.clientsPersist[client.id].transferTxCurrent = client.transferTx - this.clientsPersist[client.id].transferTxPrevious; - this.clientsPersist[client.id].transferTxPrevious = client.transferTx; this.clientsPersist[client.id].transferRxHistory.push(this.clientsPersist[client.id].transferRxCurrent); this.clientsPersist[client.id].transferRxHistory.shift(); this.clientsPersist[client.id].transferTxHistory.push(this.clientsPersist[client.id].transferTxCurrent); this.clientsPersist[client.id].transferTxHistory.shift(); + + this.clientsPersist[client.id].transferTxSeries = [{ + name: 'Tx', + data: this.clientsPersist[client.id].transferTxHistory, + }]; + + this.clientsPersist[client.id].transferRxSeries = [{ + name: 'Rx', + data: this.clientsPersist[client.id].transferRxHistory, + }]; + + client.transferTxHistory = this.clientsPersist[client.id].transferTxHistory; + client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory; + client.transferMax = Math.max(...client.transferTxHistory, ...client.transferRxHistory); + + client.transferTxSeries = this.clientsPersist[client.id].transferTxSeries; + client.transferRxSeries = this.clientsPersist[client.id].transferRxSeries; } client.transferTxCurrent = this.clientsPersist[client.id].transferTxCurrent; client.transferRxCurrent = this.clientsPersist[client.id].transferRxCurrent; - client.transferTxHistory = this.clientsPersist[client.id].transferTxHistory; - client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory; - client.transferMax = Math.max(...client.transferTxHistory, ...client.transferRxHistory); - client.hoverTx = this.clientsPersist[client.id].hoverTx; client.hoverRx = this.clientsPersist[client.id].hoverRx; @@ -278,7 +325,7 @@ new Vue({ this.authenticated = session.authenticated; this.requiresPassword = session.requiresPassword; this.refresh({ - updateCharts: true, + updateCharts: this.updateCharts, }).catch((err) => { alert(err.message || err.toString()); }); @@ -289,7 +336,7 @@ new Vue({ setInterval(() => { this.refresh({ - updateCharts: true, + updateCharts: this.updateCharts, }).catch(console.error); }, 1000); @@ -298,9 +345,16 @@ new Vue({ this.uiTrafficStats = res; }) .catch(() => { - console.log('Failed to get ui-traffic-stats'); this.uiTrafficStats = false; }); + + this.api.getChartType() + .then((res) => { + this.uiChartType = parseInt(res); + }) + .catch(() => { + this.uiChartType = 0; + }); Promise.resolve().then(async () => { const lang = await this.api.getLang(); @@ -333,4 +387,27 @@ new Vue({ this.latestRelease = latestRelease; }).catch((err) => console.error(err)); }, + computed: { + chartOptionsTX() { + const opts = { + ...this.chartOptions, + colors: [CHART_COLORS.tx[theme]], + }; + opts.chart.type = UI_CHART_TYPES[this.uiChartType].type || false; + opts.stroke.width = UI_CHART_TYPES[this.uiChartType].strokeWidth; + return opts; + }, + chartOptionsRX() { + const opts = { + ...this.chartOptions, + colors: [CHART_COLORS.rx[theme]], + }; + opts.chart.type = UI_CHART_TYPES[this.uiChartType].type || false; + opts.stroke.width = UI_CHART_TYPES[this.uiChartType].strokeWidth; + return opts; + }, + updateCharts() { + return this.uiChartType > 0; + } + }, }); From 71c208133de5b33a6e5b41b06136dcad8815e72f Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 12:28:21 +0300 Subject: [PATCH 048/115] Remove .env from repo --- src/.env | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/.env diff --git a/src/.env b/src/.env deleted file mode 100644 index 122fe628..00000000 --- a/src/.env +++ /dev/null @@ -1,3 +0,0 @@ -WG_HOST=127.0.0.1 -UI_TRAFFIC_STATS=true -UI_CHART_TYPE=2 \ No newline at end of file From 98a5daf4581e0b4fdbf9c548d1b4c4ba63612da5 Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 13:24:24 +0300 Subject: [PATCH 049/115] Fix charts on mobile --- src/www/css/app.css | 10 +++++----- src/www/index.html | 6 +++--- src/www/js/app.js | 13 +++++++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/www/css/app.css b/src/www/css/app.css index 00837d4c..9c6c85fd 100644 --- a/src/www/css/app.css +++ b/src/www/css/app.css @@ -1141,11 +1141,6 @@ video { padding-bottom: 0.75rem; } -.py-5 { - padding-top: 1.25rem; - padding-bottom: 1.25rem; -} - .pb-1 { padding-bottom: 0.25rem; } @@ -1597,6 +1592,11 @@ video { padding-right: 0px; } + .md\:py-5 { + padding-top: 1.25rem; + padding-bottom: 1.25rem; + } + .md\:pb-0 { padding-bottom: 0px; } diff --git a/src/www/index.html b/src/www/index.html index 25173644..2b1b7ba8 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -77,17 +77,17 @@ class="relative overflow-hidden border-b last:border-b-0 border-gray-100 dark:border-neutral-600 border-solid"> -
+
-
+
-
+
diff --git a/src/www/js/app.js b/src/www/js/app.js index 23252663..b0166129 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -86,6 +86,10 @@ new Vue({ animations: { enabled: false, }, + parentHeightOffset: 0, + sparkline: { + enabled: true, + } }, colors: [], stroke: { @@ -117,10 +121,10 @@ new Vue({ show: false, }, axisTicks: { - show: true, + show: false, }, axisBorder: { - show: true, + show: false, }, }, yaxis: { @@ -184,8 +188,9 @@ new Vue({ } // Debug - // client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; - // client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; + client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; + client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; + client.latestHandshakeAt = new Date(); this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; this.clientsPersist[client.id].transferRxPrevious = client.transferRx; From 262318df27f475eb3c706d00e7269cd797c0b2f7 Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 13:26:27 +0300 Subject: [PATCH 050/115] Disable debug --- src/www/js/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/www/js/app.js b/src/www/js/app.js index b0166129..61d1ceeb 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -188,9 +188,9 @@ new Vue({ } // Debug - client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; - client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; - client.latestHandshakeAt = new Date(); + // client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000; + // client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000; + // client.latestHandshakeAt = new Date(); this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious; this.clientsPersist[client.id].transferRxPrevious = client.transferRx; From ac6a05f9beda81689926b9ed8148290ae328da4e Mon Sep 17 00:00:00 2001 From: Sergei Birukov Date: Wed, 13 Mar 2024 13:51:32 +0300 Subject: [PATCH 051/115] Fix lint errors --- src/www/js/app.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/www/js/app.js b/src/www/js/app.js index 61d1ceeb..a2536ed6 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -37,13 +37,13 @@ const UI_CHART_TYPES = [ { type: 'line', strokeWidth: 3 }, { type: 'area', strokeWidth: 0 }, { type: 'bar', strokeWidth: 0 }, -] +]; const CHART_COLORS = { rx: { light: 'rgba(0,0,0,0.2)', dark: 'rgba(255,255,255,0.3)' }, tx: { light: 'rgba(0,0,0,0.3)', dark: 'rgba(255,255,255,0.5)' }, - gradient: {light: ['rgba(0,0,0,0.1)', 'rgba(0,0,0,0)'], dark: ['rgba(255,255,255,0.1)', 'rgba(255,255,255,0)']}, -} + gradient: { light: ['rgba(0,0,0,0.1)', 'rgba(0,0,0,0)'], dark: ['rgba(255,255,255,0.1)', 'rgba(255,255,255,0)'] }, +}; new Vue({ el: '#app', @@ -89,7 +89,7 @@ new Vue({ parentHeightOffset: 0, sparkline: { enabled: true, - } + }, }, colors: [], stroke: { @@ -107,7 +107,7 @@ new Vue({ opacityTo: 1, stops: [0, 100], }, - }, + }, dataLabels: { enabled: false, }, @@ -172,7 +172,7 @@ new Vue({ updateCharts = false, } = {}) { if (!this.authenticated) return; - + const clients = await this.api.getClients(); this.clients = clients.map((client) => { if (client.name.includes('@') && client.name.includes('.')) { @@ -198,7 +198,6 @@ new Vue({ this.clientsPersist[client.id].transferTxPrevious = client.transferTx; if (updateCharts) { - this.clientsPersist[client.id].transferRxHistory.push(this.clientsPersist[client.id].transferRxCurrent); this.clientsPersist[client.id].transferRxHistory.shift(); @@ -352,10 +351,10 @@ new Vue({ .catch(() => { this.uiTrafficStats = false; }); - + this.api.getChartType() .then((res) => { - this.uiChartType = parseInt(res); + this.uiChartType = parseInt(res, 10); }) .catch(() => { this.uiChartType = 0; @@ -413,6 +412,6 @@ new Vue({ }, updateCharts() { return this.uiChartType > 0; - } + }, }, }); From 88b1b20e48cda96132a1e2ff21c1ea130b1135d5 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:43:51 +0100 Subject: [PATCH 052/115] docker-compose.yml: add UI_CHART_TYPE --- docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a489356f..e118115f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,8 @@ services: # - WG_POST_UP=echo "Post Up" > /etc/wireguard/post-up.txt # - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt # - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt - # - UI_TRAFFIC_STATS=true + # - UI_TRAFFIC_STATS=true + # - UI_CHART_TYPE=0 (0 # Charts disabled, 1 # Line chart, 2 # Area chart, 3 # Bar chart) image: ghcr.io/wg-easy/wg-easy container_name: wg-easy From e666a1461288718b9723facaecbabef7fe999edf Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Tue, 19 Mar 2024 12:54:01 +0000 Subject: [PATCH 053/115] npm: package updates --- src/package-lock.json | 96 +++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 59 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index c3862633..ea4dcd3e 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -67,15 +67,16 @@ } }, "node_modules/@babel/highlight": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", - "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.1.tgz", + "integrity": "sha512-EPmDPxidWe/Ex+HTFINpvXdPHRmgSF3T8hGvzondYjmgzTQ/0EbLpSxyt+w3zzlYSk9cNBQNF9k0dT5Z2NiBjw==", "dev": true, "peer": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", - "js-tokens": "^4.0.0" + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" @@ -849,25 +850,6 @@ "node": ">=8" } }, - "node_modules/array.prototype.filter": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.3.tgz", - "integrity": "sha512-VizNcj/RGJiUyQBgzwxzE5oHdeuXY5hSbbmKMlphj1cy1Vl7Pn2asCGbSrru6hSQjmCzqTBPVWAF/whmEOVHbw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/array.prototype.findlastindex": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.4.tgz", @@ -1479,9 +1461,9 @@ } }, "node_modules/es-abstract": { - "version": "1.23.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.1.tgz", - "integrity": "sha512-r+YVn6hTqQb+P5kK0u3KeDqrmhHKm+OhU/Mw4jSL4eQtOxXmp75fXIUUb3sUqFZOlb/YtW5JRaIfEC3UyjYUZQ==", + "version": "1.23.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.2.tgz", + "integrity": "sha512-60s3Xv2T2p1ICykc7c+DNDPLDMm9t4QxCOUU0K9JxiLjM3C1zB9YVdN7tjxrFd4+AkZ8CdX1ovUga4P2+1e+/w==", "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", @@ -1521,8 +1503,8 @@ "regexp.prototype.flags": "^1.5.2", "safe-array-concat": "^1.1.2", "safe-regex-test": "^1.0.3", - "string.prototype.trim": "^1.2.8", - "string.prototype.trimend": "^1.0.7", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", "string.prototype.trimstart": "^1.0.7", "typed-array-buffer": "^1.0.2", "typed-array-byte-length": "^1.0.1", @@ -1538,12 +1520,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-array-method-boxes-properly": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "dev": true - }, "node_modules/es-define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", @@ -3521,28 +3497,29 @@ } }, "node_modules/object.entries": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz", - "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.8.tgz", + "integrity": "sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/object.fromentries": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", - "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -3552,27 +3529,28 @@ } }, "node_modules/object.groupby": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.2.tgz", - "integrity": "sha512-bzBq58S+x+uo0VjurFT0UktpKHOZmv4/xePiOA1nbB9pMqpGK7rUPNgf+1YC+7mE+0HzhTMqNUuCqvKhj6FnBw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", "dev": true, "dependencies": { - "array.prototype.filter": "^1.0.3", - "call-bind": "^1.0.5", + "call-bind": "^1.0.7", "define-properties": "^1.2.1", - "es-abstract": "^1.22.3", - "es-errors": "^1.0.0" + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/object.values": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", - "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", + "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" From 74f3e2f320db1cfd22be1c1114eddd0872408c25 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 19 Mar 2024 14:11:03 +0100 Subject: [PATCH 054/115] fixup: Server.js --- src/lib/Server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/Server.js b/src/lib/Server.js index 3226e1cf..6a496bf5 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -67,6 +67,7 @@ module.exports = class Server { .get('/api/ui-chart-type', defineEventHandler((event) => { setHeader(event, 'Content-Type', 'application/json'); return `"${UI_CHART_TYPE}"`; + })) // Authentication .get('/api/session', defineEventHandler((event) => { From 5fbfb26937bc8c9180b7db383fd2093fc6976c70 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 19 Mar 2024 14:16:44 +0100 Subject: [PATCH 055/115] fixup: Server.js --- src/lib/Server.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index 6a496bf5..e89dfa5e 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -52,7 +52,6 @@ module.exports = class Server { router .get('/api/release', defineEventHandler((event) => { setHeader(event, 'Content-Type', 'application/json'); - return RELEASE; })) From 953a67bbdd6167d398527c22bdd0649fe626d6b3 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 19 Mar 2024 14:18:29 +0100 Subject: [PATCH 056/115] fixup: Server.js --- src/lib/Server.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/Server.js b/src/lib/Server.js index e89dfa5e..b6b2f5f4 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -59,10 +59,12 @@ module.exports = class Server { setHeader(event, 'Content-Type', 'application/json'); return `"${LANG}"`; })) + .get('/api/ui-traffic-stats', defineEventHandler((event) => { setHeader(event, 'Content-Type', 'application/json'); return `"${UI_TRAFFIC_STATS}"`; })) + .get('/api/ui-chart-type', defineEventHandler((event) => { setHeader(event, 'Content-Type', 'application/json'); return `"${UI_CHART_TYPE}"`; From d40536c3fb57454400cbc53b18228582d2edc79f Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Tue, 19 Mar 2024 21:10:54 +0000 Subject: [PATCH 057/115] npm: package updates --- src/package-lock.json | 31 ++++++++++++++++--------------- src/www/css/app.css | 30 ++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index ea4dcd3e..e90d77ae 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -67,9 +67,9 @@ } }, "node_modules/@babel/highlight": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.1.tgz", - "integrity": "sha512-EPmDPxidWe/Ex+HTFINpvXdPHRmgSF3T8hGvzondYjmgzTQ/0EbLpSxyt+w3zzlYSk9cNBQNF9k0dT5Z2NiBjw==", + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.2.tgz", + "integrity": "sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==", "dev": true, "peer": true, "dependencies": { @@ -851,15 +851,16 @@ } }, "node_modules/array.prototype.findlastindex": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.4.tgz", - "integrity": "sha512-hzvSHUshSpCflDR1QMUBLHGHP1VIEBegT4pix9H/Z92Xw3ySoy6c2qh7lJWTJnRJ8JCZ9bJNCgTyYaJGcJu6xQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", + "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.5", + "call-bind": "^1.0.7", "define-properties": "^1.2.1", - "es-abstract": "^1.22.3", + "es-abstract": "^1.23.2", "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", "es-shim-unscopables": "^1.0.2" }, "engines": { @@ -3786,9 +3787,9 @@ } }, "node_modules/postcss": { - "version": "8.4.36", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.36.tgz", - "integrity": "sha512-/n7eumA6ZjFHAsbX30yhHup/IMkOmlmvtEi7P+6RMYf+bGJSUHc3geH4a0NSZxAz/RJfiS9tooCTs9LAVYUZKw==", + "version": "8.4.37", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.37.tgz", + "integrity": "sha512-7iB/v/r7Woof0glKLH8b1SPHrsX7uhdO+Geb41QpF/+mWZHU3uxxSlN+UXGVit1PawOYDToO+AbZzhBzWRDwbQ==", "dev": true, "funding": [ { @@ -3807,7 +3808,7 @@ "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.0.0", - "source-map-js": "^1.1.0" + "source-map-js": "^1.2.0" }, "engines": { "node": "^10 || ^12 || >=14" @@ -4461,9 +4462,9 @@ } }, "node_modules/source-map-js": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.1.0.tgz", - "integrity": "sha512-9vC2SfsJzlej6MAaMPLu8HiBSHGdRAJ9hVFYN1ibZoNkeanmDmLUcIrj6G9DGL7XMJ54AKg/G75akXl1/izTOw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", "dev": true, "engines": { "node": ">=0.10.0" diff --git a/src/www/css/app.css b/src/www/css/app.css index 2564cdd8..1db1aa06 100644 --- a/src/www/css/app.css +++ b/src/www/css/app.css @@ -744,12 +744,12 @@ video { margin-top: 0.75rem; } -.mt-5 { - margin-top: 1.25rem; +.mt-4 { + margin-top: 1rem; } -.mt-6 { - margin-top: 1.5rem; +.mt-5 { + margin-top: 1.25rem; } .mt-px { @@ -900,6 +900,10 @@ video { flex-grow: 1; } +.grow-0 { + flex-grow: 0; +} + .transform { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); } @@ -945,6 +949,10 @@ video { flex-direction: column; } +.flex-col-reverse { + flex-direction: column-reverse; +} + .flex-wrap { flex-wrap: wrap; } @@ -985,6 +993,10 @@ video { align-self: flex-start; } +.self-end { + align-self: flex-end; +} + .overflow-hidden { overflow: hidden; } @@ -1507,6 +1519,16 @@ video { .xxs\:flex-row { flex-direction: row; } + + .xxs\:self-center { + align-self: center; + } +} + +@media (min-width: 576px) { + .xs\:mt-6 { + margin-top: 1.5rem; + } } @media (min-width: 640px) { From 62703ffbd6fe28ec13faa198a9e0154fe6b835c5 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Wed, 20 Mar 2024 12:38:50 +0000 Subject: [PATCH 058/115] npm: package updates --- src/package-lock.json | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index adb14f2a..96ae60d3 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -1134,11 +1134,24 @@ "node": "^14.18.0 || >=16.10.0" } }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/cookie-es": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.0.0.tgz", "integrity": "sha512-mWYvfOLrfEc996hlKcdABeIiPHUPC6DM2QYZdGGOvhOTbA3tjm2eBwqlJpoFdjC89NI4Qt6h0Pu06Mp+1Pj5OQ==" }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==" + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2084,19 +2097,6 @@ "node": ">= 0.8.0" } }, - "node_modules/express-session/node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express-session/node_modules/cookie-signature": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", - "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==" - }, "node_modules/express-session/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -2654,9 +2654,9 @@ } }, "node_modules/iron-webcrypto": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.0.0.tgz", - "integrity": "sha512-anOK1Mktt8U1Xi7fCM3RELTuYbnFikQY5VtrDj7kPgpejV7d43tWKhzgioO0zpkazLEL/j/iayRqnJhrGfqUsg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.1.0.tgz", + "integrity": "sha512-5vgYsCakNlaQub1orZK5QmNYhwYtcllTkZBp5sfIaCqY93Cf6l+v2rtE+E4TMbcfjxDMCdrO8wmp7+ZvhDECLA==", "funding": { "url": "https://github.com/sponsors/brc-dd" } @@ -3115,6 +3115,17 @@ "node": ">=8.6" } }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -3756,9 +3767,9 @@ ] }, "node_modules/radix3": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.0.tgz", - "integrity": "sha512-pNsHDxbGORSvuSScqNJ+3Km6QAVqk8CfsCBIEoDgpqLrkD2f3QM4I7d1ozJJ172OmIcoUcerZaNWqtLkRXTV3A==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.1.tgz", + "integrity": "sha512-yUUd5VTiFtcMEx0qFUxGAv5gbMc1un4RvEO1JZdP7ZUl/RHygZK6PknIKntmQRZxnMY3ZXD2ISaw1ij8GYW1yg==" }, "node_modules/ramda": { "version": "0.27.2", @@ -4574,9 +4585,9 @@ } }, "node_modules/ufo": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.4.0.tgz", - "integrity": "sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==" + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", + "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==" }, "node_modules/uid-safe": { "version": "2.1.5", @@ -4621,17 +4632,6 @@ "pathe": "^1.1.1" } }, - "node_modules/unenv/node_modules/mime": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", From 6c567d00821bc8464a10a6f9f95dc4c8be604de4 Mon Sep 17 00:00:00 2001 From: Edgars Date: Thu, 21 Mar 2024 08:55:57 +0200 Subject: [PATCH 059/115] Use one command for updating with Docker Compose `README.md` was updated to use a one-liner to update WireGuard Easy with Docker Compose. A note about image tag was added to avoid confusion when one is specified in Compose file and it is other than `latest`, as that would result in no pull and no WireGuard Easy container recreation. --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e0163d0e..940f8b24 100644 --- a/README.md +++ b/README.md @@ -120,13 +120,11 @@ docker pull ghcr.io/wg-easy/wg-easy And then run the `docker run -d \ ...` command above again. -To update using Docker Compose: - -```shell -docker compose pull -docker compose up --detach -``` - +With Docker Compose WireGuard Easy can be updated with a single command: +`docker compose up --detach --pull always` (if an image tag is specified in the +Compose file and it is not `latest`, make sure that it is changed to the desired +one; by default it is omitted and +[defaults to `latest`](https://docs.docker.com/engine/reference/run/#image-references)). \ The WireGuared Easy container will be automatically recreated if a newer image was pulled. From 5afb701013798b352df71a743e5cfd7c5183e571 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Thu, 21 Mar 2024 10:42:32 +0000 Subject: [PATCH 060/115] npm: package updates --- src/package-lock.json | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 96ae60d3..d27fbcf8 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -806,15 +806,16 @@ } }, "node_modules/array-includes": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", - "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", "is-string": "^1.0.7" }, "engines": { @@ -3551,9 +3552,9 @@ } }, "node_modules/postcss": { - "version": "8.4.37", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.37.tgz", - "integrity": "sha512-7iB/v/r7Woof0glKLH8b1SPHrsX7uhdO+Geb41QpF/+mWZHU3uxxSlN+UXGVit1PawOYDToO+AbZzhBzWRDwbQ==", + "version": "8.4.38", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", + "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", "dev": true, "funding": [ { From ac47789561d710f8c7f9ee8015b6d61537c8f15d Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sat, 23 Mar 2024 19:35:58 +0100 Subject: [PATCH 061/115] revert: Workaround CVE-2023-42282 newest images have updated ip package --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4e410b8e..e1271eb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,8 +26,6 @@ COPY --from=build_node_modules /node_modules /node_modules RUN \ # Enable this to run `npm run serve` npm i -g nodemon &&\ - # Workaround CVE-2023-42282 - npm uninstall -g ip &&\ # Delete unnecessary files npm cache clean --force && rm -rf ~/.npm From c2829d79e0db2f96d4a8942da9d03217b99a05dd Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Sat, 23 Mar 2024 18:36:33 +0000 Subject: [PATCH 062/115] npm: package updates --- src/package-lock.json | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index d27fbcf8..fea8e2dc 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -3201,9 +3201,9 @@ "dev": true }, "node_modules/node-fetch-native": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.2.tgz", - "integrity": "sha512-69mtXOFZ6hSkYiXAVB5SqaRvrbITC/NPyqv7yuu/qw0nmgPyYbIMYYNIDhNtwPrzk0ptrimrLz/hhjvm4w5Z+w==" + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.4.tgz", + "integrity": "sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -4197,14 +4197,17 @@ } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", - "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4553,9 +4556,9 @@ } }, "node_modules/typed-array-length": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.5.tgz", - "integrity": "sha512-yMi0PlwuznKHxKmcpoOdeLwxBoVPkqZxd7q2FgMkmD3bNwvF5VW0+UlUQ1k1vmktTu4Yu13Q0RIxEP8+B+wloA==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", "dev": true, "dependencies": { "call-bind": "^1.0.7", From 8d00c5456a9e9f8ed697c1441e6e24dbdd13094b Mon Sep 17 00:00:00 2001 From: cany748 Date: Sat, 23 Mar 2024 18:23:32 +0700 Subject: [PATCH 063/115] fix: add Content-Type header for static files --- src/lib/Server.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/Server.js b/src/lib/Server.js index b6b2f5f4..18e015cb 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -225,6 +225,12 @@ module.exports = class Server { return; } + if (id.endsWith('.html')) setHeader(event, 'Content-Type', 'text/html'); + if (id.endsWith('.js')) setHeader(event, 'Content-Type', 'application/javascript'); + if (id.endsWith('.json')) setHeader(event, 'Content-Type', 'application/json'); + if (id.endsWith('.css')) setHeader(event, 'Content-Type', 'text/css'); + if (id.endsWith('.png')) setHeader(event, 'Content-Type', 'image/png'); + return { size: stats.size, mtime: stats.mtimeMs, From fe7d77e48196634dab5ba25f96b920cea918a702 Mon Sep 17 00:00:00 2001 From: "Philip H." <47042125+pheiduck@users.noreply.github.com> Date: Sat, 23 Mar 2024 20:34:43 +0000 Subject: [PATCH 064/115] fixup: packages --- src/package-lock.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 69bf52c1..38278c67 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -12,8 +12,8 @@ "bcryptjs": "^2.4.3", "debug": "^4.3.4", "express-session": "^1.18.0", - "ip": "^2.0.1", "h3": "^1.11.1", + "ip": "^2.0.1", "qrcode": "^1.5.3", "uuid": "^9.0.1" }, @@ -2660,12 +2660,6 @@ "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==" }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "engines": { - "node": ">= 0.10" "node_modules/iron-webcrypto": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.1.0.tgz", From 5cdacd6cc3962da60e1683c9a3fe01d0a20fdc55 Mon Sep 17 00:00:00 2001 From: Utkarsh Goel Date: Mon, 25 Mar 2024 23:28:36 +0800 Subject: [PATCH 065/115] Fix CIDR block calculation issue, fix POST_DOWN config --- src/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.js b/src/config.js index 6ae34d15..35cb266f 100644 --- a/src/config.js +++ b/src/config.js @@ -21,7 +21,7 @@ module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' : '1.1.1.1'; module.exports.WG_ALLOWED_IPS = process.env.WG_ALLOWED_IPS || '0.0.0.0/0, ::/0'; -module.exports.WG_SUBNET = ip.subnet(module.exports.WG_DEFAULT_ADDRESS, `255.255.255.${256 - 2 ** (32 - module.exports.WG_DEFAULT_ADDRESS_RANGE)}`); +module.exports.WG_SUBNET = ip.cidrSubnet(`${module.exports.WG_DEFAULT_ADDRESS}/${module.exports.WG_DEFAULT_ADDRESS_RANGE}`); module.exports.WG_SERVER_ADDRESS = module.exports.WG_SUBNET.firstAddress; module.exports.WG_CLIENT_FIRST_ADDRESS = ip.toLong(module.exports.WG_SERVER_ADDRESS) + 1; module.exports.WG_CLIENT_LAST_ADDRESS = ip.toLong(module.exports.WG_SUBNET.lastAddress) - 1; // Exclude the broadcast address @@ -36,7 +36,7 @@ iptables -A FORWARD -o wg0 -j ACCEPT; module.exports.WG_PRE_DOWN = process.env.WG_PRE_DOWN || ''; module.exports.WG_POST_DOWN = process.env.WG_POST_DOWN || ` -iptables -t nat -D POSTROUTING -s ${module.exports.WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ${module.exports.WG_DEVICE} -j MASQUERADE; +iptables -t nat -D POSTROUTING -s ${module.exports.WG_SERVER_ADDRESS}/${module.exports.WG_DEFAULT_ADDRESS_RANGE} -o ${module.exports.WG_DEVICE} -j MASQUERADE; iptables -D INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; From 196cb63c6ef0902732675e0764d050a30c579b6b Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:15:30 +0100 Subject: [PATCH 066/115] README.md: add WG_DEFAULT_ADDRESS_RANGE --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 39d9b0f6..42037817 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,8 @@ These options can be configured by setting environment variables using `-e KEY=" | `WG_PORT` | `51820` | `12345` | The public UDP port of your VPN server. WireGuard will always listen on 51820 inside the Docker container. | | `WG_MTU` | `null` | `1420` | The MTU the clients will use. Server uses default WG MTU. | | `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open. If this value is 0, then connections won't be kept alive. | -| `WG_DEFAULT_ADDRESS` | `10.8.0.0/24` | `10.6.0.0/24` | Clients IP address range. (For Legacy reasons x in last place is supported and will be replaced with 0/24 (e.g. 10.8.0.x)) | +| `WG_DEFAULT_ADDRESS` | `10.8.0.0` | `10.6.0.0` | Clients IP address range. | +| `WG_DEFAULT_ADDRESS_RANGE` | `/24` | `/32` | Value to define CIDR Range. If not defined fallback to `/24` | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. If set to blank value, clients will not use any DNS. | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use. | | `WG_PRE_UP` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L19) for the default value. | From 479c51d741edd95719c191ec0c9c473217eb4615 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:18:14 +0100 Subject: [PATCH 067/115] WG_DEFAULT_ADDRESS_RANGE `/` is not needed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42037817..edd569bf 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ These options can be configured by setting environment variables using `-e KEY=" | `WG_MTU` | `null` | `1420` | The MTU the clients will use. Server uses default WG MTU. | | `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open. If this value is 0, then connections won't be kept alive. | | `WG_DEFAULT_ADDRESS` | `10.8.0.0` | `10.6.0.0` | Clients IP address range. | -| `WG_DEFAULT_ADDRESS_RANGE` | `/24` | `/32` | Value to define CIDR Range. If not defined fallback to `/24` +| `WG_DEFAULT_ADDRESS_RANGE` | `24` | `32` | Value to define CIDR Range. If not defined fallback to `24` | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. If set to blank value, clients will not use any DNS. | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use. | | `WG_PRE_UP` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L19) for the default value. | From 2f9364aa31f88bc924863b51ec635cbc5465f3a3 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Mon, 25 Mar 2024 18:31:06 +0100 Subject: [PATCH 068/115] wg-easy.service: add missing WG_DEFAULT_ADDRESS_RANGE --- wg-easy.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wg-easy.service b/wg-easy.service index 6adee95e..e1ea96ea 100644 --- a/wg-easy.service +++ b/wg-easy.service @@ -5,7 +5,8 @@ After=network-online.target nss-lookup.target [Service] Environment="WG_HOST=raspberrypi.local" # Change this to your host's public address or static public ip. Environment="PASSWORD=REPLACEME" # When set, requires a password when logging in to the Web UI, to disable add a hashtag -#Environment="WG_DEFAULT_ADDRESS=10.0.8.0/24" # Clients IP address range. +#Environment="WG_DEFAULT_ADDRESS=10.0.8.0" # Clients IP addresses. +#Environment="WG_DEFAULT_ADDRESS_RANGE=32" # Client CIDR Range (if not set fallback to 24) #Environment="WG_DEFAULT_DNS=10.0.8.1, 1.1.1.1" #DNS server clients will use. If set to blank value, clients will not use any DNS. #Environment="WG_ALLOWED_IPS=0.0.0.0/0,::/0" #Allowed IPs clients will use. #Environment="WG_DEVICE=ens1" #Ethernet device the wireguard traffic should be forwarded through. From cb63d5c67f6592460c378b7e9a8c6c9b39f4d72b Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Tue, 26 Mar 2024 16:40:32 +0000 Subject: [PATCH 069/115] npm: package updates --- src/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 38278c67..7ac24754 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -3774,9 +3774,9 @@ ] }, "node_modules/radix3": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.1.tgz", - "integrity": "sha512-yUUd5VTiFtcMEx0qFUxGAv5gbMc1un4RvEO1JZdP7ZUl/RHygZK6PknIKntmQRZxnMY3ZXD2ISaw1ij8GYW1yg==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.2.tgz", + "integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==" }, "node_modules/ramda": { "version": "0.27.2", @@ -4335,9 +4335,9 @@ } }, "node_modules/table": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", + "version": "6.8.2", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.2.tgz", + "integrity": "sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA==", "dev": true, "peer": true, "dependencies": { From dbbfdd5357c991e99a27dfd5002114dce1303d91 Mon Sep 17 00:00:00 2001 From: Utkarsh Goel Date: Wed, 27 Mar 2024 21:24:15 +0800 Subject: [PATCH 070/115] Add backward compatibility for WG_DEFAULT_ADDRESS --- src/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.js b/src/config.js index 35cb266f..27aabae8 100644 --- a/src/config.js +++ b/src/config.js @@ -14,7 +14,7 @@ module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || '51820'; module.exports.WG_MTU = process.env.WG_MTU || null; module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || '0'; -module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.0'; +module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS.replace('x', '0') || '10.8.0.0'; module.exports.WG_DEFAULT_ADDRESS_RANGE = process.env.WG_DEFAULT_ADDRESS_RANGE || '24'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS From bf214fb4d3d48f9b18d60e5241888efebb2a7d5e Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 27 Mar 2024 14:41:31 +0100 Subject: [PATCH 071/115] Revert "feat: cidr notation" --- README.md | 3 +-- docker-compose.yml | 3 +-- src/config.js | 14 +++----------- src/lib/Util.js | 13 +++++++++++++ src/lib/WireGuard.js | 30 ++++++++++-------------------- src/package-lock.json | 6 ------ src/package.json | 1 - wg-easy.service | 3 +-- 8 files changed, 29 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index edd569bf..940f8b24 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,7 @@ These options can be configured by setting environment variables using `-e KEY=" | `WG_PORT` | `51820` | `12345` | The public UDP port of your VPN server. WireGuard will always listen on 51820 inside the Docker container. | | `WG_MTU` | `null` | `1420` | The MTU the clients will use. Server uses default WG MTU. | | `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open. If this value is 0, then connections won't be kept alive. | -| `WG_DEFAULT_ADDRESS` | `10.8.0.0` | `10.6.0.0` | Clients IP address range. | -| `WG_DEFAULT_ADDRESS_RANGE` | `24` | `32` | Value to define CIDR Range. If not defined fallback to `24` +| `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range. | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. If set to blank value, clients will not use any DNS. | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use. | | `WG_PRE_UP` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L19) for the default value. | diff --git a/docker-compose.yml b/docker-compose.yml index a0075d65..e118115f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,8 +15,7 @@ services: # Optional: # - PASSWORD=foobar123 # - WG_PORT=51820 - # - WG_DEFAULT_ADDRESS=10.8.0.0 - # - WG_DEFAULT_ADDRESS_RANGE=24 + # - WG_DEFAULT_ADDRESS=10.8.0.x # - WG_DEFAULT_DNS=1.1.1.1 # - WG_MTU=1420 # - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24 diff --git a/src/config.js b/src/config.js index 35cb266f..1fff4c27 100644 --- a/src/config.js +++ b/src/config.js @@ -1,7 +1,5 @@ 'use strict'; -const ip = require('ip'); - const { release } = require('./package.json'); module.exports.RELEASE = release; @@ -14,21 +12,15 @@ module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || '51820'; module.exports.WG_MTU = process.env.WG_MTU || null; module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || '0'; -module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.0'; -module.exports.WG_DEFAULT_ADDRESS_RANGE = process.env.WG_DEFAULT_ADDRESS_RANGE || '24'; +module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS : '1.1.1.1'; module.exports.WG_ALLOWED_IPS = process.env.WG_ALLOWED_IPS || '0.0.0.0/0, ::/0'; -module.exports.WG_SUBNET = ip.cidrSubnet(`${module.exports.WG_DEFAULT_ADDRESS}/${module.exports.WG_DEFAULT_ADDRESS_RANGE}`); -module.exports.WG_SERVER_ADDRESS = module.exports.WG_SUBNET.firstAddress; -module.exports.WG_CLIENT_FIRST_ADDRESS = ip.toLong(module.exports.WG_SERVER_ADDRESS) + 1; -module.exports.WG_CLIENT_LAST_ADDRESS = ip.toLong(module.exports.WG_SUBNET.lastAddress) - 1; // Exclude the broadcast address - module.exports.WG_PRE_UP = process.env.WG_PRE_UP || ''; module.exports.WG_POST_UP = process.env.WG_POST_UP || ` -iptables -t nat -A POSTROUTING -s ${module.exports.WG_SERVER_ADDRESS}/${module.exports.WG_DEFAULT_ADDRESS_RANGE} -o ${module.exports.WG_DEVICE} -j MASQUERADE; +iptables -t nat -A POSTROUTING -s ${module.exports.WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ${module.exports.WG_DEVICE} -j MASQUERADE; iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; @@ -36,7 +28,7 @@ iptables -A FORWARD -o wg0 -j ACCEPT; module.exports.WG_PRE_DOWN = process.env.WG_PRE_DOWN || ''; module.exports.WG_POST_DOWN = process.env.WG_POST_DOWN || ` -iptables -t nat -D POSTROUTING -s ${module.exports.WG_SERVER_ADDRESS}/${module.exports.WG_DEFAULT_ADDRESS_RANGE} -o ${module.exports.WG_DEVICE} -j MASQUERADE; +iptables -t nat -D POSTROUTING -s ${module.exports.WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ${module.exports.WG_DEVICE} -j MASQUERADE; iptables -D INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; diff --git a/src/lib/Util.js b/src/lib/Util.js index 82942599..cc6e89c2 100644 --- a/src/lib/Util.js +++ b/src/lib/Util.js @@ -4,6 +4,19 @@ const childProcess = require('child_process'); module.exports = class Util { + static isValidIPv4(str) { + const blocks = str.split('.'); + if (blocks.length !== 4) return false; + + for (let value of blocks) { + value = parseInt(value, 10); + if (Number.isNaN(value)) return false; + if (value < 0 || value > 255) return false; + } + + return true; + } + static promisify(fn) { // eslint-disable-next-line func-names return function(req, res) { diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index de36e1e1..739676fb 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -4,7 +4,6 @@ const fs = require('fs').promises; const path = require('path'); const debug = require('debug')('WireGuard'); -const ip = require('ip'); const uuid = require('uuid'); const QRCode = require('qrcode'); @@ -17,12 +16,9 @@ const { WG_PORT, WG_MTU, WG_DEFAULT_DNS, - WG_DEFAULT_ADDRESS_RANGE, + WG_DEFAULT_ADDRESS, WG_PERSISTENT_KEEPALIVE, WG_ALLOWED_IPS, - WG_SERVER_ADDRESS, - WG_CLIENT_FIRST_ADDRESS, - WG_CLIENT_LAST_ADDRESS, WG_PRE_UP, WG_POST_UP, WG_PRE_DOWN, @@ -49,15 +45,13 @@ module.exports = class WireGuard { const publicKey = await Util.exec(`echo ${privateKey} | wg pubkey`, { log: 'echo ***hidden*** | wg pubkey', }); - const address = WG_SERVER_ADDRESS; - const cidrBlock = WG_DEFAULT_ADDRESS_RANGE; + const address = WG_DEFAULT_ADDRESS.replace('x', '1'); config = { server: { privateKey, publicKey, address, - cidrBlock, }, clients: {}, }; @@ -73,7 +67,7 @@ module.exports = class WireGuard { throw err; }); - // await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_SERVER_ADDRESS}/${WG_DEFAULT_ADDRESS_RANGE} -o ' + WG_DEVICE + ' -j MASQUERADE`); + // await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ' + WG_DEVICE + ' -j MASQUERADE`); // await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT'); // await Util.exec('iptables -A FORWARD -i wg0 -j ACCEPT'); // await Util.exec('iptables -A FORWARD -o wg0 -j ACCEPT'); @@ -100,7 +94,7 @@ module.exports = class WireGuard { # Server [Interface] PrivateKey = ${config.server.privateKey} -Address = ${config.server.address}/${config.server.cidrBlock} +Address = ${config.server.address}/24 ListenPort = 51820 PreUp = ${WG_PRE_UP} PostUp = ${WG_POST_UP} @@ -143,7 +137,6 @@ ${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' name: client.name, enabled: client.enabled, address: client.address, - cidrBlock: client.cidrBlock, publicKey: client.publicKey, createdAt: new Date(client.createdAt), updatedAt: new Date(client.updatedAt), @@ -206,7 +199,7 @@ ${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' return ` [Interface] PrivateKey = ${client.privateKey ? `${client.privateKey}` : 'REPLACE_ME'} -Address = ${client.address}/${client.cidrBlock} +Address = ${client.address}/24 ${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}\n` : ''}\ ${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\ @@ -237,16 +230,15 @@ Endpoint = ${WG_HOST}:${WG_PORT}`; const publicKey = await Util.exec(`echo ${privateKey} | wg pubkey`); const preSharedKey = await Util.exec('wg genpsk'); - // find next IP + // Calculate next IP let address; - for (let i = WG_CLIENT_FIRST_ADDRESS; i <= WG_CLIENT_LAST_ADDRESS; i++) { - const currentIp = ip.fromLong(i); + for (let i = 2; i < 255; i++) { const client = Object.values(config.clients).find((client) => { - return client.address === currentIp; + return client.address === WG_DEFAULT_ADDRESS.replace('x', i); }); if (!client) { - address = currentIp; + address = WG_DEFAULT_ADDRESS.replace('x', i); break; } } @@ -257,12 +249,10 @@ Endpoint = ${WG_HOST}:${WG_PORT}`; // Create Client const id = uuid.v4(); - const cidrBlock = WG_DEFAULT_ADDRESS_RANGE; const client = { id, name, address, - cidrBlock, privateKey, publicKey, preSharedKey, @@ -319,7 +309,7 @@ Endpoint = ${WG_HOST}:${WG_PORT}`; async updateClientAddress({ clientId, address }) { const client = await this.getClient({ clientId }); - if (!ip.isV4Format(address)) { + if (!Util.isValidIPv4(address)) { throw new ServerError(`Invalid Address: ${address}`, 400); } diff --git a/src/package-lock.json b/src/package-lock.json index 7ac24754..50cf9935 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -13,7 +13,6 @@ "debug": "^4.3.4", "express-session": "^1.18.0", "h3": "^1.11.1", - "ip": "^2.0.1", "qrcode": "^1.5.3", "uuid": "^9.0.1" }, @@ -2655,11 +2654,6 @@ "node": ">= 0.4" } }, - "node_modules/ip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", - "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==" - }, "node_modules/iron-webcrypto": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.1.0.tgz", diff --git a/src/package.json b/src/package.json index 47f9b593..dc659c31 100644 --- a/src/package.json +++ b/src/package.json @@ -16,7 +16,6 @@ "bcryptjs": "^2.4.3", "debug": "^4.3.4", "express-session": "^1.18.0", - "ip": "^2.0.1", "h3": "^1.11.1", "qrcode": "^1.5.3", "uuid": "^9.0.1" diff --git a/wg-easy.service b/wg-easy.service index e1ea96ea..bcdf72fd 100644 --- a/wg-easy.service +++ b/wg-easy.service @@ -5,8 +5,7 @@ After=network-online.target nss-lookup.target [Service] Environment="WG_HOST=raspberrypi.local" # Change this to your host's public address or static public ip. Environment="PASSWORD=REPLACEME" # When set, requires a password when logging in to the Web UI, to disable add a hashtag -#Environment="WG_DEFAULT_ADDRESS=10.0.8.0" # Clients IP addresses. -#Environment="WG_DEFAULT_ADDRESS_RANGE=32" # Client CIDR Range (if not set fallback to 24) +#Environment="WG_DEFAULT_ADDRESS=10.0.8.x" #Clients IP address range. #Environment="WG_DEFAULT_DNS=10.0.8.1, 1.1.1.1" #DNS server clients will use. If set to blank value, clients will not use any DNS. #Environment="WG_ALLOWED_IPS=0.0.0.0/0,::/0" #Allowed IPs clients will use. #Environment="WG_DEVICE=ens1" #Ethernet device the wireguard traffic should be forwarded through. From 33634211a937ee01584be998d2409f8c673df71c Mon Sep 17 00:00:00 2001 From: Utkarsh Goel Date: Wed, 27 Mar 2024 22:18:37 +0800 Subject: [PATCH 072/115] check for empty WG_DEFAULT_ADDRESS --- src/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.js b/src/config.js index 27aabae8..6c0107e8 100644 --- a/src/config.js +++ b/src/config.js @@ -14,7 +14,7 @@ module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || '51820'; module.exports.WG_MTU = process.env.WG_MTU || null; module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || '0'; -module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS.replace('x', '0') || '10.8.0.0'; +module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS && process.env.WG_DEFAULT_ADDRESS.replace('x', '0') || '10.8.0.0'; module.exports.WG_DEFAULT_ADDRESS_RANGE = process.env.WG_DEFAULT_ADDRESS_RANGE || '24'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS From 4981b72d00d224d32e75de19a6cfc7c2267b7fab Mon Sep 17 00:00:00 2001 From: Utkarsh Goel Date: Wed, 27 Mar 2024 22:23:37 +0800 Subject: [PATCH 073/115] fix unambiguous boolean operators --- src/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.js b/src/config.js index 6c0107e8..c50b7cf6 100644 --- a/src/config.js +++ b/src/config.js @@ -14,7 +14,7 @@ module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || '51820'; module.exports.WG_MTU = process.env.WG_MTU || null; module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || '0'; -module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS && process.env.WG_DEFAULT_ADDRESS.replace('x', '0') || '10.8.0.0'; +module.exports.WG_DEFAULT_ADDRESS = (process.env.WG_DEFAULT_ADDRESS && process.env.WG_DEFAULT_ADDRESS.replace('x', '0')) || '10.8.0.0'; module.exports.WG_DEFAULT_ADDRESS_RANGE = process.env.WG_DEFAULT_ADDRESS_RANGE || '24'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS From 074b3548d29cac61b8d74503032c51d893faf606 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Sun, 31 Mar 2024 17:37:34 +0000 Subject: [PATCH 074/115] npm: package updates --- src/package-lock.json | 46 +++++++++++++++++++++---------------------- src/package.json | 2 +- src/www/css/app.css | 18 +++++++++++++---- 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 7ac24754..75b9dfdf 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -19,7 +19,7 @@ }, "devDependencies": { "eslint-config-athom": "^3.1.3", - "tailwindcss": "^3.4.1" + "tailwindcss": "^3.4.3" }, "engines": { "node": "18" @@ -1145,9 +1145,9 @@ } }, "node_modules/cookie-es": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.0.0.tgz", - "integrity": "sha512-mWYvfOLrfEc996hlKcdABeIiPHUPC6DM2QYZdGGOvhOTbA3tjm2eBwqlJpoFdjC89NI4Qt6h0Pu06Mp+1Pj5OQ==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.1.0.tgz", + "integrity": "sha512-L2rLOcK0wzWSfSDA33YR+PUHDG10a8px7rUHKWbGLP4YfbsMed2KFUw5fczvDPbT98DDe3LEzviswl810apTEw==" }, "node_modules/cookie-signature": { "version": "1.0.7", @@ -1400,9 +1400,9 @@ } }, "node_modules/es-abstract": { - "version": "1.23.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.2.tgz", - "integrity": "sha512-60s3Xv2T2p1ICykc7c+DNDPLDMm9t4QxCOUU0K9JxiLjM3C1zB9YVdN7tjxrFd4+AkZ8CdX1ovUga4P2+1e+/w==", + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", @@ -1444,11 +1444,11 @@ "safe-regex-test": "^1.0.3", "string.prototype.trim": "^1.2.9", "string.prototype.trimend": "^1.0.8", - "string.prototype.trimstart": "^1.0.7", + "string.prototype.trimstart": "^1.0.8", "typed-array-buffer": "^1.0.2", "typed-array-byte-length": "^1.0.1", "typed-array-byte-offset": "^1.0.2", - "typed-array-length": "^1.0.5", + "typed-array-length": "^1.0.6", "unbox-primitive": "^1.0.2", "which-typed-array": "^1.1.15" }, @@ -3466,12 +3466,12 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", + "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", "dev": true, "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { @@ -4288,16 +4288,16 @@ } }, "node_modules/sucrase/node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "version": "10.3.12", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", + "integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", + "jackspeak": "^2.3.6", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "minipass": "^7.0.4", + "path-scurry": "^1.10.2" }, "bin": { "glob": "dist/esm/bin.mjs" @@ -4376,9 +4376,9 @@ "peer": true }, "node_modules/tailwindcss": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz", - "integrity": "sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.3.tgz", + "integrity": "sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A==", "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", @@ -4389,7 +4389,7 @@ "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.19.1", + "jiti": "^1.21.0", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", diff --git a/src/package.json b/src/package.json index 47f9b593..21161790 100644 --- a/src/package.json +++ b/src/package.json @@ -23,7 +23,7 @@ }, "devDependencies": { "eslint-config-athom": "^3.1.3", - "tailwindcss": "^3.4.1" + "tailwindcss": "^3.4.3" }, "nodemonConfig": { "ignore": [ diff --git a/src/www/css/app.css b/src/www/css/app.css index 1db1aa06..84270471 100644 --- a/src/www/css/app.css +++ b/src/www/css/app.css @@ -1,5 +1,5 @@ /* -! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com +! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com */ /* @@ -211,6 +211,8 @@ textarea { /* 1 */ line-height: inherit; /* 1 */ + letter-spacing: inherit; + /* 1 */ color: inherit; /* 1 */ margin: 0; @@ -234,9 +236,9 @@ select { */ button, -[type='button'], -[type='reset'], -[type='submit'] { +input:where([type='button']), +input:where([type='reset']), +input:where([type='submit']) { -webkit-appearance: button; /* 1 */ background-color: transparent; @@ -492,6 +494,10 @@ video { --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; } ::backdrop { @@ -542,6 +548,10 @@ video { --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; } .container { From 61b57a885cfe10124c3ab057b6ec05366509f023 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Mon, 1 Apr 2024 18:04:29 +0200 Subject: [PATCH 075/115] README.md: make commands easier to copy --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index edd569bf..170f4dec 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,8 @@ And log in again. To automatically install & run wg-easy, simply run: -
-$ docker run -d \
-  --name=wg-easy \
+```
+  docker run -d \  --name=wg-easy \
   -e LANG=de \
   -e WG_HOST=🚨YOUR_SERVER_IP \
   -e PASSWORD=🚨YOUR_ADMIN_PASSWORD \
@@ -64,7 +63,7 @@ $ docker run -d \
   --sysctl="net.ipv4.ip_forward=1" \
   --restart unless-stopped \
   ghcr.io/wg-easy/wg-easy
-
+``` > 💡 Replace `YOUR_SERVER_IP` with your WAN IP, or a Dynamic DNS hostname. > From 4868f32f1e6d7f440a1768a4923aa1f9692d5e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Le=C3=B3n?= Date: Mon, 1 Apr 2024 23:16:57 +0200 Subject: [PATCH 076/115] i18n.js: complete words in Spanish --- src/www/js/i18n.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/www/js/i18n.js b/src/www/js/i18n.js index c976a204..41d339e7 100644 --- a/src/www/js/i18n.js +++ b/src/www/js/i18n.js @@ -275,6 +275,8 @@ const messages = { // eslint-disable-line no-unused-vars downloadConfig: 'Descargar configuración', madeBy: 'Hecho por', donate: 'Donar', + toggleCharts: 'Mostrar/Ocultar gráficos', + theme: { dark: 'Modo oscuro', light: 'Modo claro', auto: 'Modo automático' }, }, ko: { name: '이름', From 990a7ae5488949657e786ad41cd528316a6082ef Mon Sep 17 00:00:00 2001 From: Michael van Tricht Date: Wed, 3 Apr 2024 12:31:02 +0200 Subject: [PATCH 077/115] Fix comment in docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a0075d65..aa22faea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: # - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt # - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt # - UI_TRAFFIC_STATS=true - # - UI_CHART_TYPE=0 (0 # Charts disabled, 1 # Line chart, 2 # Area chart, 3 # Bar chart) + # - UI_CHART_TYPE=0 # (0 Charts disabled, 1 # Line chart, 2 # Area chart, 3 # Bar chart) image: ghcr.io/wg-easy/wg-easy container_name: wg-easy From 9e925c2ebb2eb7a63781386c37f50a2ff23cbb69 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Fri, 5 Apr 2024 18:59:41 +0200 Subject: [PATCH 078/115] [prepare] version bump to 13 and updated changelog Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com> --- docs/changelog.json | 5 +++-- src/package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/changelog.json b/docs/changelog.json index ac5208a6..c7837973 100644 --- a/docs/changelog.json +++ b/docs/changelog.json @@ -9,6 +9,7 @@ "8": "Updated to Node.js v18.", "9": "Fixed issue running on devices with older kernels.", "10": "Added sessionless HTTP API auth & automatic dark mode.", - "11": "Multilanguage Support & various bugfixes", - "12": "UI_TRAFFIC_STATS, Import json configurations with no PreShared-Key, allow clients with no privateKey & more." + "11": "Multilanguage Support & various bugfixes.", + "12": "UI_TRAFFIC_STATS, Import json configurations with no PreShared-Key, allow clients with no privateKey & more.", + "13": "new framework (h3), UI_CHART_TYPE, some bugfixes and more" } diff --git a/src/package.json b/src/package.json index 21161790..36b3cc52 100644 --- a/src/package.json +++ b/src/package.json @@ -1,5 +1,5 @@ { - "release": "12", + "release": "13", "name": "wg-easy", "version": "1.0.1", "description": "The easiest way to run WireGuard VPN + Web-based Admin UI.", From 9507454d3f8e24baffec1a0cf9a0f8bc03077273 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Fri, 5 Apr 2024 19:02:15 +0200 Subject: [PATCH 079/115] [fixup] Grammar Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com> --- docs/changelog.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.json b/docs/changelog.json index c7837973..1f16d864 100644 --- a/docs/changelog.json +++ b/docs/changelog.json @@ -11,5 +11,5 @@ "10": "Added sessionless HTTP API auth & automatic dark mode.", "11": "Multilanguage Support & various bugfixes.", "12": "UI_TRAFFIC_STATS, Import json configurations with no PreShared-Key, allow clients with no privateKey & more.", - "13": "new framework (h3), UI_CHART_TYPE, some bugfixes and more" + "13": "New framework (h3), UI_CHART_TYPE, some bugfixes and more." } From c2482f494ae9c7e1acd21db6ab04ee3e91d042da Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sun, 14 Apr 2024 19:15:34 +0200 Subject: [PATCH 080/115] [combine] gitignore Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com> --- .gitignore | 1 + src/.gitignore | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 src/.gitignore diff --git a/.gitignore b/.gitignore index 567e6c6f..e6fce2a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /config /wg0.conf /wg0.json +/src/node_modules .DS_Store *.swp diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 07e6e472..00000000 --- a/src/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules From f9daa3e5beea5317e91e4b7885491f2377b0c58e Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sat, 6 Apr 2024 23:33:21 +0200 Subject: [PATCH 081/115] Bugfix: differnt Ports usage --- Dockerfile | 6 +++--- README.md | 2 ++ docker-compose.yml | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1271eb8..fe3ae8d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,9 +40,9 @@ RUN apk add --no-cache \ # Use iptables-legacy RUN update-alternatives --install /sbin/iptables iptables /sbin/iptables-legacy 10 --slave /sbin/iptables-restore iptables-restore /sbin/iptables-legacy-restore --slave /sbin/iptables-save iptables-save /sbin/iptables-legacy-save -# Expose Ports -EXPOSE 51820/udp -EXPOSE 51821/tcp +# Expose Ports (If needed on buildtime) +#EXPOSE 51820/udp +#EXPOSE 51821/tcp # Set Environment ENV DEBUG=Server,WireGuard diff --git a/README.md b/README.md index 683d7f80..27f52cce 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ To automatically install & run wg-easy, simply run: -e LANG=de \ -e WG_HOST=🚨YOUR_SERVER_IP \ -e PASSWORD=🚨YOUR_ADMIN_PASSWORD \ + -e PORT=51821 \ + -e WG_PORT=51820 \ -v ~/.wg-easy:/etc/wireguard \ -p 51820:51820/udp \ -p 51821:51821/tcp \ diff --git a/docker-compose.yml b/docker-compose.yml index b05426fb..5eec655e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: # Optional: # - PASSWORD=foobar123 + # - PORT=51821 # - WG_PORT=51820 # - WG_DEFAULT_ADDRESS=10.8.0.x # - WG_DEFAULT_DNS=1.1.1.1 From 187888e078c575e2b12ac91db692f3c33283239a Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:14:18 +0200 Subject: [PATCH 082/115] WireGuard.js: fixup ListenPort --- src/lib/WireGuard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 739676fb..aa5d42a2 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -95,7 +95,7 @@ module.exports = class WireGuard { [Interface] PrivateKey = ${config.server.privateKey} Address = ${config.server.address}/24 -ListenPort = 51820 +ListenPort = ${WG_PORT} PreUp = ${WG_PRE_UP} PostUp = ${WG_POST_UP} PreDown = ${WG_PRE_DOWN} From e6b5f2e33c35dc0afd59beb0556b57b024e6905e Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:22:07 +0200 Subject: [PATCH 083/115] fixup: README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 683d7f80..14ffccfe 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,10 @@ And log in again. To automatically install & run wg-easy, simply run: ``` - docker run -d \ --name=wg-easy \ + docker run -d \ --name=wg-easy \ -e LANG=de \ - -e WG_HOST=🚨YOUR_SERVER_IP \ - -e PASSWORD=🚨YOUR_ADMIN_PASSWORD \ + -e WG_HOST=<🚨YOUR_SERVER_IP> \ + -e PASSWORD=<🚨YOUR_ADMIN_PASSWORD> \ -v ~/.wg-easy:/etc/wireguard \ -p 51820:51820/udp \ -p 51821:51821/tcp \ From a05b71c65264f300651c397315134b1021699c56 Mon Sep 17 00:00:00 2001 From: Peter Lewis Date: Wed, 17 Apr 2024 21:39:08 +0100 Subject: [PATCH 084/115] Update README.md https://github.com/wg-easy/wg-easy/commit/2a3acdcad5b7c73feccdd47e4f3c5d743593e393#r141068572 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14ffccfe..7b3d957a 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,8 @@ And log in again. To automatically install & run wg-easy, simply run: ``` - docker run -d \ --name=wg-easy \ + docker run -d \ + --name=wg-easy \ -e LANG=de \ -e WG_HOST=<🚨YOUR_SERVER_IP> \ -e PASSWORD=<🚨YOUR_ADMIN_PASSWORD> \ From c29ba35d418eb5a564800a7df1ba1d17d00e4e7b Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:47:52 +0200 Subject: [PATCH 085/115] npm: update-browserslist-db --- .github/workflows/npm-update-bot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/npm-update-bot.yml b/.github/workflows/npm-update-bot.yml index ab5e0fba..e0e53eeb 100644 --- a/.github/workflows/npm-update-bot.yml +++ b/.github/workflows/npm-update-bot.yml @@ -35,6 +35,7 @@ jobs: cd src ncu -u npm update + npx update-browserslist-db@latest npm run buildcss git config --global user.name 'NPM Update Bot' git config --global user.email 'npmupbot@users.noreply.github.com' From e43688a0910a682723d75e4bf00226fff3b95f5d Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:50:29 +0200 Subject: [PATCH 086/115] npm: revert update-browserslist-db is not needed --- .github/workflows/npm-update-bot.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/npm-update-bot.yml b/.github/workflows/npm-update-bot.yml index e0e53eeb..ab5e0fba 100644 --- a/.github/workflows/npm-update-bot.yml +++ b/.github/workflows/npm-update-bot.yml @@ -35,7 +35,6 @@ jobs: cd src ncu -u npm update - npx update-browserslist-db@latest npm run buildcss git config --global user.name 'NPM Update Bot' git config --global user.email 'npmupbot@users.noreply.github.com' From 30321638143c16163e0c78dbf3771f049d1cd932 Mon Sep 17 00:00:00 2001 From: pheiduck <47042125+pheiduck@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:40:11 +0100 Subject: [PATCH 087/115] bump to node 20 --- .github/workflows/lint.yml | 2 +- .github/workflows/npm-update-bot.yml | 2 +- Dockerfile | 7 ++----- src/package-lock.json | 2 +- src/package.json | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 088710ae..6a38a604 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' check-latest: true cache: 'npm' cache-dependency-path: | diff --git a/.github/workflows/npm-update-bot.yml b/.github/workflows/npm-update-bot.yml index ab5e0fba..1bfa47ad 100644 --- a/.github/workflows/npm-update-bot.yml +++ b/.github/workflows/npm-update-bot.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' check-latest: true cache: 'npm' cache-dependency-path: | diff --git a/Dockerfile b/Dockerfile index fe3ae8d5..ee9af98a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,4 @@ -# There's an issue with node:20-alpine. -# Docker deployment is canceled after 25< minutes. - -FROM docker.io/library/node:18-alpine AS build_node_modules +FROM docker.io/library/node:20-alpine AS build_node_modules # Copy Web UI COPY src/ /app/ @@ -11,7 +8,7 @@ RUN npm ci --omit=dev &&\ # Copy build result to a new image. # This saves a lot of disk space. -FROM docker.io/library/node:18-alpine +FROM docker.io/library/node:20-alpine COPY --from=build_node_modules /app /app # Move node_modules one directory up, so during development diff --git a/src/package-lock.json b/src/package-lock.json index 3e728820..74f4c21d 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -21,7 +21,7 @@ "tailwindcss": "^3.4.3" }, "engines": { - "node": "18" + "node": "20" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/src/package.json b/src/package.json index d98a388f..f8359570 100644 --- a/src/package.json +++ b/src/package.json @@ -30,6 +30,6 @@ ] }, "engines": { - "node": "18" + "node": "20" } } From c8224f34f96f0f4675744b4ed55ca42e4507998f Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:04:38 +0200 Subject: [PATCH 088/115] Dockerfile: use nodejs 18 for build workaround to get nodejs 20 working on older arm architectures --- Dockerfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index ee9af98a..fc0c85c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ -FROM docker.io/library/node:20-alpine AS build_node_modules +FROM docker.io/library/node:18-alpine AS build_node_modules # Copy Web UI COPY src/ /app/ WORKDIR /app RUN npm ci --omit=dev &&\ + # Enable this to run `npm run serve` + npm i -g nodemon &&\ mv node_modules /node_modules # Copy build result to a new image. @@ -20,11 +22,8 @@ COPY --from=build_node_modules /app /app # than what runs inside of docker. COPY --from=build_node_modules /node_modules /node_modules -RUN \ - # Enable this to run `npm run serve` - npm i -g nodemon &&\ - # Delete unnecessary files - npm cache clean --force && rm -rf ~/.npm +# Delete unnecessary files +RUN npm cache clean --force && rm -rf ~/.npm # Install Linux packages RUN apk add --no-cache \ From 6e7f2f730e987dc983b9f0029bc6b5c7fa97f2e1 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:07:45 +0200 Subject: [PATCH 089/115] Dockerfile: move all npm steps --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fc0c85c4..a71256f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ WORKDIR /app RUN npm ci --omit=dev &&\ # Enable this to run `npm run serve` npm i -g nodemon &&\ + # Delete unnecessary files + npm cache clean --force && rm -rf ~/.npm mv node_modules /node_modules # Copy build result to a new image. @@ -22,9 +24,6 @@ COPY --from=build_node_modules /app /app # than what runs inside of docker. COPY --from=build_node_modules /node_modules /node_modules -# Delete unnecessary files -RUN npm cache clean --force && rm -rf ~/.npm - # Install Linux packages RUN apk add --no-cache \ dpkg \ From e6db5e8b7ff0852a4c914372d46bb00ac5796e5b Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:09:18 +0200 Subject: [PATCH 090/115] Dockerfile: missing operator --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a71256f6..c7ca2937 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN npm ci --omit=dev &&\ # Enable this to run `npm run serve` npm i -g nodemon &&\ # Delete unnecessary files - npm cache clean --force && rm -rf ~/.npm + npm cache clean --force && rm -rf ~/.npm &&\ mv node_modules /node_modules # Copy build result to a new image. From 6b284cb27c8850227833500a380425ae062f43d0 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:20:43 +0200 Subject: [PATCH 091/115] Dockerfile: add note --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index c7ca2937..cdae1edf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# As a workaround we have to build on nodejs 18 +# nodejs 20 hangs on build with armv6/armv7 FROM docker.io/library/node:18-alpine AS build_node_modules # Copy Web UI From 1e2da39a87a45f6c179e01d202f3c66a2a4338d0 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Sat, 20 Apr 2024 16:06:25 +0000 Subject: [PATCH 092/115] npm: package updates --- src/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 74f4c21d..1fb18d78 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -2655,9 +2655,9 @@ } }, "node_modules/iron-webcrypto": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.1.0.tgz", - "integrity": "sha512-5vgYsCakNlaQub1orZK5QmNYhwYtcllTkZBp5sfIaCqY93Cf6l+v2rtE+E4TMbcfjxDMCdrO8wmp7+ZvhDECLA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.1.1.tgz", + "integrity": "sha512-5xGwQUWHQSy039rFr+5q/zOmj7GP0Ypzvo34Ep+61bPIhaLduEDp/PvLGlU3awD2mzWUR0weN2vJ1mILydFPEg==", "funding": { "url": "https://github.com/sponsors/brc-dd" } From 4f8ee27d771f0ae272caf8d683da8aca6e258ae3 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:24:48 +0200 Subject: [PATCH 093/115] Create CODEOWNERS --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..bc2a2cf9 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Copyright (c) Emile Nijssen +# Founder and Codeowner of WireGuard Easy (wg-easy) From a3a69654fcac4c58bc4ab24c9a04b752ca04653a Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:18:51 +0200 Subject: [PATCH 094/115] docker-compose.yml: add healthcheck Thanks @CosasDePuma --- docker-compose.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 5eec655e..67defaf7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,3 +42,8 @@ services: sysctls: - net.ipv4.ip_forward=1 - net.ipv4.conf.all.src_valid_mark=1 + healthcheck: + test: /usr/bin/timeout 5s /bin/sh -c "/usr/bin/wg show | /bin/grep -q interface || exit 1" + interval: 1m + timeout: 5s + retries: 3 From 4911082a342b268afdf6edbd6e1d75ba4a5ba9f5 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Sat, 27 Apr 2024 16:19:23 +0000 Subject: [PATCH 095/115] npm: package updates --- src/package-lock.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 1fb18d78..4026afcc 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -24,16 +24,6 @@ "node": "20" } }, - "node_modules/@aashutoshrathi/word-wrap": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", - "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", - "dev": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -3355,18 +3345,18 @@ } }, "node_modules/optionator": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", - "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "peer": true, "dependencies": { - "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0" + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" }, "engines": { "node": ">= 0.8.0" @@ -3476,9 +3466,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", - "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.1.tgz", + "integrity": "sha512-tS24spDe/zXhWbNPErCHs/AGOzbKGHT+ybSBqmdLm8WZ1xXLWvH8Qn71QPAlqVhd0qUTWjy+Kl9JmISgDdEjsA==", "dev": true, "engines": { "node": "14 || >=16.14" @@ -4726,6 +4716,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", From 83408f6a9b80cf3b43f1e2994239a6d43bcb8bb2 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:34:20 +0200 Subject: [PATCH 096/115] add healthcheck into Dockerfile Thanks @CosasDePuma --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index cdae1edf..ecfa9262 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ RUN npm ci --omit=dev &&\ # Copy build result to a new image. # This saves a lot of disk space. FROM docker.io/library/node:20-alpine +HEALTHCHECK --interval=1m --timeout=5s --retries=3 CMD "/usr/bin/wg show | /bin/grep -q interface || exit 1" COPY --from=build_node_modules /app /app # Move node_modules one directory up, so during development From f9656d0bfe709ff1af2c3432169ac8c3914e7d93 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:35:22 +0200 Subject: [PATCH 097/115] healthcheck is integrated internally --- docker-compose.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 67defaf7..5eec655e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,8 +42,3 @@ services: sysctls: - net.ipv4.ip_forward=1 - net.ipv4.conf.all.src_valid_mark=1 - healthcheck: - test: /usr/bin/timeout 5s /bin/sh -c "/usr/bin/wg show | /bin/grep -q interface || exit 1" - interval: 1m - timeout: 5s - retries: 3 From 155541fbdb5bf886de48f43151ae99f92a6a2056 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:44:05 +0200 Subject: [PATCH 098/115] fixup: add timeout otherwise it reports unhealthy --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ecfa9262..30338fb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN npm ci --omit=dev &&\ # Copy build result to a new image. # This saves a lot of disk space. FROM docker.io/library/node:20-alpine -HEALTHCHECK --interval=1m --timeout=5s --retries=3 CMD "/usr/bin/wg show | /bin/grep -q interface || exit 1" +HEALTHCHECK --interval=1m --timeout=5s --retries=3 CMD "/usr/bin/timeout 5s /bin/sh -c /usr/bin/wg show | /bin/grep -q interface || exit 1" COPY --from=build_node_modules /app /app # Move node_modules one directory up, so during development From c5d328be2a59a4d39584a841b6a261fdf7e22484 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:55:06 +0200 Subject: [PATCH 099/115] fixup: Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 30338fb1..e98a580a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN npm ci --omit=dev &&\ # Copy build result to a new image. # This saves a lot of disk space. FROM docker.io/library/node:20-alpine -HEALTHCHECK --interval=1m --timeout=5s --retries=3 CMD "/usr/bin/timeout 5s /bin/sh -c /usr/bin/wg show | /bin/grep -q interface || exit 1" +HEALTHCHECK CMD /usr/bin/timeout 5s /bin/sh -c "/usr/bin/wg show | /bin/grep -q interface || exit 1" --interval=1m --timeout=5s --retries=3 COPY --from=build_node_modules /app /app # Move node_modules one directory up, so during development From 4cc07c5312a10475f4a079d3011d0ec1b09f153b Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Mon, 29 Apr 2024 00:03:04 +0000 Subject: [PATCH 100/115] npm: package updates --- src/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 4026afcc..356c081d 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -3466,9 +3466,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.1.tgz", - "integrity": "sha512-tS24spDe/zXhWbNPErCHs/AGOzbKGHT+ybSBqmdLm8WZ1xXLWvH8Qn71QPAlqVhd0qUTWjy+Kl9JmISgDdEjsA==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", "dev": true, "engines": { "node": "14 || >=16.14" @@ -4776,9 +4776,9 @@ "dev": true }, "node_modules/yaml": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", - "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz", + "integrity": "sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA==", "dev": true, "bin": { "yaml": "bin.mjs" From 488e3c32b3213391499f6be96d568d06934102a7 Mon Sep 17 00:00:00 2001 From: davide-acanfora Date: Tue, 30 Apr 2024 17:00:53 +0200 Subject: [PATCH 101/115] Fix typo in code comments --- src/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.js b/src/server.js index 1ad06b34..6584b768 100644 --- a/src/server.js +++ b/src/server.js @@ -22,7 +22,7 @@ process.on('SIGTERM', async () => { process.exit(0); }); -// Handle interupt signal +// Handle interrupt signal process.on('SIGINT', () => { // eslint-disable-next-line no-console console.log('SIGINT signal received.'); From 6b2f57f2f1152343af5778360df36c9b75dc0129 Mon Sep 17 00:00:00 2001 From: davide-acanfora Date: Tue, 30 Apr 2024 17:03:48 +0200 Subject: [PATCH 102/115] Added nodemon as a dev dependency and removed unnecessary instructions from the Dockerfile --- .dockerignore | 1 + Dockerfile | 6 +- src/package-lock.json | 135 ++++++++++++++++++++++++++++++++++++++++++ src/package.json | 3 +- 4 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..ca447caf --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +/src/node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e98a580a..d2032f62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,13 +3,9 @@ FROM docker.io/library/node:18-alpine AS build_node_modules # Copy Web UI -COPY src/ /app/ +COPY src /app WORKDIR /app RUN npm ci --omit=dev &&\ - # Enable this to run `npm run serve` - npm i -g nodemon &&\ - # Delete unnecessary files - npm cache clean --force && rm -rf ~/.npm &&\ mv node_modules /node_modules # Copy build result to a new image. diff --git a/src/package-lock.json b/src/package-lock.json index 356c081d..d9cefa6c 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -18,6 +18,7 @@ }, "devDependencies": { "eslint-config-athom": "^3.1.3", + "nodemon": "^3.1.0", "tailwindcss": "^3.4.3" }, "engines": { @@ -672,6 +673,12 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -2585,6 +2592,12 @@ "node": ">= 4" } }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -3195,6 +3208,92 @@ "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.4.tgz", "integrity": "sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==" }, + "node_modules/nodemon": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz", + "integrity": "sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/nodemon/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/nodemon/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -3710,6 +3809,12 @@ "node": ">=0.4.0" } }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -4083,6 +4188,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -4436,6 +4553,18 @@ "node": ">=8.0" } }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, "node_modules/ts-api-utils": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", @@ -4614,6 +4743,12 @@ "resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz", "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==" }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "node_modules/unenv": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/unenv/-/unenv-1.9.0.tgz", diff --git a/src/package.json b/src/package.json index f8359570..c3783206 100644 --- a/src/package.json +++ b/src/package.json @@ -5,7 +5,7 @@ "description": "The easiest way to run WireGuard VPN + Web-based Admin UI.", "main": "server.js", "scripts": { - "serve": "DEBUG=Server,WireGuard nodemon server.js", + "serve": "DEBUG=Server,WireGuard npx nodemon server.js", "serve-with-password": "PASSWORD=wg npm run serve", "lint": "eslint .", "buildcss": "npx tailwindcss -i ./www/src/css/app.css -o ./www/css/app.css" @@ -22,6 +22,7 @@ }, "devDependencies": { "eslint-config-athom": "^3.1.3", + "nodemon": "^3.1.0", "tailwindcss": "^3.4.3" }, "nodemonConfig": { From cada04ad0ec2f5c991603fc1b755f947f0ca352d Mon Sep 17 00:00:00 2001 From: davide-acanfora Date: Tue, 30 Apr 2024 17:04:33 +0200 Subject: [PATCH 103/115] Use the newer Docker Compose --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ded9b4e9..c0485821 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "version": "1.0.1", "scripts": { "build": "DOCKER_BUILDKIT=1 docker build --tag wg-easy .", - "serve": "docker-compose -f docker-compose.yml -f docker-compose.dev.yml up", + "serve": "docker compose -f docker-compose.yml -f docker-compose.dev.yml up", "start": "docker run --env WG_HOST=0.0.0.0 --name wg-easy --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl=\"net.ipv4.conf.all.src_valid_mark=1\" --mount type=bind,source=\"$(pwd)\"/config,target=/etc/wireguard -p 51820:51820/udp -p 51821:51821/tcp wg-easy" } } From 9b5b8c77c3d133018674c5b0f680c35202648fec Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Tue, 30 Apr 2024 17:53:00 +0000 Subject: [PATCH 104/115] npm: package updates --- src/package-lock.json | 265 ++++++++++++------------------------------ 1 file changed, 75 insertions(+), 190 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index d9cefa6c..574880dc 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -48,9 +48,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", + "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", "dev": true, "peer": true, "engines": { @@ -58,13 +58,13 @@ } }, "node_modules/@babel/highlight": { - "version": "7.24.2", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.2.tgz", - "integrity": "sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==", + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", + "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", "dev": true, "peer": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", + "@babel/helper-validator-identifier": "^7.24.5", "chalk": "^2.4.2", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" @@ -196,17 +196,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "peer": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/@eslint/eslintrc/node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -217,19 +206,6 @@ "node": ">= 4" } }, - "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", @@ -245,30 +221,6 @@ "node": ">=10.10.0" } }, - "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "peer": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -631,6 +583,30 @@ } } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/utils": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", @@ -958,12 +934,13 @@ } }, "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "node_modules/braces": { @@ -1747,16 +1724,6 @@ "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" } }, - "node_modules/eslint-plugin-import/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/eslint-plugin-import/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -1778,18 +1745,6 @@ "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-import/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/eslint-plugin-import/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -1835,28 +1790,6 @@ "eslint": ">=5.16.0" } }, - "node_modules/eslint-plugin-node/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/eslint-plugin-node/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/eslint-plugin-node/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -1916,17 +1849,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "peer": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/eslint/node_modules/eslint-visitor-keys": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", @@ -1960,19 +1882,6 @@ "node": ">= 4" } }, - "node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/espree": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", @@ -2391,30 +2300,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "peer": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -2432,12 +2317,13 @@ } }, "node_modules/globalthis": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", - "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", "dev": true, "dependencies": { - "define-properties": "^1.1.3" + "define-properties": "^1.2.1", + "gopd": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -3131,18 +3017,15 @@ } }, "node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": "*" } }, "node_modules/minimist": { @@ -3236,16 +3119,6 @@ "url": "https://opencollective.com/nodemon" } }, - "node_modules/nodemon/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/nodemon/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -3255,18 +3128,6 @@ "node": ">=4" } }, - "node_modules/nodemon/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/nodemon/node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -4388,6 +4249,15 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/sucrase/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/sucrase/node_modules/glob": { "version": "10.3.12", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", @@ -4410,6 +4280,21 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/sucrase/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -4453,16 +4338,16 @@ } }, "node_modules/table/node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz", + "integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==", "dev": true, "peer": true, "dependencies": { - "fast-deep-equal": "^3.1.1", + "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" + "uri-js": "^4.4.1" }, "funding": { "type": "github", From 34fdc313ae43ec00315676a02522cb7db692b485 Mon Sep 17 00:00:00 2001 From: "Philip H." <47042125+pheiduck@users.noreply.github.com> Date: Sat, 4 May 2024 13:18:20 +0000 Subject: [PATCH 105/115] docker-compose: `version` is obsolete --- docker-compose.dev.yml | 1 - docker-compose.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 08e46978..65e64297 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,4 +1,3 @@ -version: "3.8" services: wg-easy: image: wg-easy diff --git a/docker-compose.yml b/docker-compose.yml index 5eec655e..38ccf90a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: "3.8" volumes: etc_wireguard: From 66bb13ed307af1d68e89a94456a8e452afab7ea3 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Sat, 4 May 2024 13:19:02 +0000 Subject: [PATCH 106/115] npm: package updates --- src/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 574880dc..f7c81f29 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -3038,9 +3038,9 @@ } }, "node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.0.tgz", + "integrity": "sha512-oGZRv2OT1lO2UF1zUcwdTb3wqUwI0kBGTgt/T7OdSj6M6N5m3o5uPf0AIW6lVxGGoiWUR7e2AwTE+xiwK8WQig==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" From e46efd60888fad80832f8b7113271b78bf522de3 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Sat, 4 May 2024 20:59:36 +0200 Subject: [PATCH 107/115] package.json: rollback nodejs 18 because of build hang on newer nodejs version stick to nodejs 18 --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index c3783206..8e41069e 100644 --- a/src/package.json +++ b/src/package.json @@ -31,6 +31,6 @@ ] }, "engines": { - "node": "20" + "node": "18" } } From 195e307ff55984856894f8c4685ccf44d64856e2 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Sat, 4 May 2024 19:00:17 +0000 Subject: [PATCH 108/115] npm: package updates --- src/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package-lock.json b/src/package-lock.json index f7c81f29..a93a8741 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -22,7 +22,7 @@ "tailwindcss": "^3.4.3" }, "engines": { - "node": "20" + "node": "18" } }, "node_modules/@alloc/quick-lru": { From fb628bcb89da04a6db420cde595ec94e6fb72099 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 9 May 2024 13:21:09 +0200 Subject: [PATCH 109/115] Update npm to patched version of latest nodejs lts --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index d2032f62..a5957ab8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,9 @@ # nodejs 20 hangs on build with armv6/armv7 FROM docker.io/library/node:18-alpine AS build_node_modules +# Update npm to patched version of latest nodejs lts +RUN npm install -g npm@10.5.2 + # Copy Web UI COPY src /app WORKDIR /app From b60461e9177b04b106f82abd1ec61eea618a1934 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Thu, 9 May 2024 11:21:47 +0000 Subject: [PATCH 110/115] npm: package updates --- src/package-lock.json | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index a93a8741..29a5d8d5 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -2972,15 +2972,12 @@ "peer": true }, "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, "engines": { - "node": ">=10" + "node": "14 || >=16.14" } }, "node_modules/merge2": { @@ -3425,15 +3422,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", - "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", - "dev": true, - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -3947,13 +3935,10 @@ } }, "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.1.tgz", + "integrity": "sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -4789,12 +4774,6 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/yaml": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz", From e2eb7bc362512e3b6472fd7c8cf7a27cca97e56c Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 9 May 2024 17:28:28 +0200 Subject: [PATCH 111/115] avoid warnings on ci as we support nodejs latest lts version on instance without docker --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index 8e41069e..339ac112 100644 --- a/src/package.json +++ b/src/package.json @@ -31,6 +31,6 @@ ] }, "engines": { - "node": "18" + "node": ">=18" } } From 191dd74b0ccb4c3923f4344bfecef3bc720091fb Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Thu, 9 May 2024 15:29:08 +0000 Subject: [PATCH 112/115] npm: package updates --- src/package-lock.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 29a5d8d5..4fd15723 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -22,7 +22,7 @@ "tailwindcss": "^3.4.3" }, "engines": { - "node": "18" + "node": ">=18" } }, "node_modules/@alloc/quick-lru": { @@ -3035,9 +3035,9 @@ } }, "node_modules/minipass": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.0.tgz", - "integrity": "sha512-oGZRv2OT1lO2UF1zUcwdTb3wqUwI0kBGTgt/T7OdSj6M6N5m3o5uPf0AIW6lVxGGoiWUR7e2AwTE+xiwK8WQig==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.1.tgz", + "integrity": "sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" @@ -3407,9 +3407,9 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", - "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.0.tgz", + "integrity": "sha512-LNHTaVkzaYaLGlO+0u3rQTz7QrHTFOuKyba9JMTQutkmtNew8dw8wOD7mTU/5fCPZzCWpfW0XnQKzY61P0aTaw==", "dev": true, "dependencies": { "lru-cache": "^10.2.0", @@ -4244,16 +4244,16 @@ } }, "node_modules/sucrase/node_modules/glob": { - "version": "10.3.12", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", - "integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", + "version": "10.3.14", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.14.tgz", + "integrity": "sha512-4fkAqu93xe9Mk7le9v0y3VrPDqLKHarNi2s4Pv7f2yOvfhWfhc7hRPHC/JyqMqb8B/Dt/eGS4n7ykwf3fOsl8g==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.3.6", "minimatch": "^9.0.1", "minipass": "^7.0.4", - "path-scurry": "^1.10.2" + "path-scurry": "^1.11.0" }, "bin": { "glob": "dist/esm/bin.mjs" From 86146ccc688d57354403ef53249d8328f8083fb5 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 9 May 2024 20:00:36 +0200 Subject: [PATCH 113/115] Dockerfile: ensure to use latest npm cli --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5957ab8..ea500cd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ # nodejs 20 hangs on build with armv6/armv7 FROM docker.io/library/node:18-alpine AS build_node_modules -# Update npm to patched version of latest nodejs lts -RUN npm install -g npm@10.5.2 +# Update npm to latest +RUN npm install -g npm@latest # Copy Web UI COPY src /app From a43d2201fccb86f740c8bf2daa6de99f898412c9 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Thu, 9 May 2024 18:01:15 +0000 Subject: [PATCH 114/115] npm: package updates --- src/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index 4fd15723..a7661a1b 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -3935,9 +3935,9 @@ } }, "node_modules/semver": { - "version": "7.6.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.1.tgz", - "integrity": "sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "dev": true, "bin": { "semver": "bin/semver.js" From c6dd456a0703ed1b42ca52d21e8ef52918778377 Mon Sep 17 00:00:00 2001 From: NPM Update Bot Date: Mon, 13 May 2024 00:03:03 +0000 Subject: [PATCH 115/115] npm: package updates --- src/package-lock.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index a7661a1b..2a5a37b9 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -2544,9 +2544,9 @@ } }, "node_modules/iron-webcrypto": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.1.1.tgz", - "integrity": "sha512-5xGwQUWHQSy039rFr+5q/zOmj7GP0Ypzvo34Ep+61bPIhaLduEDp/PvLGlU3awD2mzWUR0weN2vJ1mILydFPEg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz", + "integrity": "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==", "funding": { "url": "https://github.com/sponsors/brc-dd" } @@ -3407,16 +3407,16 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.0.tgz", - "integrity": "sha512-LNHTaVkzaYaLGlO+0u3rQTz7QrHTFOuKyba9JMTQutkmtNew8dw8wOD7mTU/5fCPZzCWpfW0XnQKzY61P0aTaw==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -4244,9 +4244,9 @@ } }, "node_modules/sucrase/node_modules/glob": { - "version": "10.3.14", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.14.tgz", - "integrity": "sha512-4fkAqu93xe9Mk7le9v0y3VrPDqLKHarNi2s4Pv7f2yOvfhWfhc7hRPHC/JyqMqb8B/Dt/eGS4n7ykwf3fOsl8g==", + "version": "10.3.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.15.tgz", + "integrity": "sha512-0c6RlJt1TICLyvJYIApxb8GsXoai0KUP7AxKKAtsYXdgJR1mGEUa7DgwShbdk1nly0PYoZj01xd4hzbq3fsjpw==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", @@ -4259,7 +4259,7 @@ "glob": "dist/esm/bin.mjs" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs"