Merge branch 'friendica:2022.12-rc' into new_image_presentation

This commit is contained in:
MarekBenjamin 2022-12-07 18:52:20 +01:00 committed by GitHub
commit 74ff7bae59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 28 deletions

View File

@ -1 +1 @@
2022.12-dev
2022.12-rc

View File

@ -1,5 +1,5 @@
-- ------------------------------------------
-- Friendica 2022.12-dev (Giant Rhubarb)
-- Friendica 2022.12-rc (Giant Rhubarb)
-- DB_UPDATE_VERSION 1500
-- ------------------------------------------

View File

@ -178,8 +178,7 @@ The available features are client specific and may differ.
#### Android
* [AndStatus](http://andstatus.org) ([F-Droid](https://f-droid.org/repository/browse/?fdid=org.andstatus.app), [Google Play](https://play.google.com/store/apps/details?id=org.andstatus.app))
* [B4X for Pleroma & Mastodon](https://github.com/AnywhereSoftware/B4X-Pleroma)
* [Fedi](https://github.com/Big-Fig/Fediverse.app) ([Google Play](https://play.google.com/store/apps/details?id=com.fediverse.app)
* [Fedi](https://github.com/Big-Fig/Fediverse.app) ([Google Play](https://play.google.com/store/apps/details?id=com.fediverse.app))
* [Fedilab](https://fedilab.app) ([F-Droid](https://f-droid.org/app/fr.gouv.etalab.mastodon), [Google Play](https://play.google.com/store/apps/details?id=app.fedilab.android))
* [Friendiqa](https://git.friendi.ca/lubuwest/Friendiqa) ([F-Droid](https://git.friendi.ca/lubuwest/Friendiqa#install), [Google Play](https://play.google.com/store/apps/details?id=org.qtproject.friendiqa))
* [Husky](https://git.sr.ht/~captainepoch/husky) ([F-Droid](https://f-droid.org/repository/browse/?fdid=su.xash.husky), [Google Play](https://play.google.com/store/apps/details?id=su.xash.husky))
@ -187,18 +186,16 @@ The available features are client specific and may differ.
* [Subway Tooter](https://github.com/tateisu/SubwayTooter) ([F-Droid](https://android.izzysoft.de/repo/apk/jp.juggler.subwaytooter))
* [Tooot](https://tooot.app/) ([Google Play](https://play.google.com/store/apps/details?id=com.xmflsct.app.tooot))
* [Tusky](https://tusky.app) ([F-Droid](https://f-droid.org/repository/browse/?fdid=com.keylesspalace.tusky), [Google Play](https://play.google.com/store/apps/details?id=com.keylesspalace.tusky))
* [Twidere](https://github.com/TwidereProject/Twidere-Android) ([F-Droid](https://f-droid.org/repository/browse/?fdid=org.mariotaku.twidere), [Google Play](https://play.google.com/store/apps/details?id=com.twidere.twiderex))
* [TwidereX](https://github.com/TwidereProject/TwidereX-Android) ([F-Droid](https://f-droid.org/en/packages/com.twidere.twiderex/), [Google Play](https://play.google.com/store/apps/details?id=com.twidere.twiderex))
* [Yuito](https://github.com/accelforce/Yuito) ([Google Play](https://play.google.com/store/apps/details?id=net.accelf.yuito))
#### iOS
* [B4X for Pleroma & Mastodon](https://github.com/AnywhereSoftware/B4X-Pleroma) ([AppStore](https://apps.apple.com/app/b4x-pleroma/id1538396871))
* [Fedi](https://github.com/Big-Fig/Fediverse.app) ([AppStore](https://apps.apple.com/de/app/fedi-for-pleroma-and-mastodon/id1478806281))
* [Mastodon for iPhone and iPad](https://joinmastodon.org/apps) ([AppStore](https://apps.apple.com/us/app/mastodon-for-iphone/id1571998974))
* [Mastodon](https://joinmastodon.org/apps) ([AppStore](https://apps.apple.com/us/app/mastodon-for-iphone/id1571998974))
* [Stella*](https://www.stella-app.net/) ([AppStore](https://apps.apple.com/us/app/stella-for-mastodon-twitter/id921372048))
* [Tooot](https://github.com/tooot-app) ([AppStore](https://apps.apple.com/app/id1549772269), Data collection (not linked to identity)
* [Tootle](https://mastodon.cloud/@tootleapp) ([AppStore](https://apps.apple.com/de/app/tootle-for-mastodon/id1236013466)), last update: 2020
* [Tooot](https://github.com/tooot-app) ([AppStore](https://apps.apple.com/app/id1549772269)
* [TwidereX](https://github.com/TwidereProject/TwidereX-iOS) ([AppStore](https://apps.apple.com/app/twidere-x/id1530314034))
#### Linux
@ -206,7 +203,6 @@ The available features are client specific and may differ.
* [Whalebird](https://whalebird.social/en/desktop/contents) ([GitHub](https://github.com/h3poteto/whalebird-desktop))
* [TheDesk](https://thedesk.top/en/) ([GitHub](https://github.com/cutls/TheDesk))
* [Toot](https://toot.readthedocs.io/en/latest/)
* [Tootle](https://github.com/bleakgrey/tootle)
#### macOS

View File

@ -62,7 +62,7 @@ class App
{
const PLATFORM = 'Friendica';
const CODENAME = 'Giant Rhubarb';
const VERSION = '2022.12-dev';
const VERSION = '2022.12-rc';
// Allow themes to control internal parameters
// by changing App values in theme.php

View File

@ -158,6 +158,7 @@ class User
$system['publish'] = false;
$system['net-publish'] = false;
$system['hide-friends'] = true;
$system['hidewall'] = true;
$system['prv_keywords'] = '';
$system['pub_keywords'] = '';
$system['address'] = '';

View File

@ -29,7 +29,7 @@ use Friendica\Module\BaseApi;
use Friendica\Util\Network;
/**
* @see https://docs.joinmastodon.org/methods/accounts/
* @see https://docs.joinmastodon.org/methods/accounts/#search
*/
class Search extends BaseApi
{
@ -44,13 +44,14 @@ class Search extends BaseApi
$request = $this->getRequest([
'q' => '', // What to search for
'limit' => 40, // Maximum number of results. Defaults to 40.
'offset' => 0, // Offset in search results. Used for pagination. Defaults to 0.
'resolve' => false, // Attempt WebFinger lookup. Defaults to false. Use this when q is an exact address.
'following' => false, // Only who the user is following. Defaults to false.
], $request);
$accounts = [];
if ((strrpos($request['q'], '@') > 0) || Network::isValidHttpUrl($request['q'])) {
if (($request['offset'] == 0) && (Network::isValidHttpUrl($request['q']) || (strrpos($request['q'], '@') > 0))) {
$id = Contact::getIdForURL($request['q'], 0, $request['resolve'] ? null : false);
if (!empty($id)) {
@ -59,7 +60,7 @@ class Search extends BaseApi
}
if (empty($accounts)) {
$contacts = Contact::searchByName($request['q'], '', $request['following'] ? $uid : 0, $request['limit']);
$contacts = Contact::searchByName($request['q'], '', $request['following'] ? $uid : 0, $request['limit'], $request['offset']);
foreach ($contacts as $contact) {
$accounts[] = DI::mstdnAccount()->createFromContactId($contact['id'], $uid);
}

View File

@ -108,7 +108,7 @@ class Search extends BaseApi
private static function searchAccounts(int $uid, string $q, bool $resolve, int $limit, int $offset, bool $following)
{
if (
(strrpos($q, '@') > 0 || Network::isValidHttpUrl($q))
($offset == 0) && (strrpos($q, '@') > 0 || Network::isValidHttpUrl($q))
&& $id = Contact::getIdForURL($q, 0, $resolve ? null : false)
) {
return DI::mstdnAccount()->createFromContactId($id, $uid);

View File

@ -957,7 +957,7 @@ class Processor
}
$tags = array_column(Tag::getByURIId($item['uri-id'], [Tag::HASHTAG]), 'name');
if (Relay::isSolicitedPost($tags, $item['body'], $item['author-id'], $item['uri'], Protocol::ACTIVITYPUB)) {
if (Relay::isSolicitedPost($tags, $item['body'], $item['author-id'], $item['uri'], Protocol::ACTIVITYPUB, $activity['thread-completion'] ?? 0)) {
Logger::debug('Post is accepted because of the relay settings', ['uri-id' => $item['uri-id'], 'guid' => $item['guid'], 'url' => $item['uri']]);
return true;
} else {
@ -1185,7 +1185,7 @@ class Processor
if (!empty($item['parent-uri-id'])) {
if (Post::exists(['uri-id' => $item['parent-uri-id'], 'uid' => $receiver])) {
$has_parents = true;
} elseif ($add_parent && Post::exists(['uri-id' => $item['parent-uri'], 'uid' => 0])) {
} elseif ($add_parent && Post::exists(['uri-id' => $item['parent-uri-id'], 'uid' => 0])) {
$stored = Item::storeForUserByUriId($item['parent-uri-id'], $receiver, $fields);
$has_parents = (bool)$stored;
if ($stored) {
@ -1598,7 +1598,7 @@ class Processor
}
}
return Relay::isSolicitedPost($messageTags, $body, $authorid, $id, Protocol::ACTIVITYPUB);
return Relay::isSolicitedPost($messageTags, $body, $authorid, $id, Protocol::ACTIVITYPUB, $activity['thread-completion'] ?? 0);
}
/**

View File

@ -56,7 +56,7 @@ class Relay
* @param string $url
* @return boolean "true" is the post is wanted by the system
*/
public static function isSolicitedPost(array $tags, string $body, int $authorid, string $url, string $network = ''): bool
public static function isSolicitedPost(array $tags, string $body, int $authorid, string $url, string $network = '', int $causerid = 0): bool
{
$config = DI::config();
@ -77,6 +77,13 @@ class Relay
return false;
}
if (!empty($causerid)) {
$contact = Contact::getById($causerid, ['url']);
$causer = $contact['url'] ?? '';
} else {
$causer = '';
}
$body = ActivityPub\Processor::normalizeMentionLinks($body);
$systemTags = [];
@ -110,19 +117,19 @@ class Relay
foreach ($tags as $tag) {
$tag = mb_strtolower($tag);
if (in_array($tag, $denyTags)) {
Logger::info('Unwanted hashtag found - rejected', ['hashtag' => $tag, 'network' => $network, 'url' => $url]);
Logger::info('Unwanted hashtag found - rejected', ['hashtag' => $tag, 'network' => $network, 'url' => $url, 'causer' => $causer]);
return false;
}
if (in_array($tag, $tagList)) {
Logger::info('Subscribed hashtag found - accepted', ['hashtag' => $tag, 'network' => $network, 'url' => $url]);
Logger::info('Subscribed hashtag found - accepted', ['hashtag' => $tag, 'network' => $network, 'url' => $url, 'causer' => $causer]);
return true;
}
// We check with "strpos" for performance issues. Only when this is true, the regular expression check is used
// RegExp is taken from here: https://medium.com/@shiba1014/regex-word-boundaries-with-unicode-207794f6e7ed
if ((strpos($content, $tag) !== false) && preg_match('/(?<=[\s,.:;"\']|^)' . preg_quote($tag, '/') . '(?=[\s,.:;"\']|$)/', $content)) {
Logger::info('Subscribed hashtag found in content - accepted', ['hashtag' => $tag, 'network' => $network, 'url' => $url]);
Logger::info('Subscribed hashtag found in content - accepted', ['hashtag' => $tag, 'network' => $network, 'url' => $url, 'causer' => $causer]);
return true;
}
}
@ -135,24 +142,24 @@ class Relay
}
}
Logger::debug('Got languages', ['languages' => $languages, 'body' => $body]);
Logger::debug('Got languages', ['languages' => $languages, 'body' => $body, 'causer' => $causer]);
if (!empty($languages)) {
if (in_array($languages[0], $config->get('system', 'relay_deny_languages'))) {
Logger::info('Unwanted language found - rejected', ['language' => $languages[0], 'network' => $network, 'url' => $url]);
Logger::info('Unwanted language found - rejected', ['language' => $languages[0], 'network' => $network, 'url' => $url, 'causer' => $causer]);
return false;
}
} elseif ($config->get('system', 'relay_deny_undetected_language')) {
Logger::info('Undetected language found - rejected', ['body' => $body, 'network' => $network, 'url' => $url]);
Logger::info('Undetected language found - rejected', ['body' => $body, 'network' => $network, 'url' => $url, 'causer' => $causer]);
return false;
}
if ($scope == self::SCOPE_ALL) {
Logger::info('Server accept all posts - accepted', ['network' => $network, 'url' => $url]);
Logger::info('Server accept all posts - accepted', ['network' => $network, 'url' => $url, 'causer' => $causer]);
return true;
}
Logger::info('No matching hashtags found - rejected', ['network' => $network, 'url' => $url]);
Logger::info('No matching hashtags found - rejected', ['network' => $network, 'url' => $url, 'causer' => $causer]);
return false;
}

View File

@ -6,7 +6,7 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 2022.12-dev\n"
"Project-Id-Version: 2022.12-rc\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-04 06:41-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"