Compare commits

...

4 Commits

Author SHA1 Message Date
Dave 89d5f67366
Merge cc68db743d into d5e4d97f4f 2024-04-25 23:13:36 -05:00
TheFrenchGhosty d5e4d97f4f
Merge pull request #36 from iv-org/updown
Update to use the new layout from api
2024-04-22 20:58:43 +02:00
TheFrenchGhosty 312c3cd640
Update to use the new layout from api 2024-04-22 20:57:33 +02:00
root cc68db743d Add support for listing Tor/onion and i2p invidious instances. 2023-12-08 15:50:30 +00:00
2 changed files with 16 additions and 3 deletions

View File

@ -37,6 +37,7 @@ html(lang="en")
table
thead
tr
th(scope="col") Type
th(scope="col") Region
th(scope="col") Domain
th(scope="col") Health

View File

@ -52,19 +52,31 @@
return {
name: entry[0],
details: entry[1],
health: +(healthKnown ? entry[1].monitor["30dRatio"].ratio : 95),
health: +(healthKnown ? entry[1].monitor.uptime : 95),
healthKnown
}
}).filter(entry => {
return entry.details.type === "https" && entry.health > 0
return entry.health > 0
}).sort((a, b) => {
return b.health - a.health
}).forEach(entry => {
let target = entry.details.uri.replace(/\/*$/, "") + destinationPath
let address = entry.details.uri.replace(/\/*$/, "")
let target = address + destinationPath
const healthUnknown = entry.healthKnown ? "" : "health-unknown "
let type = "default"
switch(address.substr(address.lastIndexOf('.')+1))
{
case "onion":
type = "onion"
break
case "i2p":
type = "i2p"
break
}
const health = entry.healthKnown ? entry.health.toFixed(0) : "(unknown)"
q("#instances-tbody").appendChild(
createElement("tr", {}, [
createElement("td", {className: "column-center", textContent: type}),
createElement("td", {textContent: `${entry.details.flag} ${entry.details.region}`}),
createElement("td", {textContent: entry.name}),
createElement("td", {className: "column-center "+healthUnknown, textContent: health}),