diff --git a/package-lock.json b/package-lock.json index 0fa0c252..26a861b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,4 +1,12 @@ { + "name": "wg-easy", "version": "1.0.0", - "lockfileVersion": 1 + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "wg-easy", + "version": "1.0.0" + } + } } diff --git a/src/lib/Server.js b/src/lib/Server.js index 7a54759b..3a20ed02 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -62,7 +62,7 @@ module.exports = class Server { req.session.authenticated = true; req.session.save(); - debug(`New Session: ${req.session.id})`); + console.log(`New Session: ${req.session.id})`); })) // WireGuard @@ -84,7 +84,7 @@ module.exports = class Server { req.session.destroy(); - debug(`Deleted Session: ${sessionId}`); + console.log(`Deleted Session: ${sessionId}`); })) .get('/api/wireguard/hardened', Util.promisify(async req => { return WireGuard.areClientsHardened(); @@ -138,7 +138,7 @@ module.exports = class Server { })) .listen(PORT, () => { - debug(`Listening on http://0.0.0.0:${PORT}`); + console.log(`Listening on http://0.0.0.0:${PORT}`); }); } diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 935f7553..c2e8c576 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -33,12 +33,12 @@ module.exports = class WireGuard { throw new Error('WG_HOST Environment Variable Not Set!'); } - debug('Loading configuration...'); + console.log('Loading configuration...'); let config; try { config = await fs.readFile(path.join(WG_PATH, 'wg0.json'), 'utf8'); config = JSON.parse(config); - debug('Configuration loaded.'); + console.log('Configuration loaded.'); } catch (err) { const privateKey = await Util.exec('wg genkey'); const publicKey = await Util.exec(`echo ${privateKey} | wg pubkey`, privateKey); @@ -52,7 +52,7 @@ module.exports = class WireGuard { }, clients: {}, }; - debug('Configuration generated.'); + console.log('Configuration generated.'); } await this.__saveConfig(config); @@ -110,20 +110,20 @@ PresharedKey = ${client.preSharedKey} AllowedIPs = ${client.address}/32`; } - debug('Config saving...'); + console.log('Config saving...'); await fs.writeFile(path.join(WG_PATH, 'wg0.json'), JSON.stringify(config, false, 2), { mode: 0o660, }); await fs.writeFile(path.join(WG_PATH, 'wg0.conf'), result, { mode: 0o600, }); - debug('Config saved.'); + console.log('Config saved.'); } async __syncConfig() { - debug('Config syncing...'); + console.log('Config syncing...'); await Util.exec('wg syncconf wg0 <(wg-quick strip wg0)'); - debug('Config synced.'); + console.log('Config synced.'); } async getDns() {