mirror of
https://github.com/WeeJeWel/wg-easy.git
synced 2024-12-23 01:29:24 +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.authenticated = true;
|
||||||
req.session.save();
|
req.session.save();
|
||||||
|
|
||||||
debug(`New Session: ${req.session.id})`);
|
debug(`New Session: ${req.session.id}`);
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// WireGuard
|
// WireGuard
|
||||||
@ -99,7 +99,11 @@ module.exports = class Server {
|
|||||||
const { clientId } = req.params;
|
const { clientId } = req.params;
|
||||||
const client = await WireGuard.getClient({ clientId });
|
const client = await WireGuard.getClient({ clientId });
|
||||||
const config = await WireGuard.getClientConfiguration({ 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-Disposition', `attachment; filename="${configName}.conf"`);
|
||||||
res.header('Content-Type', 'text/plain');
|
res.header('Content-Type', 'text/plain');
|
||||||
res.send(config);
|
res.send(config);
|
||||||
|
Loading…
Reference in New Issue
Block a user