Browse Source

fixup: lint errors

pull/737/head
Philip H. 3 years ago
committed by pheiduck
parent
commit
e3c41f2e28
  1. 2
      src/lib/Server.js
  2. 4
      src/lib/WireGuard.js
  3. 2
      src/www/js/app.js

2
src/lib/Server.js

@ -128,7 +128,7 @@ module.exports = class Server {
res.header('Content-Type', 'text/plain'); res.header('Content-Type', 'text/plain');
res.send(config); res.send(config);
})) }))
.post('/api/wireguard/client', Util.promisify(async req => { .post('/api/wireguard/client', Util.promisify(async (req) => {
const { name, allowedIps } = req.body; const { name, allowedIps } = req.body;
return WireGuard.createClient({ name, allowedIps }); return WireGuard.createClient({ name, allowedIps });
})) }))

4
src/lib/WireGuard.js

@ -232,11 +232,11 @@ Endpoint = ${WG_HOST}:${WG_PORT}`;
let address; let address;
if (allowedIps) { if (allowedIps) {
address = allowedIps address = allowedIps;
} else { } else {
// Calculate next IP // Calculate next IP
for (let i = 2; i < 255; i++) { for (let i = 2; i < 255; i++) {
const client = Object.values(config.clients).find(client => { const client = Object.values(config.clients).find((client) => {
return client.address.includes(WG_DEFAULT_ADDRESS.replace('x', i)); return client.address.includes(WG_DEFAULT_ADDRESS.replace('x', i));
}); });

2
src/www/js/app.js

@ -222,7 +222,7 @@ new Vue({
if (!name) return; if (!name) return;
this.api.createClient({ name, allowedIps }) this.api.createClient({ name, allowedIps })
.catch(err => alert(err.message || err.toString())) .catch((err) => alert(err.message || err.toString()))
.finally(() => this.refresh().catch(console.error)); .finally(() => this.refresh().catch(console.error));
}, },
deleteClient(client) { deleteClient(client) {

Loading…
Cancel
Save