|
|
|
@ -19,16 +19,11 @@ export default definePermissionEventHandler( |
|
|
|
} |
|
|
|
|
|
|
|
const config = await WireGuard.getClientConfiguration({ clientId }); |
|
|
|
const configName = client.name |
|
|
|
.replace(/[^a-zA-Z0-9_=+.-]/g, '-') |
|
|
|
.replace(/(-{2,}|-$)/g, '-') |
|
|
|
.replace(/-$/, '') |
|
|
|
.substring(0, 32); |
|
|
|
|
|
|
|
setHeader( |
|
|
|
event, |
|
|
|
'Content-Disposition', |
|
|
|
`attachment; filename="${configName || clientId}.conf"` |
|
|
|
`attachment; filename="${WireGuard.cleanClientFilename(client.name) || clientId}.conf"` |
|
|
|
); |
|
|
|
|
|
|
|
setHeader(event, 'Content-Type', 'text/plain'); |
|
|
|
|