Browse Source

fixes #199

pull/282/head
Emile Nijssen 3 years ago
parent
commit
90c4ca90bd
  1. 8
      src/lib/Server.js

8
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})`);
debug(`New Session: ${req.session.id}`);
}))
// WireGuard
@ -99,7 +99,11 @@ module.exports = class Server {
const { clientId } = req.params;
const client = await WireGuard.getClient({ clientId });
const config = await WireGuard.getClientConfiguration({ clientId });
const configName = client.name.replace(/[^a-zA-Z0-9_=+.-]/g, '-').replace(/(-{2,}|-$)/g, '-').replace(/-$/, '').substring(0, 32);
const configName = client.name
.replace(/[^a-zA-Z0-9_=+.-]/g, '-')
.replace(/(-{2,}|-$)/g, '-')
.replace(/-$/, '')
.substring(0, 32);
res.header('Content-Disposition', `attachment; filename="${configName}.conf"`);
res.header('Content-Type', 'text/plain');
res.send(config);

Loading…
Cancel
Save