1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-22 16:17:29 +00:00

Add RSS and Cloudflare to /api/instances

This commit is contained in:
Cadence Fish 2020-02-14 23:32:02 +13:00
parent 12798c23aa
commit b9c4a9a090
No known key found for this signature in database
GPG Key ID: 81015DF9AA8607E1

View File

@ -27,13 +27,15 @@ module.exports = [
while (inTable && parser.hasRemaining()) { while (inTable && parser.hasRemaining()) {
const line = parser.get({split: "\n"}) const line = parser.get({split: "\n"})
if (line.startsWith("|")) { if (line.startsWith("|")) {
/** [empty, official, address, country] */ /** [empty, official, address, country, rss, cloudflare] */
const parts = line.split("|") const parts = line.split("|")
if (parts.length >= 4 && parts[2].includes("://")) { if (parts.length >= 4 && parts[2].includes("://")) {
instances.push({ instances.push({
address: parts[2].trim(), address: parts[2].trim(),
country: parts[3].match(/[A-Z]{2,}|$/)[0] || null, country: parts[3].match(/[A-Z]{2,}|$/)[0] || null,
official: parts[1].trim() === ":white_check_mark:" official: parts[1].trim() === ":white_check_mark:",
rss: parts[4].trim() === ":white_check_mark:",
cloudflare: parts[5].trim() === ":crying_cat_face:"
}) })
} }
} else { } else {