Merge pull request #13654 from annando/gserver-non-native

Simplify gserver entry creation for non native networks
This commit is contained in:
Hypolite Petovan 2023-11-19 18:45:55 -05:00 committed by GitHub
commit fc00bf13bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,6 @@ class GServer
const DETECT_MASTODON_API = 16; const DETECT_MASTODON_API = 16;
const DETECT_STATUS_PHP = 17; // Nextcloud const DETECT_STATUS_PHP = 17; // Nextcloud
const DETECT_V1_CONFIG = 18; const DETECT_V1_CONFIG = 18;
const DETECT_PUMPIO = 19; // Deprecated
const DETECT_SYSTEM_ACTOR = 20; // Mistpark, Osada, Roadhouse, Zap const DETECT_SYSTEM_ACTOR = 20; // Mistpark, Osada, Roadhouse, Zap
// Standardized endpoints // Standardized endpoints
@ -617,10 +616,14 @@ class GServer
return false; return false;
} }
$serverdata = self::parseNodeinfo210($curlResult); if (!empty($network) && !in_array($network, Protocol::NATIVE_SUPPORT)) {
if (empty($serverdata)) { $serverdata = ['detection-method' => self::DETECT_MANUAL, 'network' => $network, 'platform' => '', 'version' => '', 'site_name' => '', 'info' => ''];
$curlResult = DI::httpClient()->get($url . '/.well-known/nodeinfo', HttpClientAccept::JSON); } else {
$serverdata = self::fetchNodeinfo($url, $curlResult); $serverdata = self::parseNodeinfo210($curlResult);
if (empty($serverdata)) {
$curlResult = DI::httpClient()->get($url . '/.well-known/nodeinfo', HttpClientAccept::JSON);
$serverdata = self::fetchNodeinfo($url, $curlResult);
}
} }
if ($only_nodeinfo && empty($serverdata)) { if ($only_nodeinfo && empty($serverdata)) {