Last active
April 18, 2025 05:57
-
-
Save 20kaushik02/b10f576a9f12eee5883e6186509052cc to your computer and use it in GitHub Desktop.
Homepage (https://gethomepage.dev) widget for FoundryVTT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setInterval(() => { | |
let f_id = 'my_foundry_service' | |
let foundry_error_text = document.querySelector(`#${f_id} details summary div`); | |
let foundry_status_div = document.querySelector(`#${f_id} .service-container .font-thin.text-sm:nth-child(1)`); | |
// if API is down | |
if(!!foundry_error_text && foundry_error_text.innerText != "Offline") { | |
foundry_error_text.innerText="Offline"; | |
} | |
// else check status text to set color | |
else { | |
if(foundry_status_div) { | |
let foundry_status_text = foundry_status_div.innerHTML; | |
if (foundry_status_text === 'Running') { | |
foundry_status_div.innerHTML = '<span class="text-green-500">Running</span>'; | |
} else if (foundry_status_text === 'Inactive') { | |
foundry_status_div.innerHTML = '<span class="text-blue-500/80">Inactive</span>'; | |
} | |
} | |
} | |
}, 500); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- My Services: | |
- Foundry: | |
id: my_foundry_service | |
icon: foundry-vtt.png | |
description: Foundry VTT status | |
siteMonitor: https://foundry.myhost.com | |
href: https://foundry.myhost.com | |
widget: | |
type: customapi | |
url: https://foundry.myhost.com/api/status | |
refreshInterval: 10000 | |
method: GET | |
mappings: | |
- field: active | |
label: STATUS | |
remap: | |
- value: true | |
to: Running | |
- value: false | |
to: Inactive | |
- field: users | |
label: PLAYERS | |
format: text | |
- field: version | |
label: VERSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment