Skip to content

Commit

Permalink
[call-me] - #3 add Unauthorized
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Dec 28, 2024
1 parent 4b59c03 commit 776503f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 776503f

Please sign in to comment.