mirror of
https://github.com/friendica/friendica
synced 2025-04-25 21:50:12 +00:00
Platforms: only use and show trusted detections
This commit is contained in:
parent
121e40357c
commit
650f90df25
2 changed files with 16 additions and 3 deletions
|
@ -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'];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue