mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-05 15:03:39 +01:00
Add gluetun widget
This commit is contained in:
parent
074d42a8bd
commit
9060d3436c
@ -325,5 +325,10 @@
|
|||||||
"active": "Active",
|
"active": "Active",
|
||||||
"queue": "Queue",
|
"queue": "Queue",
|
||||||
"total": "Total"
|
"total": "Total"
|
||||||
|
},
|
||||||
|
"gluetun": {
|
||||||
|
"public_ip": "Public IP",
|
||||||
|
"region": "Region",
|
||||||
|
"country": "Country"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ const components = {
|
|||||||
coinmarketcap: dynamic(() => import("./coinmarketcap/component")),
|
coinmarketcap: dynamic(() => import("./coinmarketcap/component")),
|
||||||
docker: dynamic(() => import("./docker/component")),
|
docker: dynamic(() => import("./docker/component")),
|
||||||
emby: dynamic(() => import("./emby/component")),
|
emby: dynamic(() => import("./emby/component")),
|
||||||
|
gluetun: dynamic(() => import("./gluetun/component")),
|
||||||
gotify: dynamic(() => import("./gotify/component")),
|
gotify: dynamic(() => import("./gotify/component")),
|
||||||
homebridge: dynamic(() => import("./homebridge/component")),
|
homebridge: dynamic(() => import("./homebridge/component")),
|
||||||
jackett: dynamic(() => import("./jackett/component")),
|
jackett: dynamic(() => import("./jackett/component")),
|
||||||
|
35
src/widgets/gluetun/component.jsx
Normal file
35
src/widgets/gluetun/component.jsx
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
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: gluetunData, error: gluetunError } = useWidgetAPI(widget, "ip");
|
||||||
|
|
||||||
|
if (gluetunError) {
|
||||||
|
return <Container error={t("widget.api_error")} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gluetunData) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="gluetun.public_ip" />
|
||||||
|
<Block label="gluetun.region" />
|
||||||
|
<Block label="gluetun.country" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="gluetun.public_ip" value={gluetunData.public_ip} />
|
||||||
|
<Block label="gluetun.region" value={gluetunData.region} />
|
||||||
|
<Block label="gluetun.country" value={gluetunData.country} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
14
src/widgets/gluetun/widget.js
Normal file
14
src/widgets/gluetun/widget.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||||
|
|
||||||
|
const widget = {
|
||||||
|
api: "{url}/v1/{endpoint}",
|
||||||
|
proxyHandler: genericProxyHandler,
|
||||||
|
|
||||||
|
mappings: {
|
||||||
|
ip: {
|
||||||
|
endpoint: "publicip/ip",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default widget;
|
@ -5,6 +5,7 @@ import bazarr from "./bazarr/widget";
|
|||||||
import changedetectionio from "./changedetectionio/widget";
|
import changedetectionio from "./changedetectionio/widget";
|
||||||
import coinmarketcap from "./coinmarketcap/widget";
|
import coinmarketcap from "./coinmarketcap/widget";
|
||||||
import emby from "./emby/widget";
|
import emby from "./emby/widget";
|
||||||
|
import gluetun from "./gluetun/widget";
|
||||||
import gotify from "./gotify/widget";
|
import gotify from "./gotify/widget";
|
||||||
import homebridge from "./homebridge/widget";
|
import homebridge from "./homebridge/widget";
|
||||||
import jackett from "./jackett/widget";
|
import jackett from "./jackett/widget";
|
||||||
@ -46,6 +47,7 @@ const widgets = {
|
|||||||
changedetectionio,
|
changedetectionio,
|
||||||
coinmarketcap,
|
coinmarketcap,
|
||||||
emby,
|
emby,
|
||||||
|
gluetun,
|
||||||
gotify,
|
gotify,
|
||||||
homebridge,
|
homebridge,
|
||||||
jackett,
|
jackett,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user