Merge pull request #13756 from annando/limited-servers

Fix for profile limitation / configurable list of limited servers
This commit is contained in:
Hypolite Petovan 2023-12-22 12:25:57 -05:00 committed by GitHub
commit 2d73a4bc58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View file

@ -24,6 +24,7 @@ namespace Friendica\Protocol;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\APContact; use Friendica\Model\APContact;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\User; use Friendica\Model\User;
@ -305,6 +306,15 @@ class ActivityPub
return false; return false;
} }
$limited = DI::config()->get('system', 'limited_servers');
if (!empty($limited)) {
$servers = explode(',', str_replace(' ', '', $limited));
$host = parse_url($contact['baseurl'], PHP_URL_HOST);
if (!empty($host) && in_array($host, $servers)) {
return false;
}
}
// @todo Look for user blocked domains // @todo Look for user blocked domains
Logger::debug('Server is an accepted requester', ['uid' => $uid, 'id' => $apcontact['gsid'], 'url' => $apcontact['baseurl'], 'signer' => $signer, 'called_by' => $called_by]); Logger::debug('Server is an accepted requester', ['uid' => $uid, 'id' => $apcontact['gsid'], 'url' => $apcontact['baseurl'], 'signer' => $signer, 'called_by' => $called_by]);

View file

@ -373,9 +373,9 @@ class Transmitter
} }
$data['preferredUsername'] = $owner['nick']; $data['preferredUsername'] = $owner['nick'];
$data['name'] = $owner['name']; $data['name'] = $full ? $owner['name'] : $owner['nick'];
if (!$full && !empty($owner['country-name'] . $owner['region'] . $owner['locality'])) { if ($full && !empty($owner['country-name'] . $owner['region'] . $owner['locality'])) {
$data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'], $data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'],
'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']]; 'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']];
} }

View file

@ -325,6 +325,10 @@ return [
// Don't update the "commented" value of an item when it is liked. // Don't update the "commented" value of an item when it is liked.
'like_no_comment' => false, 'like_no_comment' => false,
// limited_servers (String)
// A comma separated list of server hostnames that should get limited profile data
'limited_servers' => '',
// local_tags (Boolean) // local_tags (Boolean)
// If activated, all hashtags will point to the local server. // If activated, all hashtags will point to the local server.
'local_tags' => true, 'local_tags' => true,