cloudflare widget validation, handle multiple connections, fix translation file error, capitalize status

pull/868/head
Michael Shamoon 2 years ago
parent 2836ee1f3b
commit 89c6528f24

@ -430,7 +430,7 @@
"temp_bed": "Bed temp", "temp_bed": "Bed temp",
"job_completion": "Completion" "job_completion": "Completion"
}, },
"cloudflared" { "cloudflared": {
"origin_ip": "Origin IP", "origin_ip": "Origin IP",
"status": "Status" "status": "Status"
} }

@ -20,10 +20,12 @@ export default function Component({ service }) {
); );
} }
const originIP = statsData.result.connections?.origin_ip ?? statsData.result.connections[0]?.origin_ip;
return ( return (
<Container service={service}> <Container service={service}>
<Block label="cloudflared.status" value={statsData.result.status} /> <Block label="cloudflared.status" value={statsData.result.status.charAt(0).toUpperCase() + statsData.result.status.slice(1)} />
<Block label="cloudflared.origin_ip" value={statsData.result.connections.origin_ip} /> <Block label="cloudflared.origin_ip" value={originIP} />
</Container> </Container>
); );
} }

@ -1,12 +1,16 @@
import credentialedProxyHandler from "utils/proxy/handlers/credentialed"; import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = { 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, proxyHandler: credentialedProxyHandler,
mappings: { mappings: {
"cfd_tunnel": { "cfd_tunnel": {
endpoint: "cfd_tunnel", endpoint: "cfd_tunnel",
validate: [
"success",
"result"
]
}, },
}, },
}; };

Loading…
Cancel
Save