Merge pull request #512 from Tarow/gluetun-widget

Add gluetun widget
pull/535/head
shamoon 2 years ago committed by GitHub
commit 6e7236981b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -325,5 +325,10 @@
"active": "Active",
"queue": "Queue",
"total": "Total"
},
"gluetun": {
"public_ip": "Public IP",
"region": "Region",
"country": "Country"
}
}

@ -9,6 +9,7 @@ const components = {
coinmarketcap: dynamic(() => import("./coinmarketcap/component")),
docker: dynamic(() => import("./docker/component")),
emby: dynamic(() => import("./emby/component")),
gluetun: dynamic(() => import("./gluetun/component")),
gotify: dynamic(() => import("./gotify/component")),
homebridge: dynamic(() => import("./homebridge/component")),
jackett: dynamic(() => import("./jackett/component")),

@ -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>
);
}

@ -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 coinmarketcap from "./coinmarketcap/widget";
import emby from "./emby/widget";
import gluetun from "./gluetun/widget";
import gotify from "./gotify/widget";
import homebridge from "./homebridge/widget";
import jackett from "./jackett/widget";
@ -46,6 +47,7 @@ const widgets = {
changedetectionio,
coinmarketcap,
emby,
gluetun,
gotify,
homebridge,
jackett,

Loading…
Cancel
Save