|
|
@ -111,7 +111,8 @@ module.exports = class Server { |
|
|
requiresPassword, |
|
|
requiresPassword, |
|
|
authenticated, |
|
|
authenticated, |
|
|
}; |
|
|
}; |
|
|
})) |
|
|
}), |
|
|
|
|
|
) |
|
|
.post('/api/session', defineEventHandler(async (event) => { |
|
|
.post('/api/session', defineEventHandler(async (event) => { |
|
|
const { password } = await readBody(event); |
|
|
const { password } = await readBody(event); |
|
|
|
|
|
|
|
|
@ -137,8 +138,7 @@ module.exports = class Server { |
|
|
debug(`New Session: ${event.node.req.session.id}`); |
|
|
debug(`New Session: ${event.node.req.session.id}`); |
|
|
|
|
|
|
|
|
return { success: true }; |
|
|
return { success: true }; |
|
|
}) |
|
|
})); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// WireGuard
|
|
|
// WireGuard
|
|
|
app.use( |
|
|
app.use( |
|
|
@ -280,11 +280,11 @@ module.exports = class Server { |
|
|
setHeader( |
|
|
setHeader( |
|
|
event, |
|
|
event, |
|
|
'Content-Disposition', |
|
|
'Content-Disposition', |
|
|
'attachment; filename="wg0.json"' |
|
|
'attachment; filename="wg0.json"', |
|
|
); |
|
|
); |
|
|
setHeader(event, 'Content-Type', 'text/json'); |
|
|
setHeader(event, 'Content-Type', 'text/json'); |
|
|
return config; |
|
|
return config; |
|
|
}) |
|
|
}), |
|
|
) |
|
|
) |
|
|
.put( |
|
|
.put( |
|
|
'/api/wireguard/restore', |
|
|
'/api/wireguard/restore', |
|
|
@ -292,7 +292,7 @@ module.exports = class Server { |
|
|
const { file } = await readBody(event); |
|
|
const { file } = await readBody(event); |
|
|
await WireGuard.restoreConfiguration(file); |
|
|
await WireGuard.restoreConfiguration(file); |
|
|
return { success: true }; |
|
|
return { success: true }; |
|
|
}) |
|
|
}), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// Static assets
|
|
|
// Static assets
|
|
|
|