From dad05f1c7655c0c4e72fc5736a9cf770e663fe6b Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 10 Jul 2022 13:52:38 +0000 Subject: [PATCH] Only fetch the first word for the platform --- src/Model/GServer.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Model/GServer.php b/src/Model/GServer.php index fd87ec283d..fc70b4fe47 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -486,7 +486,7 @@ class GServer $serverdata = self::detectGNUSocial($url, $serverdata); } } - } elseif (in_array($serverdata['platform'], ['friendica', 'friendika']) && in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) { + } elseif (in_array($serverdata['platform'], ['friendica', 'friendika']) && in_array($serverdata['detection-method'], array_merge(self::DETECT_UNSPECIFIC, [self::DETECT_SYSTEM_ACTOR]))) { $serverdata = self::detectFriendica($url, $serverdata); } @@ -1241,7 +1241,8 @@ class GServer $serverdata['site_name'] = JsonLD::fetchElement($actor, 'as:name', '@value'); $serverdata['info'] = JsonLD::fetchElement($actor, 'as:summary', '@value'); if (!empty($actor['as:generator'])) { - $serverdata['platform'] = JsonLD::fetchElement($actor['as:generator'], 'as:name', '@value'); + $generator = explode(' ', JsonLD::fetchElement($actor['as:generator'], 'as:name', '@value')); + $serverdata['platform'] = strtolower(array_shift($generator)); $serverdata['detection-method'] = self::DETECT_SYSTEM_ACTOR; } else { $serverdata['detection-method'] = self::DETECT_AP_ACTOR; -- 2.39.5