mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 06:38:46 +00:00
Enhancement: Better handle some beszel errors (#4493)
This commit is contained in:
parent
cc9b4782f2
commit
fd05ae377c
2 changed files with 18 additions and 8 deletions
|
@ -59,7 +59,7 @@ export default async function beszelProxyHandler(req, res) {
|
|||
if (!token) {
|
||||
[status, token] = await login(loginUrl, widget.username, widget.password, service);
|
||||
if (status !== 200) {
|
||||
logger.debug(`HTTP ${status} logging into Beszel: ${token}`);
|
||||
logger.debug(`HTTP ${status} logging into Beszel: ${JSON.stringify(token)}`);
|
||||
return res.status(status).send(token);
|
||||
}
|
||||
}
|
||||
|
@ -72,13 +72,13 @@ export default async function beszelProxyHandler(req, res) {
|
|||
},
|
||||
});
|
||||
|
||||
if (status === 403) {
|
||||
if ([400, 403].includes(status)) {
|
||||
logger.debug(`HTTP ${status} retrieving data from Beszel, logging in and trying again.`);
|
||||
cache.del(`${tokenCacheKey}.${service}`);
|
||||
[status, token] = await login(loginUrl, widget.username, widget.password, service);
|
||||
|
||||
if (status !== 200) {
|
||||
logger.debug(`HTTP ${status} logging into Beszel: ${data}`);
|
||||
logger.debug(`HTTP ${status} logging into Beszel: ${JSON.stringify(data)}`);
|
||||
return res.status(status).send(data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue