Improved server detection
This commit is contained in:
parent
98954dd14e
commit
cc75eb5d18
9 changed files with 660 additions and 342 deletions
|
|
@ -91,8 +91,8 @@ HELP;
|
||||||
|
|
||||||
if ((count($this->args) == 1) && ($this->getArgument(0) == 'list')) {
|
if ((count($this->args) == 1) && ($this->getArgument(0) == 'list')) {
|
||||||
$contacts = $this->dba->select('apcontact', ['url'],
|
$contacts = $this->dba->select('apcontact', ['url'],
|
||||||
["`type` = ? AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` = ?)",
|
["`type` IN (?, ?) AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` = ?)",
|
||||||
'Application', 0, Contact::FRIEND]);
|
'Application', 'Service', 0, Contact::FRIEND]);
|
||||||
while ($contact = $this->dba->fetch($contacts)) {
|
while ($contact = $this->dba->fetch($contacts)) {
|
||||||
$this->out($contact['url']);
|
$this->out($contact['url']);
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +108,7 @@ HELP;
|
||||||
$actor = $this->getArgument(1);
|
$actor = $this->getArgument(1);
|
||||||
|
|
||||||
$apcontact = APContact::getByURL($actor);
|
$apcontact = APContact::getByURL($actor);
|
||||||
if (empty($apcontact) || ($apcontact['type'] != 'Application')) {
|
if (empty($apcontact) || !in_array($apcontact['type'], ['Application', 'Service'])) {
|
||||||
$this->out($actor . ' is no relay actor');
|
$this->out($actor . ' is no relay actor');
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,11 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
use Friendica\Protocol\ActivityPub;
|
use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the class for jobs that are executed in an interval
|
* Contains the class for jobs that are executed in an interval
|
||||||
|
|
@ -179,4 +181,24 @@ class Cron
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add missing "intro" records.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private static function addIntros()
|
||||||
|
{
|
||||||
|
$contacts = DBA::p("SELECT `uid`, `id`, `created` FROM `contact` WHERE `rel` = ? AND `pending` AND NOT EXISTS (SELECT `id` FROM `intro` WHERE `contact-id` = `contact`.`id`)", Contact::FOLLOWER);
|
||||||
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
|
$fields = [
|
||||||
|
'uid' => $contact['uid'],
|
||||||
|
'contact-id' => $contact['id'],
|
||||||
|
'datetime' => $contact['created'],
|
||||||
|
'hash' => Strings::getRandomHex()
|
||||||
|
];
|
||||||
|
Logger::notice('Adding missing intro', ['fields' => $fields]);
|
||||||
|
DBA::insert('intro', $fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,8 @@ class APContact
|
||||||
return $fetched_contact;
|
return $fetched_contact;
|
||||||
}
|
}
|
||||||
$url = $apcontact['url'];
|
$url = $apcontact['url'];
|
||||||
|
} elseif (empty(parse_url($url, PHP_URL_PATH))) {
|
||||||
|
$apcontact['baseurl'] = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect multiple fast repeating request to the same address
|
// Detect multiple fast repeating request to the same address
|
||||||
|
|
|
||||||
|
|
@ -30,16 +30,22 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\Database\DBStructure;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Register;
|
use Friendica\Module\Register;
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
||||||
use Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses;
|
use Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses;
|
||||||
|
use Friendica\Network\Probe;
|
||||||
|
use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Protocol\Relay;
|
use Friendica\Protocol\Relay;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
use Friendica\Util\JsonLD;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
use GuzzleHttp\Exception\TransferException;
|
||||||
|
use Friendica\Network\HTTPException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class handles GServer related functions
|
* This class handles GServer related functions
|
||||||
|
|
@ -57,6 +63,12 @@ class GServer
|
||||||
const DETECT_MANUAL = 0;
|
const DETECT_MANUAL = 0;
|
||||||
const DETECT_HEADER = 1;
|
const DETECT_HEADER = 1;
|
||||||
const DETECT_BODY = 2;
|
const DETECT_BODY = 2;
|
||||||
|
const DETECT_HOST_META = 3;
|
||||||
|
const DETECT_CONTACTS = 4;
|
||||||
|
const DETECT_AP_ACTOR = 5;
|
||||||
|
const DETECT_AP_COLLECTION = 6;
|
||||||
|
|
||||||
|
const DETECT_UNSPECIFIC = [self::DETECT_MANUAL, self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_HOST_META, self::DETECT_CONTACTS, self::DETECT_AP_ACTOR];
|
||||||
|
|
||||||
// Implementation specific endpoints
|
// Implementation specific endpoints
|
||||||
const DETECT_FRIENDIKA = 10;
|
const DETECT_FRIENDIKA = 10;
|
||||||
|
|
@ -68,12 +80,14 @@ 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;
|
const DETECT_PUMPIO = 19; // Deprecated
|
||||||
|
const DETECT_SYSTEM_ACTOR = 20; // Mistpark, Osada, Roadhouse, Zap
|
||||||
|
|
||||||
// Standardized endpoints
|
// Standardized endpoints
|
||||||
const DETECT_STATISTICS_JSON = 100;
|
const DETECT_STATISTICS_JSON = 100;
|
||||||
const DETECT_NODEINFO_1 = 101;
|
const DETECT_NODEINFO_1 = 101;
|
||||||
const DETECT_NODEINFO_2 = 102;
|
const DETECT_NODEINFO_2 = 102;
|
||||||
|
const DETECT_NODEINFO_210 = 103;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for the existance of a server and adds it in the background if not existant
|
* Check for the existance of a server and adds it in the background if not existant
|
||||||
|
|
@ -108,7 +122,7 @@ class GServer
|
||||||
|
|
||||||
$gserver = DBA::selectFirst('gserver', ['id'], ['nurl' => Strings::normaliseLink($url)]);
|
$gserver = DBA::selectFirst('gserver', ['id'], ['nurl' => Strings::normaliseLink($url)]);
|
||||||
if (DBA::isResult($gserver)) {
|
if (DBA::isResult($gserver)) {
|
||||||
Logger::info('Got ID for URL', ['id' => $gserver['id'], 'url' => $url, 'callstack' => System::callstack(20)]);
|
Logger::debug('Got ID for URL', ['id' => $gserver['id'], 'url' => $url, 'callstack' => System::callstack(20)]);
|
||||||
return $gserver['id'];
|
return $gserver['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -268,8 +282,8 @@ class GServer
|
||||||
$gserver = DBA::selectFirst('gserver', [], ['nurl' => Strings::normaliseLink($url)]);
|
$gserver = DBA::selectFirst('gserver', [], ['nurl' => Strings::normaliseLink($url)]);
|
||||||
if (DBA::isResult($gserver)) {
|
if (DBA::isResult($gserver)) {
|
||||||
$next_update = self::getNextUpdateDate(false, $gserver['created'], $gserver['last_contact']);
|
$next_update = self::getNextUpdateDate(false, $gserver['created'], $gserver['last_contact']);
|
||||||
DBA::update('gserver', ['failed' => true, 'last_failure' => DateTimeFormat::utcNow(),
|
DBA::update('gserver', ['url' => $url, 'failed' => true, 'last_failure' => DateTimeFormat::utcNow(),
|
||||||
'next_contact' => $next_update, 'detection-method' => null],
|
'next_contact' => $next_update, 'network' => Protocol::PHANTOM, 'detection-method' => null],
|
||||||
['nurl' => Strings::normaliseLink($url)]);
|
['nurl' => Strings::normaliseLink($url)]);
|
||||||
Logger::info('Set failed status for existing server', ['url' => $url]);
|
Logger::info('Set failed status for existing server', ['url' => $url]);
|
||||||
return;
|
return;
|
||||||
|
|
@ -299,19 +313,6 @@ class GServer
|
||||||
return Network::unparseURL($urlparts);
|
return Network::unparseURL($urlparts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the base URL
|
|
||||||
*
|
|
||||||
* @param string $url
|
|
||||||
* @return string base URL
|
|
||||||
*/
|
|
||||||
private static function getBaseURL(string $url)
|
|
||||||
{
|
|
||||||
$urlparts = parse_url(self::cleanURL($url));
|
|
||||||
unset($urlparts['path']);
|
|
||||||
return Network::unparseURL($urlparts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect server data (type, protocol, version number, ...)
|
* Detect server data (type, protocol, version number, ...)
|
||||||
* The detected data is then updated or inserted in the gserver table.
|
* The detected data is then updated or inserted in the gserver table.
|
||||||
|
|
@ -325,184 +326,167 @@ class GServer
|
||||||
public static function detect(string $url, string $network = '', bool $only_nodeinfo = false)
|
public static function detect(string $url, string $network = '', bool $only_nodeinfo = false)
|
||||||
{
|
{
|
||||||
Logger::info('Detect server type', ['server' => $url]);
|
Logger::info('Detect server type', ['server' => $url]);
|
||||||
$serverdata = ['detection-method' => self::DETECT_MANUAL];
|
|
||||||
|
|
||||||
$original_url = $url;
|
$original_url = $url;
|
||||||
|
|
||||||
// Remove URL content that is not supposed to exist for a server url
|
// Remove URL content that is not supposed to exist for a server url
|
||||||
$url = self::cleanURL($url);
|
$url = rtrim(self::cleanURL($url), '/');
|
||||||
|
if (!Network::isUrlValid($url)) {
|
||||||
// Get base URL
|
self::setFailure($url);
|
||||||
$baseurl = self::getBaseURL($url);
|
return false;
|
||||||
|
|
||||||
// If the URL missmatches, then we mark the old entry as failure
|
|
||||||
if ($url != $original_url) {
|
|
||||||
/// @todo What to do with "next_contact" here?
|
|
||||||
DBA::update('gserver', ['failed' => true, 'last_failure' => DateTimeFormat::utcNow()],
|
|
||||||
['nurl' => Strings::normaliseLink($original_url)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the URL missmatches, then we mark the old entry as failure
|
||||||
|
if (Strings::normaliseLink($url) != Strings::normaliseLink($original_url)) {
|
||||||
|
self::setFailure($original_url);
|
||||||
|
self::detect($url, $network, $only_nodeinfo);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// On a redirect follow the new host but mark the old one as failure
|
||||||
|
try {
|
||||||
|
$finalurl = rtrim(DI::httpClient()->finalUrl($url), '/');
|
||||||
|
} catch (TransferException $exception) {
|
||||||
|
Logger::notice('Error fetching final URL.', ['url' => $url, 'exception' => $exception]);
|
||||||
|
self::setFailure($url);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We only follow redirects when the path stays the same or the target url has no path.
|
||||||
|
// Some systems have got redirects on their landing page to a single account page. This check handles it.
|
||||||
|
if (((parse_url($url, PHP_URL_HOST) != parse_url($finalurl, PHP_URL_HOST)) && (parse_url($url, PHP_URL_PATH) == parse_url($finalurl, PHP_URL_PATH))) ||
|
||||||
|
(((parse_url($url, PHP_URL_HOST) != parse_url($finalurl, PHP_URL_HOST)) || (parse_url($url, PHP_URL_PATH) != parse_url($finalurl, PHP_URL_PATH))) && empty(parse_url($finalurl, PHP_URL_PATH)))) {
|
||||||
|
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $finalurl]);
|
||||||
|
self::setFailure($url);
|
||||||
|
self::detect($finalurl, $network, $only_nodeinfo);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((parse_url($url, PHP_URL_HOST) == parse_url($finalurl, PHP_URL_HOST)) &&
|
||||||
|
(parse_url($url, PHP_URL_PATH) == parse_url($finalurl, PHP_URL_PATH)) &&
|
||||||
|
(parse_url($url, PHP_URL_SCHEME) != parse_url($finalurl, PHP_URL_SCHEME))) {
|
||||||
|
if (!Network::isUrlValid($finalurl)) {
|
||||||
|
self::setFailure($finalurl);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$url = $finalurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
$in_webroot = empty(parse_url($url, PHP_URL_PATH));
|
||||||
|
|
||||||
// When a nodeinfo is present, we don't need to dig further
|
// When a nodeinfo is present, we don't need to dig further
|
||||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout');
|
$curlResult = DI::httpClient()->get($url . '/.well-known/x-nodeinfo2', HttpClientAccept::JSON);
|
||||||
$curlResult = DI::httpClient()->get($url . '/.well-known/nodeinfo', HttpClientAccept::JSON, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
|
|
||||||
if ($curlResult->isTimeout()) {
|
if ($curlResult->isTimeout()) {
|
||||||
self::setFailure($url);
|
self::setFailure($url);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On a redirect follow the new host but mark the old one as failure
|
$serverdata = self::parseNodeinfo210($curlResult);
|
||||||
if ($curlResult->isSuccess() && !empty($curlResult->getRedirectUrl()) && (parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) {
|
if (empty($serverdata)) {
|
||||||
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
|
$curlResult = DI::httpClient()->get($url . '/.well-known/nodeinfo', HttpClientAccept::JSON);
|
||||||
if (!empty($curlResult->getRedirectUrl()) && parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST)) {
|
$serverdata = self::fetchNodeinfo($url, $curlResult);
|
||||||
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]);
|
|
||||||
self::setFailure($url);
|
|
||||||
self::detect($curlResult->getRedirectUrl(), $network, $only_nodeinfo);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$nodeinfo = self::fetchNodeinfo($url, $curlResult);
|
if ($only_nodeinfo && empty($serverdata)) {
|
||||||
if ($only_nodeinfo && empty($nodeinfo)) {
|
|
||||||
Logger::info('Invalid nodeinfo in nodeinfo-mode, server is marked as failure', ['url' => $url]);
|
Logger::info('Invalid nodeinfo in nodeinfo-mode, server is marked as failure', ['url' => $url]);
|
||||||
self::setFailure($url);
|
self::setFailure($url);
|
||||||
return false;
|
return false;
|
||||||
|
} elseif (empty($serverdata)) {
|
||||||
|
$serverdata = ['detection-method' => self::DETECT_MANUAL, 'network' => Protocol::PHANTOM, 'platform' => '', 'version' => '', 'site_name' => '', 'info' => ''];
|
||||||
}
|
}
|
||||||
|
|
||||||
// When nodeinfo isn't present, we use the older 'statistics.json' endpoint
|
// When there is no Nodeinfo, then use some protocol specific endpoints
|
||||||
if (empty($nodeinfo)) {
|
if ($serverdata['network'] == Protocol::PHANTOM) {
|
||||||
$nodeinfo = self::fetchStatistics($url);
|
if ($in_webroot) {
|
||||||
}
|
// Fetch the landing page, possibly it reveals some data
|
||||||
|
$accept = 'application/activity+json,application/ld+json,application/json,*/*;q=0.9';
|
||||||
// If that didn't work out well, we use some protocol specific endpoints
|
$curlResult = DI::httpClient()->get($url, $accept);
|
||||||
// For Friendica and Zot based networks we have to dive deeper to reveal more details
|
if (!$curlResult->isSuccess() && $curlResult->getReturnCode() == '406') {
|
||||||
if (empty($nodeinfo['network']) || in_array($nodeinfo['network'], [Protocol::DFRN, Protocol::ZOT])) {
|
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML);
|
||||||
if (!empty($nodeinfo['detection-method'])) {
|
$html_fetched = true;
|
||||||
$serverdata['detection-method'] = $nodeinfo['detection-method'];
|
|
||||||
|
|
||||||
foreach (['registered-users', 'active_users_monthly', 'active-halfyear-users', 'local-posts'] as $field) {
|
|
||||||
if (!empty($nodeinfo[$field])) {
|
|
||||||
$serverdata[$field] = $nodeinfo[$field];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch the landing page, possibly it reveals some data
|
|
||||||
if (empty($nodeinfo['network'])) {
|
|
||||||
if ($baseurl == $url) {
|
|
||||||
$basedata = $serverdata;
|
|
||||||
} else {
|
} else {
|
||||||
$basedata = ['detection-method' => self::DETECT_MANUAL];
|
$html_fetched = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$curlResult = DI::httpClient()->get($baseurl, HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
|
|
||||||
if ($curlResult->isSuccess()) {
|
if ($curlResult->isSuccess()) {
|
||||||
if (!empty($curlResult->getRedirectUrl()) && (parse_url($baseurl, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) {
|
$json = json_decode($curlResult->getBody(), true);
|
||||||
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]);
|
if (!empty($json)) {
|
||||||
self::setFailure($url);
|
$data = self::fetchDataFromSystemActor($json, $serverdata);
|
||||||
self::detect($curlResult->getRedirectUrl(), $network, $only_nodeinfo);
|
$serverdata = $data['server'];
|
||||||
return false;
|
$systemactor = $data['actor'];
|
||||||
|
if (!$html_fetched && ($serverdata['detection-method'] == self::DETECT_AP_ACTOR)) {
|
||||||
|
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML);
|
||||||
|
}
|
||||||
|
} elseif (!$html_fetched && (strlen($curlResult->getBody()) < 1000)) {
|
||||||
|
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
$basedata = self::analyseRootHeader($curlResult, $basedata);
|
if ($serverdata['detection-method'] != self::DETECT_SYSTEM_ACTOR) {
|
||||||
$basedata = self::analyseRootBody($curlResult, $basedata, $baseurl);
|
$serverdata = self::analyseRootHeader($curlResult, $serverdata);
|
||||||
|
$serverdata = self::analyseRootBody($curlResult, $serverdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$curlResult->isSuccess() || empty($curlResult->getBody()) || self::invalidBody($curlResult->getBody())) {
|
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
|
||||||
self::setFailure($url);
|
self::setFailure($url);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($baseurl == $url) {
|
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
$serverdata = $basedata;
|
$serverdata = self::detectMastodonAlikes($url, $serverdata);
|
||||||
} else {
|
|
||||||
// When the base path doesn't seem to contain a social network we try the complete path.
|
|
||||||
// Most detectable system have to be installed in the root directory.
|
|
||||||
// We checked the base to avoid false positives.
|
|
||||||
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
|
|
||||||
if ($curlResult->isSuccess()) {
|
|
||||||
$urldata = self::analyseRootHeader($curlResult, $serverdata);
|
|
||||||
$urldata = self::analyseRootBody($curlResult, $urldata, $url);
|
|
||||||
|
|
||||||
$comparebase = $basedata;
|
|
||||||
unset($comparebase['info']);
|
|
||||||
unset($comparebase['site_name']);
|
|
||||||
$compareurl = $urldata;
|
|
||||||
unset($compareurl['info']);
|
|
||||||
unset($compareurl['site_name']);
|
|
||||||
|
|
||||||
// We assume that no one will install the identical system in the root and a subfolder
|
|
||||||
if (!empty(array_diff($comparebase, $compareurl))) {
|
|
||||||
$serverdata = $urldata;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($nodeinfo['network']) && (empty($serverdata['network']) || ($serverdata['network'] == Protocol::ACTIVITYPUB))) {
|
|
||||||
$serverdata = self::detectMastodonAlikes($url, $serverdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
// All following checks are done for systems that always have got a "host-meta" endpoint.
|
// All following checks are done for systems that always have got a "host-meta" endpoint.
|
||||||
// With this check we don't have to waste time and ressources for dead systems.
|
// With this check we don't have to waste time and ressources for dead systems.
|
||||||
// Also this hopefully prevents us from receiving abuse messages.
|
// Also this hopefully prevents us from receiving abuse messages.
|
||||||
$validHostMeta = self::validHostMeta($url);
|
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
|
$validHostMeta = self::validHostMeta($url);
|
||||||
if (empty($serverdata['network']) && !$validHostMeta) {
|
} else {
|
||||||
$serverdata = self::detectFromContacts($url, $serverdata);
|
$validHostMeta = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($serverdata['network']) && !$validHostMeta) {
|
if ($validHostMeta) {
|
||||||
self::setFailure($url);
|
if ($serverdata['detection-method'] == self::DETECT_MANUAL) {
|
||||||
return false;
|
$serverdata['detection-method'] = self::DETECT_HOST_META;
|
||||||
|
$serverdata['platform'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
|
$serverdata = self::detectFriendica($url, $serverdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The following systems have to be installed in the root directory.
|
||||||
|
if ($in_webroot) {
|
||||||
|
// the 'siteinfo.json' is some specific endpoint of Hubzilla and Red
|
||||||
|
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
|
$serverdata = self::fetchSiteinfo($url, $serverdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The 'siteinfo.json' doesn't seem to be present on older Hubzilla installations, so we check other endpoints as well
|
||||||
|
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
|
$serverdata = self::detectHubzilla($url, $serverdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
|
$serverdata = self::detectPeertube($url, $serverdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
|
$serverdata = self::detectGNUSocial($url, $serverdata);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($serverdata['network']) || in_array($serverdata['network'], [Protocol::DFRN, Protocol::ACTIVITYPUB])) {
|
if (($serverdata['network'] == Protocol::PHANTOM) || in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
$serverdata = self::detectFriendica($url, $serverdata);
|
$serverdata = self::detectNextcloud($url, $serverdata, $validHostMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
// the 'siteinfo.json' is some specific endpoint of Hubzilla and Red
|
// When nodeinfo isn't present, we use the older 'statistics.json' endpoint
|
||||||
if (empty($serverdata['network']) || ($serverdata['network'] == Protocol::ZOT)) {
|
// Since this endpoint is only rarely used, we query it at a later time
|
||||||
$serverdata = self::fetchSiteinfo($url, $serverdata);
|
if (in_array($serverdata['detection-method'], array_merge(self::DETECT_UNSPECIFIC, [self::DETECT_FRIENDICA, self::DETECT_CONFIG_JSON]))) {
|
||||||
|
$serverdata = self::fetchStatistics($url, $serverdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The 'siteinfo.json' doesn't seem to be present on older Hubzilla installations
|
|
||||||
if (empty($serverdata['network'])) {
|
|
||||||
$serverdata = self::detectHubzilla($url, $serverdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($serverdata['network']) || in_array($serverdata['detection-method'], [self::DETECT_MANUAL, self::DETECT_BODY])) {
|
|
||||||
$serverdata = self::detectPeertube($url, $serverdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($serverdata['network'])) {
|
|
||||||
$serverdata = self::detectNextcloud($url, $serverdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($nodeinfo['network']) && empty($serverdata['network'])) {
|
|
||||||
$serverdata = self::detectGNUSocial($url, $serverdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($serverdata['network'])) {
|
|
||||||
$serverdata = self::detectPumpIO($url, $serverdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
$serverdata = array_merge($nodeinfo, $serverdata);
|
|
||||||
} else {
|
|
||||||
$serverdata = $nodeinfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect the directory type
|
|
||||||
$serverdata['directory-type'] = self::DT_NONE;
|
|
||||||
|
|
||||||
$serverdata = self::checkMastodonDirectory($url, $serverdata);
|
|
||||||
|
|
||||||
if ($serverdata['directory-type'] == self::DT_NONE) {
|
|
||||||
$serverdata = self::checkPoCo($url, $serverdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We can't detect the network type. Possibly it is some system that we don't know yet
|
|
||||||
if (empty($serverdata['network'])) {
|
|
||||||
$serverdata['network'] = Protocol::PHANTOM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// When we hadn't been able to detect the network type, we use the hint from the parameter
|
// When we hadn't been able to detect the network type, we use the hint from the parameter
|
||||||
|
|
@ -510,13 +494,34 @@ class GServer
|
||||||
$serverdata['network'] = $network;
|
$serverdata['network'] = $network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Most servers aren't installed in a subdirectory, so we declare this entry as failed
|
||||||
|
if (($serverdata['network'] == Protocol::PHANTOM) && !empty(parse_url($url, PHP_URL_PATH)) && in_array($serverdata['detection-method'], [self::DETECT_MANUAL])) {
|
||||||
|
self::setFailure($url);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$serverdata['url'] = $url;
|
$serverdata['url'] = $url;
|
||||||
$serverdata['nurl'] = Strings::normaliseLink($url);
|
$serverdata['nurl'] = Strings::normaliseLink($url);
|
||||||
|
|
||||||
if (in_array($serverdata['network'], [Protocol::PHANTOM, Protocol::FEED])) {
|
// We have to prevent an endless loop here.
|
||||||
|
// When a server is new, then there is no gserver entry yet.
|
||||||
|
// But in "detectNetworkViaContacts" it could happen that a contact is updated,
|
||||||
|
// and this can call this function here as well.
|
||||||
|
if (in_array($serverdata['network'], [Protocol::PHANTOM, Protocol::FEED]) && self::getID($url, true)) {
|
||||||
$serverdata = self::detectNetworkViaContacts($url, $serverdata);
|
$serverdata = self::detectNetworkViaContacts($url, $serverdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Detect the directory type
|
||||||
|
$serverdata['directory-type'] = self::DT_NONE;
|
||||||
|
|
||||||
|
if (in_array($serverdata['network'], Protocol::FEDERATED)) {
|
||||||
|
$serverdata = self::checkMastodonDirectory($url, $serverdata);
|
||||||
|
|
||||||
|
if ($serverdata['directory-type'] == self::DT_NONE) {
|
||||||
|
$serverdata = self::checkPoCo($url, $serverdata);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($serverdata['network'] == Protocol::ACTIVITYPUB) {
|
if ($serverdata['network'] == Protocol::ACTIVITYPUB) {
|
||||||
$serverdata = self::fetchWeeklyUsage($url, $serverdata);
|
$serverdata = self::fetchWeeklyUsage($url, $serverdata);
|
||||||
}
|
}
|
||||||
|
|
@ -535,6 +540,9 @@ class GServer
|
||||||
$serverdata['last_contact'] = DateTimeFormat::utcNow();
|
$serverdata['last_contact'] = DateTimeFormat::utcNow();
|
||||||
$serverdata['failed'] = false;
|
$serverdata['failed'] = false;
|
||||||
|
|
||||||
|
// Limit the length on incoming fields
|
||||||
|
$serverdata = DBStructure::getFieldsForTable('gserver', $serverdata);
|
||||||
|
|
||||||
$gserver = DBA::selectFirst('gserver', ['network'], ['nurl' => Strings::normaliseLink($url)]);
|
$gserver = DBA::selectFirst('gserver', ['network'], ['nurl' => Strings::normaliseLink($url)]);
|
||||||
if (!DBA::isResult($gserver)) {
|
if (!DBA::isResult($gserver)) {
|
||||||
$serverdata['created'] = DateTimeFormat::utcNow();
|
$serverdata['created'] = DateTimeFormat::utcNow();
|
||||||
|
|
@ -575,10 +583,15 @@ class GServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($serverdata['network']) && in_array($serverdata['network'], [Protocol::DFRN, Protocol::DIASPORA])) {
|
if (in_array($serverdata['network'], [Protocol::DFRN, Protocol::DIASPORA])) {
|
||||||
self::discoverRelay($url);
|
self::discoverRelay($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($systemactor)) {
|
||||||
|
$contact = Contact::getByURL($systemactor, true, ['gsid', 'baseurl', 'id', 'network', 'url', 'name']);
|
||||||
|
Logger::debug('Fetched system actor', ['url' => $url, 'gsid' => $id, 'contact' => $contact]);
|
||||||
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -685,21 +698,30 @@ class GServer
|
||||||
*
|
*
|
||||||
* @return array server data
|
* @return array server data
|
||||||
*/
|
*/
|
||||||
private static function fetchStatistics(string $url)
|
private static function fetchStatistics(string $url, array $serverdata)
|
||||||
{
|
{
|
||||||
$curlResult = DI::httpClient()->get($url . '/statistics.json', HttpClientAccept::JSON);
|
$curlResult = DI::httpClient()->get($url . '/statistics.json', HttpClientAccept::JSON);
|
||||||
if (!$curlResult->isSuccess()) {
|
if (!$curlResult->isSuccess()) {
|
||||||
return [];
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = json_decode($curlResult->getBody(), true);
|
$data = json_decode($curlResult->getBody(), true);
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
return [];
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
$serverdata = ['detection-method' => self::DETECT_STATISTICS_JSON];
|
// Some AP enabled systems return activity data that we don't expect here.
|
||||||
|
if (strpos($curlResult->getContentType(), 'application/activity+json') !== false) {
|
||||||
|
return $serverdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
$valid = false;
|
||||||
|
$old_serverdata = $serverdata;
|
||||||
|
|
||||||
|
$serverdata['detection-method'] = self::DETECT_STATISTICS_JSON;
|
||||||
|
|
||||||
if (!empty($data['version'])) {
|
if (!empty($data['version'])) {
|
||||||
|
$valid = true;
|
||||||
$serverdata['version'] = $data['version'];
|
$serverdata['version'] = $data['version'];
|
||||||
// Version numbers on statistics.json are presented with additional info, e.g.:
|
// Version numbers on statistics.json are presented with additional info, e.g.:
|
||||||
// 0.6.3.0-p1702cc1c, 0.6.99.0-p1b9ab160 or 3.4.3-2-1191.
|
// 0.6.3.0-p1702cc1c, 0.6.99.0-p1b9ab160 or 3.4.3-2-1191.
|
||||||
|
|
@ -707,10 +729,12 @@ class GServer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['name'])) {
|
if (!empty($data['name'])) {
|
||||||
|
$valid = true;
|
||||||
$serverdata['site_name'] = $data['name'];
|
$serverdata['site_name'] = $data['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['network'])) {
|
if (!empty($data['network'])) {
|
||||||
|
$valid = true;
|
||||||
$serverdata['platform'] = strtolower($data['network']);
|
$serverdata['platform'] = strtolower($data['network']);
|
||||||
|
|
||||||
if ($serverdata['platform'] == 'diaspora') {
|
if ($serverdata['platform'] == 'diaspora') {
|
||||||
|
|
@ -725,18 +749,22 @@ class GServer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['total_users'])) {
|
if (!empty($data['total_users'])) {
|
||||||
|
$valid = true;
|
||||||
$serverdata['registered-users'] = max($data['total_users'], 1);
|
$serverdata['registered-users'] = max($data['total_users'], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['active_users_monthly'])) {
|
if (!empty($data['active_users_monthly'])) {
|
||||||
|
$valid = true;
|
||||||
$serverdata['active-month-users'] = max($data['active_users_monthly'], 0);
|
$serverdata['active-month-users'] = max($data['active_users_monthly'], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['active_users_halfyear'])) {
|
if (!empty($data['active_users_halfyear'])) {
|
||||||
|
$valid = true;
|
||||||
$serverdata['active-halfyear-users'] = max($data['active_users_halfyear'], 0);
|
$serverdata['active-halfyear-users'] = max($data['active_users_halfyear'], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['local_posts'])) {
|
if (!empty($data['local_posts'])) {
|
||||||
|
$valid = true;
|
||||||
$serverdata['local-posts'] = max($data['local_posts'], 0);
|
$serverdata['local-posts'] = max($data['local_posts'], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -746,6 +774,10 @@ class GServer
|
||||||
$serverdata['register_policy'] = Register::CLOSED;
|
$serverdata['register_policy'] = Register::CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$valid) {
|
||||||
|
return $old_serverdata;
|
||||||
|
}
|
||||||
|
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -791,13 +823,11 @@ class GServer
|
||||||
|
|
||||||
$server = [];
|
$server = [];
|
||||||
|
|
||||||
// When the nodeinfo url isn't on the same host, then there is obviously something wrong
|
if (!empty($nodeinfo2_url)) {
|
||||||
if (!empty($nodeinfo2_url) && (parse_url($url, PHP_URL_HOST) == parse_url($nodeinfo2_url, PHP_URL_HOST))) {
|
|
||||||
$server = self::parseNodeinfo2($nodeinfo2_url);
|
$server = self::parseNodeinfo2($nodeinfo2_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the nodeinfo url isn't on the same host, then there is obviously something wrong
|
if (empty($server) && !empty($nodeinfo1_url)) {
|
||||||
if (empty($server) && !empty($nodeinfo1_url) && (parse_url($url, PHP_URL_HOST) == parse_url($nodeinfo1_url, PHP_URL_HOST))) {
|
|
||||||
$server = self::parseNodeinfo1($nodeinfo1_url);
|
$server = self::parseNodeinfo1($nodeinfo1_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -893,6 +923,10 @@ class GServer
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($server['network'])) {
|
||||||
|
$server['network'] = Protocol::PHANTOM;
|
||||||
|
}
|
||||||
|
|
||||||
return $server;
|
return $server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -912,7 +946,6 @@ class GServer
|
||||||
}
|
}
|
||||||
|
|
||||||
$nodeinfo = json_decode($curlResult->getBody(), true);
|
$nodeinfo = json_decode($curlResult->getBody(), true);
|
||||||
|
|
||||||
if (!is_array($nodeinfo)) {
|
if (!is_array($nodeinfo)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
@ -924,12 +957,12 @@ class GServer
|
||||||
$server['register_policy'] = Register::OPEN;
|
$server['register_policy'] = Register::OPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($nodeinfo['software'])) {
|
if (!empty($nodeinfo['software'])) {
|
||||||
if (!empty($nodeinfo['software']['name'])) {
|
if (isset($nodeinfo['software']['name'])) {
|
||||||
$server['platform'] = strtolower($nodeinfo['software']['name']);
|
$server['platform'] = strtolower($nodeinfo['software']['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($nodeinfo['software']['version'])) {
|
if (!empty($nodeinfo['software']['version']) && isset($server['platform'])) {
|
||||||
$server['version'] = $nodeinfo['software']['version'];
|
$server['version'] = $nodeinfo['software']['version'];
|
||||||
// Version numbers on Nodeinfo are presented with additional info, e.g.:
|
// Version numbers on Nodeinfo are presented with additional info, e.g.:
|
||||||
// 0.6.3.0-p1702cc1c, 0.6.99.0-p1b9ab160 or 3.4.3-2-1191.
|
// 0.6.3.0-p1702cc1c, 0.6.99.0-p1b9ab160 or 3.4.3-2-1191.
|
||||||
|
|
@ -993,6 +1026,108 @@ class GServer
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($server['network'])) {
|
||||||
|
$server['network'] = Protocol::PHANTOM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $server;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses NodeInfo2 protocol 1.0
|
||||||
|
*
|
||||||
|
* @see https://github.com/jaywink/nodeinfo2/blob/master/PROTOCOL.md
|
||||||
|
* @param string $nodeinfo_url address of the nodeinfo path
|
||||||
|
* @return array Server data
|
||||||
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
|
*/
|
||||||
|
private static function parseNodeinfo210(ICanHandleHttpResponses $httpResult)
|
||||||
|
{
|
||||||
|
if (!$httpResult->isSuccess()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$nodeinfo = json_decode($httpResult->getBody(), true);
|
||||||
|
|
||||||
|
if (!is_array($nodeinfo)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$server = ['detection-method' => self::DETECT_NODEINFO_210,
|
||||||
|
'register_policy' => Register::CLOSED];
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['openRegistrations'])) {
|
||||||
|
$server['register_policy'] = Register::OPEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['server'])) {
|
||||||
|
if (!empty($nodeinfo['server']['software'])) {
|
||||||
|
$server['platform'] = strtolower($nodeinfo['server']['software']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['server']['version'])) {
|
||||||
|
$server['version'] = $nodeinfo['server']['version'];
|
||||||
|
// Version numbers on Nodeinfo are presented with additional info, e.g.:
|
||||||
|
// 0.6.3.0-p1702cc1c, 0.6.99.0-p1b9ab160 or 3.4.3-2-1191.
|
||||||
|
$server['version'] = preg_replace('=(.+)-(.{4,})=ism', '$1', $server['version']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['server']['name'])) {
|
||||||
|
$server['site_name'] = $nodeinfo['server']['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['usage']['users']['total'])) {
|
||||||
|
$server['registered-users'] = max($nodeinfo['usage']['users']['total'], 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['usage']['users']['activeMonth'])) {
|
||||||
|
$server['active-month-users'] = max($nodeinfo['usage']['users']['activeMonth'], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['usage']['users']['activeHalfyear'])) {
|
||||||
|
$server['active-halfyear-users'] = max($nodeinfo['usage']['users']['activeHalfyear'], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['usage']['localPosts'])) {
|
||||||
|
$server['local-posts'] = max($nodeinfo['usage']['localPosts'], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['usage']['localComments'])) {
|
||||||
|
$server['local-comments'] = max($nodeinfo['usage']['localComments'], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($nodeinfo['protocols'])) {
|
||||||
|
$protocols = [];
|
||||||
|
foreach ($nodeinfo['protocols'] as $protocol) {
|
||||||
|
if (is_string($protocol)) {
|
||||||
|
$protocols[$protocol] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($protocols['dfrn'])) {
|
||||||
|
$server['network'] = Protocol::DFRN;
|
||||||
|
} elseif (!empty($protocols['activitypub'])) {
|
||||||
|
$server['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
} elseif (!empty($protocols['diaspora'])) {
|
||||||
|
$server['network'] = Protocol::DIASPORA;
|
||||||
|
} elseif (!empty($protocols['ostatus'])) {
|
||||||
|
$server['network'] = Protocol::OSTATUS;
|
||||||
|
} elseif (!empty($protocols['gnusocial'])) {
|
||||||
|
$server['network'] = Protocol::OSTATUS;
|
||||||
|
} elseif (!empty($protocols['zot'])) {
|
||||||
|
$server['network'] = Protocol::ZOT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($server) || empty($server['platform'])) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($server['network'])) {
|
||||||
|
$server['network'] = Protocol::PHANTOM;
|
||||||
|
}
|
||||||
|
|
||||||
return $server;
|
return $server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1016,7 +1151,7 @@ class GServer
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($serverdata['detection-method'], [self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_MANUAL])) {
|
if (in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
$serverdata['detection-method'] = self::DETECT_SITEINFO_JSON;
|
$serverdata['detection-method'] = self::DETECT_SITEINFO_JSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1081,6 +1216,42 @@ class GServer
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function fetchDataFromSystemActor(array $data, array $serverdata)
|
||||||
|
{
|
||||||
|
if (empty($data)) {
|
||||||
|
return ['server' => $serverdata, 'actor' => ''];
|
||||||
|
}
|
||||||
|
|
||||||
|
$actor = JsonLD::compact($data);
|
||||||
|
if (in_array(JsonLD::fetchElement($actor, '@type'), ActivityPub\Receiver::ACCOUNT_TYPES)) {
|
||||||
|
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
$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');
|
||||||
|
$serverdata['detection-method'] = self::DETECT_SYSTEM_ACTOR;
|
||||||
|
} else {
|
||||||
|
$serverdata['detection-method'] = self::DETECT_AP_ACTOR;
|
||||||
|
}
|
||||||
|
return ['server' => $serverdata, 'actor' => $actor['@id']];
|
||||||
|
} elseif ((JsonLD::fetchElement($actor, '@type') == 'as:Collection')) {
|
||||||
|
// By now only Ktistec seems to provide collections this way
|
||||||
|
$serverdata['platform'] = 'ktistec';
|
||||||
|
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
$serverdata['detection-method'] = self::DETECT_AP_COLLECTION;
|
||||||
|
|
||||||
|
$actors = JsonLD::fetchElementArray($actor, 'as:items');
|
||||||
|
if (!empty($actors) && !empty($actors[0]['@id'])) {
|
||||||
|
$actor_url = $actor['@id'] . $actors[0]['@id'];
|
||||||
|
} else {
|
||||||
|
$actor_url = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['server' => $serverdata, 'actor' => $actor_url];
|
||||||
|
}
|
||||||
|
return ['server' => $serverdata, 'actor' => ''];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the server contains a valid host meta file
|
* Checks if the server contains a valid host meta file
|
||||||
*
|
*
|
||||||
|
|
@ -1138,13 +1309,15 @@ class GServer
|
||||||
{
|
{
|
||||||
$contacts = [];
|
$contacts = [];
|
||||||
|
|
||||||
$apcontacts = DBA::select('apcontact', ['url'], ['baseurl' => [$url, $serverdata['nurl']]]);
|
$nurl = Strings::normaliseLink($url);
|
||||||
|
|
||||||
|
$apcontacts = DBA::select('apcontact', ['url'], ['baseurl' => [$url, $nurl]]);
|
||||||
while ($apcontact = DBA::fetch($apcontacts)) {
|
while ($apcontact = DBA::fetch($apcontacts)) {
|
||||||
$contacts[Strings::normaliseLink($apcontact['url'])] = $apcontact['url'];
|
$contacts[Strings::normaliseLink($apcontact['url'])] = $apcontact['url'];
|
||||||
}
|
}
|
||||||
DBA::close($apcontacts);
|
DBA::close($apcontacts);
|
||||||
|
|
||||||
$pcontacts = DBA::select('contact', ['url', 'nurl'], ['uid' => 0, 'baseurl' => [$url, $serverdata['nurl']]]);
|
$pcontacts = DBA::select('contact', ['url', 'nurl'], ['uid' => 0, 'baseurl' => [$url, $nurl]]);
|
||||||
while ($pcontact = DBA::fetch($pcontacts)) {
|
while ($pcontact = DBA::fetch($pcontacts)) {
|
||||||
$contacts[$pcontact['nurl']] = $pcontact['url'];
|
$contacts[$pcontact['nurl']] = $pcontact['url'];
|
||||||
}
|
}
|
||||||
|
|
@ -1156,9 +1329,14 @@ class GServer
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
$probed = Contact::getByURL($contact, true);
|
// Endlosschleife verhindern wegen gsid!
|
||||||
if (!empty($probed) && !$probed['failed'] && in_array($probed['network'], Protocol::FEDERATED)) {
|
$data = Probe::uri($contact);
|
||||||
$serverdata['network'] = $probed['network'];
|
if (in_array($data['network'], Protocol::FEDERATED)) {
|
||||||
|
$serverdata['network'] = $data['network'];
|
||||||
|
|
||||||
|
if (in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
|
$serverdata['detection-method'] = self::DETECT_CONTACTS;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
} elseif ((time() - $time) > 10) {
|
} elseif ((time() - $time) > 10) {
|
||||||
// To reduce the stress on remote systems we probe a maximum of 10 seconds
|
// To reduce the stress on remote systems we probe a maximum of 10 seconds
|
||||||
|
|
@ -1269,7 +1447,7 @@ class GServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($serverdata['detection-method'], [self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_MANUAL])) {
|
if (in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
$serverdata['detection-method'] = self::DETECT_V1_CONFIG;
|
$serverdata['detection-method'] = self::DETECT_V1_CONFIG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1282,10 +1460,11 @@ class GServer
|
||||||
*
|
*
|
||||||
* @param string $url URL of the given server
|
* @param string $url URL of the given server
|
||||||
* @param array $serverdata array with server data
|
* @param array $serverdata array with server data
|
||||||
|
* @param bool $validHostMeta
|
||||||
*
|
*
|
||||||
* @return array server data
|
* @return array server data
|
||||||
*/
|
*/
|
||||||
private static function detectNextcloud(string $url, array $serverdata)
|
private static function detectNextcloud(string $url, array $serverdata, bool $validHostMeta)
|
||||||
{
|
{
|
||||||
$curlResult = DI::httpClient()->get($url . '/status.php', HttpClientAccept::JSON);
|
$curlResult = DI::httpClient()->get($url . '/status.php', HttpClientAccept::JSON);
|
||||||
if (!$curlResult->isSuccess() || ($curlResult->getBody() == '')) {
|
if (!$curlResult->isSuccess() || ($curlResult->getBody() == '')) {
|
||||||
|
|
@ -1300,9 +1479,12 @@ class GServer
|
||||||
if (!empty($data['version'])) {
|
if (!empty($data['version'])) {
|
||||||
$serverdata['platform'] = 'nextcloud';
|
$serverdata['platform'] = 'nextcloud';
|
||||||
$serverdata['version'] = $data['version'];
|
$serverdata['version'] = $data['version'];
|
||||||
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
|
||||||
|
|
||||||
if (in_array($serverdata['detection-method'], [self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_MANUAL])) {
|
if ($validHostMeta) {
|
||||||
|
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
$serverdata['detection-method'] = self::DETECT_STATUS_PHP;
|
$serverdata['detection-method'] = self::DETECT_STATUS_PHP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1341,34 +1523,6 @@ class GServer
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Detects the server network type from contacts of that server
|
|
||||||
*
|
|
||||||
* @param string $url URL of the given server
|
|
||||||
* @param array $serverdata array with server data
|
|
||||||
*
|
|
||||||
* @return array server data
|
|
||||||
*/
|
|
||||||
private static function detectFromContacts(string $url, array $serverdata)
|
|
||||||
{
|
|
||||||
$gserver = DBA::selectFirst('gserver', ['id'], ['nurl' => Strings::normaliseLink($url)]);
|
|
||||||
if (empty($gserver)) {
|
|
||||||
return $serverdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
$contact = Contact::selectFirst(['id'], ['uid' => 0, 'failed' => false, 'gsid' => $gserver['id']]);
|
|
||||||
|
|
||||||
// Via probing we can be sure that the server is responding
|
|
||||||
if (!empty($contact['id']) && Contact::updateFromProbe($contact['id'])) {
|
|
||||||
$contact = Contact::selectFirst(['network', 'failed'], ['id' => $contact['id']]);
|
|
||||||
if (!$contact['failed'] && in_array($contact['network'], Protocol::FEDERATED)) {
|
|
||||||
$serverdata['network'] = $contact['network'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $serverdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detects data from a given server url if it was a mastodon alike system
|
* Detects data from a given server url if it was a mastodon alike system
|
||||||
*
|
*
|
||||||
|
|
@ -1389,23 +1543,23 @@ class GServer
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($serverdata['detection-method'], [self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_MANUAL])) {
|
$valid = false;
|
||||||
$serverdata['detection-method'] = self::DETECT_MASTODON_API;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['version'])) {
|
if (!empty($data['version'])) {
|
||||||
$serverdata['platform'] = 'mastodon';
|
$serverdata['platform'] = 'mastodon';
|
||||||
$serverdata['version'] = $data['version'] ?? '';
|
$serverdata['version'] = $data['version'] ?? '';
|
||||||
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
$valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['title'])) {
|
if (!empty($data['title'])) {
|
||||||
$serverdata['site_name'] = $data['title'];
|
$serverdata['site_name'] = $data['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['title']) && empty($serverdata['platform']) && empty($serverdata['network'])) {
|
if (!empty($data['title']) && empty($serverdata['platform']) && ($serverdata['network'] == Protocol::PHANTOM)) {
|
||||||
$serverdata['platform'] = 'mastodon';
|
$serverdata['platform'] = 'mastodon';
|
||||||
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
$valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['description'])) {
|
if (!empty($data['description'])) {
|
||||||
|
|
@ -1419,16 +1573,23 @@ class GServer
|
||||||
if (!empty($serverdata['version']) && preg_match('/.*?\(compatible;\s(.*)\s(.*)\)/ism', $serverdata['version'], $matches)) {
|
if (!empty($serverdata['version']) && preg_match('/.*?\(compatible;\s(.*)\s(.*)\)/ism', $serverdata['version'], $matches)) {
|
||||||
$serverdata['platform'] = strtolower($matches[1]);
|
$serverdata['platform'] = strtolower($matches[1]);
|
||||||
$serverdata['version'] = $matches[2];
|
$serverdata['version'] = $matches[2];
|
||||||
|
$valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($serverdata['version']) && strstr(strtolower($serverdata['version']), 'pleroma')) {
|
if (!empty($serverdata['version']) && strstr(strtolower($serverdata['version']), 'pleroma')) {
|
||||||
$serverdata['platform'] = 'pleroma';
|
$serverdata['platform'] = 'pleroma';
|
||||||
$serverdata['version'] = trim(str_ireplace('pleroma', '', $serverdata['version']));
|
$serverdata['version'] = trim(str_ireplace('pleroma', '', $serverdata['version']));
|
||||||
|
$valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($serverdata['platform']) && strstr($serverdata['platform'], 'pleroma')) {
|
if (!empty($serverdata['platform']) && strstr($serverdata['platform'], 'pleroma')) {
|
||||||
$serverdata['version'] = trim(str_ireplace('pleroma', '', $serverdata['platform']));
|
$serverdata['version'] = trim(str_ireplace('pleroma', '', $serverdata['platform']));
|
||||||
$serverdata['platform'] = 'pleroma';
|
$serverdata['platform'] = 'pleroma';
|
||||||
|
$valid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($valid && in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
|
$serverdata['detection-method'] = self::DETECT_MASTODON_API;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
|
|
@ -1505,8 +1666,7 @@ class GServer
|
||||||
$serverdata['register_policy'] = Register::CLOSED;
|
$serverdata['register_policy'] = Register::CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($serverdata['network']) && in_array($serverdata['detection-method'],
|
if (($serverdata['network'] != Protocol::PHANTOM) && in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
[self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_MANUAL])) {
|
|
||||||
$serverdata['detection-method'] = self::DETECT_CONFIG_JSON;
|
$serverdata['detection-method'] = self::DETECT_CONFIG_JSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1531,56 +1691,6 @@ class GServer
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Detect if the URL belongs to a pump.io server
|
|
||||||
*
|
|
||||||
* @param string $url URL of the given server
|
|
||||||
* @param array $serverdata array with server data
|
|
||||||
*
|
|
||||||
* @return array server data
|
|
||||||
*/
|
|
||||||
private static function detectPumpIO(string $url, array $serverdata)
|
|
||||||
{
|
|
||||||
$curlResult = DI::httpClient()->get($url . '/.well-known/host-meta.json', HttpClientAccept::JSON);
|
|
||||||
if (!$curlResult->isSuccess()) {
|
|
||||||
return $serverdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode($curlResult->getBody(), true);
|
|
||||||
if (empty($data['links'])) {
|
|
||||||
return $serverdata;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// We are looking for some endpoints that are typical for pump.io
|
|
||||||
$trust = 0;
|
|
||||||
foreach ($data['links'] as $link) {
|
|
||||||
if (empty($link['rel'])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (in_array($link['rel'], ['registration_endpoint', 'dialback', 'http://apinamespace.org/activitypub/whoami'])) {
|
|
||||||
++$trust;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($trust == 3) {
|
|
||||||
$serverdata['detection-method'] = self::DETECT_PUMPIO;
|
|
||||||
|
|
||||||
$serverdata['platform'] = 'pumpio';
|
|
||||||
$serverdata['version'] = '';
|
|
||||||
$serverdata['network'] = Protocol::PUMPIO;
|
|
||||||
|
|
||||||
$servers = $curlResult->getHeader('Server');
|
|
||||||
foreach ($servers as $server) {
|
|
||||||
if (preg_match("#pump.io/(.*)\s#U", $server, $matches)) {
|
|
||||||
$serverdata['version'] = $matches[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $serverdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect if the URL belongs to a GNU Social server
|
* Detect if the URL belongs to a GNU Social server
|
||||||
*
|
*
|
||||||
|
|
@ -1602,7 +1712,7 @@ class GServer
|
||||||
$serverdata['version'] = trim($serverdata['version'], '"');
|
$serverdata['version'] = trim($serverdata['version'], '"');
|
||||||
$serverdata['network'] = Protocol::OSTATUS;
|
$serverdata['network'] = Protocol::OSTATUS;
|
||||||
|
|
||||||
if (in_array($serverdata['detection-method'], [self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_MANUAL])) {
|
if (in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
$serverdata['detection-method'] = self::DETECT_GNUSOCIAL;
|
$serverdata['detection-method'] = self::DETECT_GNUSOCIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1628,7 +1738,7 @@ class GServer
|
||||||
$serverdata['network'] = Protocol::OSTATUS;
|
$serverdata['network'] = Protocol::OSTATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($serverdata['detection-method'], [self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_MANUAL])) {
|
if (in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
$serverdata['detection-method'] = self::DETECT_STATUSNET;
|
$serverdata['detection-method'] = self::DETECT_STATUSNET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1667,7 +1777,7 @@ class GServer
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($serverdata['detection-method'], [self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_MANUAL])) {
|
if (in_array($serverdata['detection-method'], self::DETECT_UNSPECIFIC)) {
|
||||||
$serverdata['detection-method'] = $friendika ? self::DETECT_FRIENDIKA : self::DETECT_FRIENDICA;
|
$serverdata['detection-method'] = $friendika ? self::DETECT_FRIENDIKA : self::DETECT_FRIENDICA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1716,24 +1826,34 @@ class GServer
|
||||||
*
|
*
|
||||||
* @param object $curlResult result of curl execution
|
* @param object $curlResult result of curl execution
|
||||||
* @param array $serverdata array with server data
|
* @param array $serverdata array with server data
|
||||||
* @param string $url Server URL
|
|
||||||
*
|
*
|
||||||
* @return array server data
|
* @return array server data
|
||||||
*/
|
*/
|
||||||
private static function analyseRootBody($curlResult, array $serverdata, string $url)
|
private static function analyseRootBody($curlResult, array $serverdata)
|
||||||
{
|
{
|
||||||
if (empty($curlResult->getBody())) {
|
if (empty($curlResult->getBody())) {
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using only body information we cannot safely detect a lot of systems.
|
if (file_exists(__DIR__ . '/../../static/generator.config.php')) {
|
||||||
// So we define a list of platforms that we can detect safely.
|
require __DIR__ . '/../../static/generator.config.php';
|
||||||
$valid_platforms = ['friendica', 'friendika', 'diaspora', 'mastodon', 'hubzilla', 'misskey', 'peertube', 'wordpress', 'write.as'];
|
} else {
|
||||||
|
throw new HTTPException\InternalServerErrorException('Invalid generator file');
|
||||||
|
}
|
||||||
|
|
||||||
|
$platforms = array_merge($ap_platforms, $dfrn_platforms, $zap_platforms, $platforms);
|
||||||
|
$valid_platforms = array_values($platforms);
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadHTML($curlResult->getBody());
|
@$doc->loadHTML($curlResult->getBody());
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
|
|
||||||
|
// We can only detect honk via some HTML element on their page
|
||||||
|
if ($xpath->query('//div[@id="honksonpage"]')->count() == 1) {
|
||||||
|
$serverdata['platform'] = 'honk';
|
||||||
|
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
}
|
||||||
|
|
||||||
$title = trim(XML::getFirstNodeValue($xpath, '//head/title/text()'));
|
$title = trim(XML::getFirstNodeValue($xpath, '//head/title/text()'));
|
||||||
if (!empty($title)) {
|
if (!empty($title)) {
|
||||||
$serverdata['site_name'] = $title;
|
$serverdata['site_name'] = $title;
|
||||||
|
|
@ -1763,34 +1883,28 @@ class GServer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($attr['name'], ['application-name', 'al:android:app_name', 'al:ios:app_name',
|
if (in_array($attr['name'], ['application-name', 'al:android:app_name', 'al:ios:app_name',
|
||||||
'twitter:app:name:googleplay', 'twitter:app:name:iphone', 'twitter:app:name:ipad'])) {
|
'twitter:app:name:googleplay', 'twitter:app:name:iphone', 'twitter:app:name:ipad', 'generator'])) {
|
||||||
$serverdata['platform'] = strtolower($attr['content']);
|
$platform = str_replace(array_keys($platforms), array_values($platforms), $attr['content']);
|
||||||
if (in_array($attr['content'], ['Misskey', 'Write.as'])) {
|
$platform = strtolower(str_replace('/', ' ', $platform));
|
||||||
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
$version_part = explode(' ', $platform);
|
||||||
}
|
|
||||||
}
|
|
||||||
if (($attr['name'] == 'generator') && (empty($serverdata['platform']) || (substr(strtolower($attr['content']), 0, 9) == 'wordpress'))) {
|
|
||||||
$serverdata['platform'] = strtolower($attr['content']);
|
|
||||||
$version_part = explode(' ', $attr['content']);
|
|
||||||
|
|
||||||
if (count($version_part) == 2) {
|
if (count($version_part) >= 2) {
|
||||||
if (in_array($version_part[0], ['WordPress'])) {
|
if (in_array($version_part[0], array_values($dfrn_platforms))) {
|
||||||
$serverdata['platform'] = 'wordpress';
|
|
||||||
$serverdata['version'] = $version_part[1];
|
|
||||||
|
|
||||||
// We still do need a reliable test if some AP plugin is activated
|
|
||||||
// By now we just check in a later process for some known contacts
|
|
||||||
$serverdata['network'] = Protocol::FEED;
|
|
||||||
|
|
||||||
if ($serverdata['detection-method'] == self::DETECT_MANUAL) {
|
|
||||||
$serverdata['detection-method'] = self::DETECT_BODY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (in_array($version_part[0], ['Friendika', 'Friendica'])) {
|
|
||||||
$serverdata['platform'] = strtolower($version_part[0]);
|
|
||||||
$serverdata['version'] = $version_part[1];
|
|
||||||
$serverdata['network'] = Protocol::DFRN;
|
$serverdata['network'] = Protocol::DFRN;
|
||||||
|
} elseif (in_array($version_part[0], array_values($ap_platforms))) {
|
||||||
|
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
} elseif (in_array($version_part[0], array_values($zap_platforms))) {
|
||||||
|
$serverdata['network'] = Protocol::ZOT;
|
||||||
}
|
}
|
||||||
|
if (in_array(strtolower($version_part[0]), $valid_platforms)) {
|
||||||
|
$platform = strtolower($version_part[0]);
|
||||||
|
$serverdata['version'] = $version_part[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in_array($platform, array_values($platforms))) {
|
||||||
|
$serverdata['platform'] = $platform;
|
||||||
|
} elseif (empty($serverdata['platform'])) {
|
||||||
|
print_r($attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1822,29 +1936,22 @@ class GServer
|
||||||
$serverdata['info'] = $attr['content'];
|
$serverdata['info'] = $attr['content'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($attr['property'] == 'og:platform') {
|
if (in_array($attr['property'], ['og:platform', 'generator'])) {
|
||||||
$serverdata['platform'] = strtolower($attr['content']);
|
if (in_array($attr['content'], array_keys($platforms))) {
|
||||||
|
$serverdata['platform'] = $platforms[$attr['content']];
|
||||||
if (in_array($attr['content'], ['PeerTube'])) {
|
} else {
|
||||||
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
print_r($attr);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($attr['property'] == 'generator') {
|
if (in_array($attr['content'], array_keys($ap_platforms))) {
|
||||||
$serverdata['platform'] = strtolower($attr['content']);
|
$serverdata['network'] = Protocol::ACTIVITYPUB;
|
||||||
|
} elseif (in_array($attr['content'], array_values($zap_platforms))) {
|
||||||
if (in_array($attr['content'], ['hubzilla'])) {
|
|
||||||
// We later check which compatible protocol modules are loaded.
|
|
||||||
$serverdata['network'] = Protocol::ZOT;
|
$serverdata['network'] = Protocol::ZOT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($serverdata['platform']) && in_array($serverdata['detection-method'], [self::DETECT_MANUAL, self::DETECT_BODY]) && !in_array($serverdata['platform'], $valid_platforms)) {
|
if (in_array($serverdata['platform'], $valid_platforms) && ($serverdata['detection-method'] == self::DETECT_MANUAL)) {
|
||||||
$serverdata['network'] = Protocol::PHANTOM;
|
|
||||||
$serverdata['version'] = '';
|
|
||||||
$serverdata['detection-method'] = self::DETECT_MANUAL;
|
|
||||||
} elseif (!empty($serverdata['network']) && ($serverdata['detection-method'] == self::DETECT_MANUAL)) {
|
|
||||||
$serverdata['detection-method'] = self::DETECT_BODY;
|
$serverdata['detection-method'] = self::DETECT_BODY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1883,19 +1990,6 @@ class GServer
|
||||||
return $serverdata;
|
return $serverdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test if the body contains valid content
|
|
||||||
*
|
|
||||||
* @param string $body
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
private static function invalidBody(string $body)
|
|
||||||
{
|
|
||||||
// Currently we only test for a HTML element.
|
|
||||||
// Possibly we enhance this in the future.
|
|
||||||
return !strpos($body, '>');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update GServer entries
|
* Update GServer entries
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,14 @@ class Federation extends BaseAdmin
|
||||||
'friendica' => ['name' => 'Friendica', 'color' => '#ffc018'], // orange from the logo
|
'friendica' => ['name' => 'Friendica', 'color' => '#ffc018'], // orange from the logo
|
||||||
'birdsitelive' => ['name' => 'BirdsiteLIVE', 'color' => '#1b6ec2'], // Color from the page
|
'birdsitelive' => ['name' => 'BirdsiteLIVE', 'color' => '#1b6ec2'], // Color from the page
|
||||||
'bookwyrm' => ['name' => 'BookWyrm', 'color' => '#00d1b2'], // Color from the page
|
'bookwyrm' => ['name' => 'BookWyrm', 'color' => '#00d1b2'], // Color from the page
|
||||||
|
'castopod' => ['name' => 'Castopod', 'color' => '#00564a'], // Background color from the page
|
||||||
'diaspora' => ['name' => 'Diaspora', 'color' => '#a1a1a1'], // logo is black and white, makes a gray
|
'diaspora' => ['name' => 'Diaspora', 'color' => '#a1a1a1'], // logo is black and white, makes a gray
|
||||||
'funkwhale' => ['name' => 'Funkwhale', 'color' => '#4082B4'], // From the homepage
|
'funkwhale' => ['name' => 'Funkwhale', 'color' => '#4082B4'], // From the homepage
|
||||||
'gnusocial' => ['name' => 'GNU Social/Statusnet', 'color' => '#a22430'], // dark red from the logo
|
'gnusocial' => ['name' => 'GNU Social/Statusnet', 'color' => '#a22430'], // dark red from the logo
|
||||||
'gotosocial' => ['name' => 'GoToSocial', 'color' => '#df8958'], // Some color from their mascot
|
'gotosocial' => ['name' => 'GoToSocial', 'color' => '#df8958'], // Some color from their mascot
|
||||||
'hometown' => ['name' => 'Hometown', 'color' => '#1f70c1'], // Color from the Patreon page
|
'hometown' => ['name' => 'Hometown', 'color' => '#1f70c1'], // Color from the Patreon page
|
||||||
'hubzilla' => ['name' => 'Hubzilla/Red Matrix', 'color' => '#43488a'], // blue from the logo
|
'hubzilla' => ['name' => 'Hubzilla/Red Matrix', 'color' => '#43488a'], // blue from the logo
|
||||||
|
'hugo' => ['name' => 'Hugo', 'color' => '#0a1922'], // Color from the homepage background
|
||||||
'lemmy' => ['name' => 'Lemmy', 'color' => '#00c853'], // Green from the page
|
'lemmy' => ['name' => 'Lemmy', 'color' => '#00c853'], // Green from the page
|
||||||
'mastodon' => ['name' => 'Mastodon', 'color' => '#1a9df9'], // blue from the Mastodon logo
|
'mastodon' => ['name' => 'Mastodon', 'color' => '#1a9df9'], // blue from the Mastodon logo
|
||||||
'misskey' => ['name' => 'Misskey', 'color' => '#ccfefd'], // Font color of the homepage
|
'misskey' => ['name' => 'Misskey', 'color' => '#ccfefd'], // Font color of the homepage
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ namespace Friendica\Module\Api\Mastodon\Instance;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\Model\GServer;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
|
@ -41,7 +42,9 @@ class Peers extends BaseApi
|
||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
// We only select for Friendica and ActivityPub servers, since it is expected to only deliver AP compatible systems here.
|
// We only select for Friendica and ActivityPub servers, since it is expected to only deliver AP compatible systems here.
|
||||||
$instances = DBA::select('gserver', ['url'], ["`network` in (?, ?) AND NOT `failed`", Protocol::DFRN, Protocol::ACTIVITYPUB]);
|
$instances = DBA::select('gserver', ['url'], ["`network` in (?, ?) AND NOT `failed` AND NOT `detection-method` IN (?, ?, ?, ?)",
|
||||||
|
Protocol::DFRN, Protocol::ACTIVITYPUB,
|
||||||
|
GServer::DETECT_MANUAL, GServer::DETECT_HEADER, GServer::DETECT_BODY, GServer::DETECT_HOST_META]);
|
||||||
while ($instance = DBA::fetch($instances)) {
|
while ($instance = DBA::fetch($instances)) {
|
||||||
$urldata = parse_url($instance['url']);
|
$urldata = parse_url($instance['url']);
|
||||||
unset($urldata['scheme']);
|
unset($urldata['scheme']);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ use Friendica\Core\Hook;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||||
use Friendica\Network\HTTPException\NotModifiedException;
|
use Friendica\Network\HTTPException\NotModifiedException;
|
||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
|
|
||||||
|
|
@ -66,14 +67,58 @@ class Network
|
||||||
$url = 'http://' . $url;
|
$url = 'http://' . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @TODO Really suppress function outcomes? Why not find them + debug them?
|
$xrd_timeout = DI::config()->get('system', 'xrd_timeout');
|
||||||
$h = @parse_url($url);
|
$host = parse_url($url, PHP_URL_HOST);
|
||||||
|
|
||||||
if (!empty($h['host']) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME) || filter_var($h['host'], FILTER_VALIDATE_IP))) {
|
if (empty($host) || !(@dns_get_record($host . '.', DNS_A + DNS_AAAA + DNS_CNAME) || filter_var($host, FILTER_VALIDATE_IP))) {
|
||||||
return $url;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
// Check if the certificate is valid for this hostname
|
||||||
|
if (parse_url($url, PHP_URL_SCHEME) == 'https') {
|
||||||
|
$port = parse_url($url, PHP_URL_PORT) ?? 443;
|
||||||
|
|
||||||
|
$context = stream_context_create(["ssl" => ['capture_peer_cert' => true]]);
|
||||||
|
|
||||||
|
$resource = @stream_socket_client('ssl://' . $host . ':' . $port, $errno, $errstr, $xrd_timeout, STREAM_CLIENT_CONNECT, $context);
|
||||||
|
if (empty($resource)) {
|
||||||
|
Logger::notice('Invalid certificate', ['host' => $host]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cert = stream_context_get_params($resource);
|
||||||
|
if (empty($cert)) {
|
||||||
|
Logger::notice('Invalid certificate params', ['host' => $host]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$certinfo = openssl_x509_parse($cert['options']['ssl']['peer_certificate']);
|
||||||
|
if (empty($certinfo)) {
|
||||||
|
Logger::notice('Invalid certificate information', ['host' => $host]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$valid_from = date(DATE_RFC2822,$certinfo['validFrom_time_t']);
|
||||||
|
$valid_to = date(DATE_RFC2822,$certinfo['validTo_time_t']);
|
||||||
|
|
||||||
|
if ($certinfo['validFrom_time_t'] > time()) {
|
||||||
|
Logger::notice('Certificate validity starts after current date', ['host' => $host, 'from' => $valid_from, 'to' => $valid_to]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($certinfo['validTo_time_t'] < time()) {
|
||||||
|
Logger::notice('Certificate validity ends before current date', ['host' => $host, 'from' => $valid_from, 'to' => $valid_to]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in_array(parse_url($url, PHP_URL_SCHEME), ['https', 'http'])) {
|
||||||
|
if (!ParseUrl::getContentType($url, HttpClientAccept::DEFAULT, $xrd_timeout)) {
|
||||||
|
Logger::notice('Url not reachable', ['host' => $host, 'url' => $url]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -95,7 +140,7 @@ class Network
|
||||||
$h = substr($addr, strpos($addr, '@') + 1);
|
$h = substr($addr, strpos($addr, '@') + 1);
|
||||||
|
|
||||||
// Concerning the @ see here: https://stackoverflow.com/questions/36280957/dns-get-record-a-temporary-server-error-occurred
|
// Concerning the @ see here: https://stackoverflow.com/questions/36280957/dns-get-record-a-temporary-server-error-occurred
|
||||||
if ($h && (@dns_get_record($h, DNS_A + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP))) {
|
if ($h && (@dns_get_record($h, DNS_A + DNS_AAAA + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($h && @dns_get_record($h, DNS_CNAME + DNS_MX)) {
|
if ($h && @dns_get_record($h, DNS_CNAME + DNS_MX)) {
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,22 @@ class ParseUrl
|
||||||
* Fetch the content type of the given url
|
* Fetch the content type of the given url
|
||||||
* @param string $url URL of the page
|
* @param string $url URL of the page
|
||||||
* @param string $accept content-type to accept
|
* @param string $accept content-type to accept
|
||||||
|
* @param int $timeout
|
||||||
* @return array content type
|
* @return array content type
|
||||||
*/
|
*/
|
||||||
public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT)
|
public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT, int $timeout = 0)
|
||||||
{
|
{
|
||||||
$curlResult = DI::httpClient()->head($url, [HttpClientOptions::ACCEPT_CONTENT => $accept]);
|
if (!empty($timeout)) {
|
||||||
|
$options = [HttpClientOptions::TIMEOUT => $timeout];
|
||||||
|
} else {
|
||||||
|
$options = [];
|
||||||
|
}
|
||||||
|
|
||||||
// Workaround for systems that can't handle a HEAD request
|
$curlResult = DI::httpClient()->head($url, array_merge([HttpClientOptions::ACCEPT_CONTENT => $accept], $options));
|
||||||
if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() == 405)) {
|
|
||||||
$curlResult = DI::httpClient()->get($url, $accept, [HttpClientOptions::CONTENT_LENGTH => 1000000]);
|
// Workaround for systems that can't handle a HEAD request. Don't retry on timeouts.
|
||||||
|
if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() >= 400) && !in_array($curlResult->getReturnCode(), [408, 504])) {
|
||||||
|
$curlResult = DI::httpClient()->get($url, $accept, array_merge([HttpClientOptions::CONTENT_LENGTH => 1000000], $options));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$curlResult->isSuccess()) {
|
if (!$curlResult->isSuccess()) {
|
||||||
|
|
|
||||||
143
static/generator.config.php
Normal file
143
static/generator.config.php
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$platforms = [
|
||||||
|
'AlphaChat' => 'alphachat',
|
||||||
|
'AV Arcade' => 'av-arcade',
|
||||||
|
'BaseKit' => 'basekit',
|
||||||
|
'BBEdit' => 'bbedit',
|
||||||
|
'Big Cartel' => 'big-cartel',
|
||||||
|
'blogger' => 'blogger',
|
||||||
|
'Bloom' => 'bloom',
|
||||||
|
'Bludit' => 'bludit',
|
||||||
|
'BunnyPress' => 'bunnypress',
|
||||||
|
'Contao Open Source CMS' => 'contao',
|
||||||
|
'castopod' => 'castopod',
|
||||||
|
'cgit' => 'cgit',
|
||||||
|
'Chevereto' => 'chevereto',
|
||||||
|
'ClanSphere' => 'clansphere',
|
||||||
|
'Claudia Content' => 'claudia-content',
|
||||||
|
'diaspora' => 'diaspora',
|
||||||
|
'DIMV' => 'dimv',
|
||||||
|
'Discourse' => 'discourse',
|
||||||
|
'Divi' => 'divi',
|
||||||
|
'Django-cypress' => 'django-cypress',
|
||||||
|
'Docutils' => 'docutils',
|
||||||
|
'DokuWiki' => 'dokuwiki',
|
||||||
|
'Drupal' => 'drupal',
|
||||||
|
'Element' => 'element',
|
||||||
|
'Eleventy' => 'eleventy',
|
||||||
|
'filerun' => 'filerun',
|
||||||
|
'FlatPress' => 'flatpress',
|
||||||
|
'Gatsby' => 'gatsby',
|
||||||
|
'gitweb' => 'gitweb',
|
||||||
|
'gnusocial' => 'gnusocial',
|
||||||
|
'GravCMS' => 'gravcms',
|
||||||
|
'grocy' => 'grocy',
|
||||||
|
'Gruta' => 'gruta',
|
||||||
|
'hakyll' => 'hakyll',
|
||||||
|
'HedgeDoc - Collaborative markdown notes' => 'hedgedoc',
|
||||||
|
'helloworld' => 'helloworld',
|
||||||
|
'Hexo' => 'hexo',
|
||||||
|
'honk' => 'honk',
|
||||||
|
'ian' => 'ian',
|
||||||
|
'InterRed' => 'interred',
|
||||||
|
'Ikiwiki' => 'ikiwiki',
|
||||||
|
'Joomla!' => 'joomla',
|
||||||
|
'KeyHelp' => 'keyhelp',
|
||||||
|
'KONTEXT-CMS (c) WARENFORM [www.warenform.net]' => 'kontext-cms',
|
||||||
|
'ktistec' => 'ktistec',
|
||||||
|
'LibreOffice' => 'libreoffice',
|
||||||
|
'Magazine News Byte' => 'magazine-news-byte',
|
||||||
|
'mastodon' => 'mastodon',
|
||||||
|
'Mattermost' => 'mattermost',
|
||||||
|
'MediaWiki' => 'mediawiki',
|
||||||
|
'Medium' => 'medium',
|
||||||
|
'microblog' => 'microblog',
|
||||||
|
'Misskey' => 'misskey',
|
||||||
|
'Mobirise' => 'mobirise',
|
||||||
|
'Movable Type Pro' => 'movable-type',
|
||||||
|
'Movim' => 'movim',
|
||||||
|
'MyArcadePlugin Pro' => 'my-arcade-plugin',
|
||||||
|
'Nanoc' => 'nanoc',
|
||||||
|
'nb3 system v1.6' => 'nb3',
|
||||||
|
'Nikola (getnikola.com)' => 'nikola',
|
||||||
|
'Odoo' => 'odoo',
|
||||||
|
'Org mode' => 'org-mode',
|
||||||
|
'Org-mode' => 'org-mode',
|
||||||
|
'Org Mode' => 'org-mode',
|
||||||
|
'orig4' => 'orig4',
|
||||||
|
'Osclass' => 'osclass',
|
||||||
|
'pamphlets/vinyl-press' => 'pamphlets',
|
||||||
|
'peertube' => 'peertube',
|
||||||
|
'phpMyFAQ' => 'phpmyfaq',
|
||||||
|
'Pelican' => 'pelican',
|
||||||
|
'pH7CMS,' => 'ph7cms',
|
||||||
|
'Polr' => 'polr',
|
||||||
|
'Publii Open-Source CMS for Static Site' => 'publii',
|
||||||
|
'pygruta' => 'pygruta',
|
||||||
|
'Riot' => 'riot',
|
||||||
|
'Satelito' => 'satelito',
|
||||||
|
'Scully' => 'scully',
|
||||||
|
'Sedo' => 'sedo',
|
||||||
|
'sitebaker' => 'sitebaker',
|
||||||
|
'SitePad' => 'sitepad',
|
||||||
|
'SPIP' => 'spip',
|
||||||
|
'STUDIO' => 'studio',
|
||||||
|
'Synology - Synology DiskStation' => 'synology',
|
||||||
|
'Thufie' => 'thufie',
|
||||||
|
'TiddlyWiki' => 'tiddlywiki',
|
||||||
|
'Typesetter CMS' => 'typesetter',
|
||||||
|
'TYPO3 CMS' => 'typo3',
|
||||||
|
'Tumblr' => 'tumblr',
|
||||||
|
'Typecho' => 'typecho',
|
||||||
|
'http://txt2tags.org' => 'txt2tags',
|
||||||
|
'UISP' => 'uisp',
|
||||||
|
'VuePress' => 'vuepress',
|
||||||
|
'webEdition CMS' => 'webedition',
|
||||||
|
'Webflow' => 'webflow',
|
||||||
|
'WikkaWiki' => 'wikkawiki',
|
||||||
|
'Wix.com' => 'wix.com',
|
||||||
|
'WordPress' => 'wordpress',
|
||||||
|
'WordPress.com' => 'wordpress',
|
||||||
|
'Write.as' => 'write.as',
|
||||||
|
'XAG/CMS' => 'xagcms',
|
||||||
|
'Zim' => 'zim',
|
||||||
|
];
|
||||||
|
|
||||||
|
$ap_platforms = [
|
||||||
|
'PeerTube' => 'peertube',
|
||||||
|
'Hugo' => 'hugo',
|
||||||
|
'lemoncurry' => 'lemoncurry',
|
||||||
|
'Ghost' => 'ghost',
|
||||||
|
'Jekyll' => 'jekyll',
|
||||||
|
'Known https://withknown.com' => 'known',
|
||||||
|
];
|
||||||
|
|
||||||
|
$dfrn_platforms = [
|
||||||
|
'Friendika' => 'friendika',
|
||||||
|
'Friendica' => 'friendica',
|
||||||
|
];
|
||||||
|
|
||||||
|
$zap_platforms = [
|
||||||
|
'hubzilla' => 'hubzilla',
|
||||||
|
'osada' => 'osada',
|
||||||
|
];
|
||||||
Loading…
Add table
Add a link
Reference in a new issue