mirror of
https://github.com/WeeJeWel/wg-easy.git
synced 2024-12-22 09:09:23 +08:00
fixes #199
This commit is contained in:
parent
a72029d7e5
commit
90c4ca90bd
@ -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…
Reference in New Issue
Block a user