[call-me] - #3 add Unauthorized
This commit is contained in:
+6
-1
@@ -149,7 +149,7 @@ app.get('/join/', (req, res) => {
|
||||
if (config.roomPasswordEnabled && password !== config.roomPassword) {
|
||||
// http://localhost:8000/join?user=user1&password=123456789
|
||||
// http://localhost:8000/join?user=user2&call=user1&password=123456789
|
||||
return notFound(res);
|
||||
return unauthorized(res);
|
||||
}
|
||||
return res.sendFile(HOME);
|
||||
}
|
||||
@@ -233,6 +233,11 @@ function notFound(res) {
|
||||
res.json({ data: '404 not found' });
|
||||
}
|
||||
|
||||
// Unauthorized
|
||||
function unauthorized(res) {
|
||||
res.json({ data: '401 Unauthorized' });
|
||||
}
|
||||
|
||||
// Utility function to check API key authorization
|
||||
const isAuthorized = (req) => {
|
||||
const { authorization } = req.headers;
|
||||
|
||||
Reference in New Issue
Block a user