mark sites as "phantom" that are up but couldn't be detected
This commit is contained in:
parent
ea2faa28fe
commit
f1cac5170b
1 changed files with 6 additions and 12 deletions
|
@ -1562,7 +1562,7 @@ class GServer
|
||||||
|
|
||||||
// Using only body information we cannot safely detect a lot of systems.
|
// Using only body information we cannot safely detect a lot of systems.
|
||||||
// So we define a list of platforms that we can detect safely.
|
// So we define a list of platforms that we can detect safely.
|
||||||
$valid_platforms = ['friendica', 'friendika', 'hubzilla', 'misskey', 'peertube', 'wordpress', 'write.as'];
|
$valid_platforms = ['friendica', 'friendika', 'diaspora', 'mastodon', 'hubzilla', 'misskey', 'peertube', 'wordpress', 'write.as'];
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadHTML($curlResult->getBody());
|
@$doc->loadHTML($curlResult->getBody());
|
||||||
|
@ -1592,11 +1592,6 @@ class GServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$platform = explode(' ', strtolower($attr['content']));
|
|
||||||
if (!in_array($platform[0], $valid_platforms)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($attr['name'] == 'description') {
|
if ($attr['name'] == 'description') {
|
||||||
$serverdata['info'] = $attr['content'];
|
$serverdata['info'] = $attr['content'];
|
||||||
}
|
}
|
||||||
|
@ -1656,11 +1651,6 @@ class GServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$platform = explode(' ', strtolower($attr['content']));
|
|
||||||
if (!in_array($platform[0], $valid_platforms)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($attr['property'] == 'og:site_name') {
|
if ($attr['property'] == 'og:site_name') {
|
||||||
$serverdata['site_name'] = $attr['content'];
|
$serverdata['site_name'] = $attr['content'];
|
||||||
}
|
}
|
||||||
|
@ -1687,7 +1677,11 @@ class GServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($serverdata['network']) && ($serverdata['detection-method'] == self::DETECT_MANUAL)) {
|
if (!empty($serverdata['platform']) && in_array($serverdata['detection-method'], [self::DETECT_MANUAL, self::DETECT_BODY]) && !in_array($serverdata['platform'], $valid_platforms)) {
|
||||||
|
$serverdata['network'] = Protocol::PHANTOM;
|
||||||
|
$serverdata['version'] = '';
|
||||||
|
$serverdata['detection-method'] = self::DETECT_MANUAL;
|
||||||
|
} elseif (!empty($serverdata['network']) && ($serverdata['detection-method'] == self::DETECT_MANUAL)) {
|
||||||
$serverdata['detection-method'] = self::DETECT_BODY;
|
$serverdata['detection-method'] = self::DETECT_BODY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue