mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-12 07:58:49 +00:00
Fix crowdsec widget with no bans / alerts
This commit is contained in:
parent
d4c0e482d3
commit
97d193faf1
2 changed files with 3 additions and 7 deletions
|
@ -16,7 +16,7 @@ export default function Component({ service }) {
|
||||||
return <Container service={service} error={alertsError ?? bansError} />;
|
return <Container service={service} error={alertsError ?? bansError} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alerts || !bans) {
|
if (!alerts && !bans) {
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block label="crowdsec.alerts" />
|
<Block label="crowdsec.alerts" />
|
||||||
|
@ -27,8 +27,8 @@ export default function Component({ service }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block label="crowdsec.alerts" value={t("common.number", { value: alerts.length })} />
|
<Block label="crowdsec.alerts" value={t("common.number", { value: alerts?.length ?? 0 })} />
|
||||||
<Block label="crowdsec.bans" value={t("common.number", { value: bans.length })} />
|
<Block label="crowdsec.bans" value={t("common.number", { value: bans?.length ?? 0 })} />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,10 +71,6 @@ export default async function crowdsecProxyHandler(req, res) {
|
||||||
|
|
||||||
logger.debug("Calling Crowdsec API endpoint: %s", endpoint);
|
logger.debug("Calling Crowdsec API endpoint: %s", endpoint);
|
||||||
|
|
||||||
if (endpoint.indexOf("decisions") === 0) {
|
|
||||||
delete params.headers.Authorization;
|
|
||||||
}
|
|
||||||
|
|
||||||
const [status, , data] = await httpProxy(url, params);
|
const [status, , data] = await httpProxy(url, params);
|
||||||
|
|
||||||
if (status !== 200) {
|
if (status !== 200) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue