nutrition-mcp/scripts/health-sync.tsx

39 lines
No EOL
904 B
TypeScript

// @ts-nocheck
// Health Sync v9 — minimal test with timeout + IP fallback
import { Script } from "scripting"
// icon-color: deep-blue; icon-glyph: heart;
async function main() {
console.log("v9: script started")
// Try hostname first, then LAN IP
const urls = [
"http://chronos:9432/health",
"http://192.168.1.148:9432/health",
"http://100.120.136.16:9432/health"
]
for (const url of urls) {
console.log("v9: trying " + url)
try {
const response = await fetch(url, {
allowInsecureRequest: true,
timeout: 5
})
const text = await response.text()
console.log("v9: SUCCESS from " + url + " = " + text)
break
} catch (e) {
console.log("v9: FAILED " + url + " = " + e)
}
}
console.log("v9: done")
}
main().then(() => Script.exit()).catch((e) => {
console.log("v9: main() error = " + e)
Script.exit()
})