]> git.mxchange.org Git - friendica.git/commitdiff
Only fetch the first word for the platform
authorMichael <heluecht@pirati.ca>
Sun, 10 Jul 2022 13:52:38 +0000 (13:52 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 10 Jul 2022 13:52:38 +0000 (13:52 +0000)
src/Model/GServer.php

index fd87ec283d5a5a477cd323ab85cc692c5daab23b..fc70b4fe4735f9215db462f586d041bc1f478409 100644 (file)
@@ -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;