|
|
|
@ -53,15 +53,17 @@ module.exports = class Server { |
|
|
|
const { password } = ctx.request.body; |
|
|
|
|
|
|
|
if (typeof password !== 'string') { |
|
|
|
throw new ServerError('Missing: Password', 401); |
|
|
|
ctx.throw(401, JSON.stringify({ error: 'Missing: Password' })); |
|
|
|
} |
|
|
|
|
|
|
|
if (password !== PASSWORD) { |
|
|
|
throw new ServerError('Incorrect Password', 401); |
|
|
|
ctx.throw(401, JSON.stringify({ error: 'Incorrect Password' })); |
|
|
|
} |
|
|
|
|
|
|
|
ctx.session.authenticated = true; |
|
|
|
|
|
|
|
ctx.status = 204; |
|
|
|
|
|
|
|
debug(`New Session: ${ctx.session.id}`); |
|
|
|
}) |
|
|
|
|
|
|
|
@ -96,6 +98,8 @@ module.exports = class Server { |
|
|
|
|
|
|
|
ctx.session = null; |
|
|
|
|
|
|
|
ctx.status = 204; |
|
|
|
|
|
|
|
debug(`Deleted Session: ${sessionId}`); |
|
|
|
}) |
|
|
|
.get('/api/wireguard/client', async (ctx) => { |
|
|
|
|