Fixed updated auth handling

This commit is contained in:
2026-07-26 22:40:07 -04:00
parent ae0ce97b69
commit 350c22887d
2 changed files with 33 additions and 43 deletions
+8 -3
View File
@@ -24,17 +24,19 @@ app.all(/.*/, (req, res) => {
let hazePwHash = null;
let hazeUser = null;
if (req.query.auth) {
request({
let api_data = {
...reqOpts,
url: reqOpts.url + req.baseUrl,
headers: {
Authorization: `Basic ${req.query.auth}`
}
}, (error, response, body) => {
};
request(api_data, (error, response, body) => {
if (error) {
res.status(500).send('Internal Server Error');
return;
} else if (response.statusCode !== 200) {
console.dir(api_data);
res.status(response.statusCode).send(body);
return;
} else {
@@ -42,9 +44,12 @@ app.all(/.*/, (req, res) => {
res.send(body);
}
})
} else {
res.status(401).send('Unauthorized');
return;
}
});
app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});
});