Platforms: only use and show trusted detections

This commit is contained in:
Michael 2022-02-05 22:14:19 +00:00
parent 121e40357c
commit 650f90df25
2 changed files with 16 additions and 3 deletions

View file

@ -1566,6 +1566,10 @@ class GServer
return $serverdata;
}
// Using only body information we cannot safely detect a lot of systems.
// So we define a list of platforms that we can detect safely.
$valid_platforms = ['friendica', 'friendika', 'hubzilla', 'misskey', 'peertube', 'wordpress', 'write.as'];
$doc = new DOMDocument();
@$doc->loadHTML($curlResult->getBody());
$xpath = new DOMXPath($doc);
@ -1594,6 +1598,10 @@ class GServer
}
}
if (!in_array(strtolower($attr['content']), $valid_platforms)) {
continue;
}
if ($attr['name'] == 'description') {
$serverdata['info'] = $attr['content'];
}
@ -1653,6 +1661,10 @@ class GServer
}
}
if (!in_array(strtolower($attr['content']), $valid_platforms)) {
continue;
}
if ($attr['property'] == 'og:site_name') {
$serverdata['site_name'] = $attr['content'];
}