mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-07 22:28:48 +00:00
adding cloudflare widget
This commit is contained in:
parent
01eea51555
commit
fa1792cd5f
6 changed files with 58 additions and 0 deletions
30
src/widgets/cloudflared/component.jsx
Normal file
30
src/widgets/cloudflared/component.jsx
Normal file
|
@ -0,0 +1,30 @@
|
|||
import Container from "components/services/widget/container";
|
||||
import Block from "components/services/widget/block";
|
||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
const { widget } = service;
|
||||
|
||||
const { data: statsData, error: statsError } = useWidgetAPI(widget, "cfd_tunnel");
|
||||
|
||||
if (statsError) {
|
||||
return <Container error={statsError} />;
|
||||
}
|
||||
|
||||
if (!statsData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="cloudflared.status" />
|
||||
<Block label="cloudflared.origin_ip" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="cloudflared.status" value={statsData.status} />
|
||||
<Block label="cloudflared.origin_ip" value={statsData.origin_ip} />
|
||||
</Container>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue