Commit 99e955ea authored by dmorley's avatar dmorley

update regex to remove port. Support json format of some other networks

parent ca9b9b7b
......@@ -90,6 +90,8 @@ if (!$stop) {
if ($info = json_decode($nodeinfo_meta['body'] ?: '', true)) {
if (count($info['links'], COUNT_RECURSIVE) === 2) {
$nodeinfo_url = $info['links']['href'];
} elseif (count($info['links'], COUNT_RECURSIVE) === 4) {
$nodeinfo_url = $info['links'][1]['href'];
} else {
$nodeinfo_url = max($info['links'])['href'];
}
......
......@@ -51,14 +51,14 @@ $federationpods = curl('https://the-federation.info/graphql?query=%7Bnodes%7Bhos
if ($pods = json_decode($federationpods['body'] ?: '', true)) {
foreach ($pods['data']['nodes'] ?? [] as $poddata) {
$protocols = array_column($poddata['protocols'] ?? [], 'name');
$foundpods[] = strtolower(preg_replace('(^https?://)', '', $poddata['host']));
$foundpods[] = strtolower(preg_replace('/(https?:\/\/)?(:(\d*))?/', '', $poddata['host']));
}
}
$diasppods = curl('https://diasp.org/pods.json', false, 45);
if ($pods = json_decode($diasppods['body'] ?: '', true)) {
foreach ($pods ?? [] as $poddata) {
$foundpods[] = strtolower($poddata['host']);
$foundpods[] = strtolower(preg_replace('/(https?:\/\/)?(:(\d*))?/', '', $poddata['host']));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment