diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 55edf803d..5477092aa 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -430,7 +430,7 @@ "temp_bed": "Bed temp", "job_completion": "Completion" }, - "cloudflared" { + "cloudflared": { "origin_ip": "Origin IP", "status": "Status" } diff --git a/src/widgets/cloudflared/component.jsx b/src/widgets/cloudflared/component.jsx index 061313580..2cbcd45b8 100644 --- a/src/widgets/cloudflared/component.jsx +++ b/src/widgets/cloudflared/component.jsx @@ -20,10 +20,12 @@ export default function Component({ service }) { ); } + const originIP = statsData.result.connections?.origin_ip ?? statsData.result.connections[0]?.origin_ip; + return ( - - + + ); } \ No newline at end of file diff --git a/src/widgets/cloudflared/widget.js b/src/widgets/cloudflared/widget.js index 787169341..1bb8819f7 100644 --- a/src/widgets/cloudflared/widget.js +++ b/src/widgets/cloudflared/widget.js @@ -1,12 +1,16 @@ import credentialedProxyHandler from "utils/proxy/handlers/credentialed"; const widget = { - api: "https://api.cloudflare.com/client/v4/accounts/{accountid}/{endpoint}/{tunnelid}?", + api: "https://api.cloudflare.com/client/v4/accounts/{accountid}/{endpoint}/{tunnelid}", proxyHandler: credentialedProxyHandler, mappings: { "cfd_tunnel": { endpoint: "cfd_tunnel", + validate: [ + "success", + "result" + ] }, }, };