From 1fef1ef6e96a34b3ada68f61da16a996fc8b9b5a Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 24 Mar 2020 23:12:53 +0000 Subject: [PATCH] Issue 7771: Funkwhale support --- src/Content/Text/BBCode.php | 2 +- src/Model/APContact.php | 4 ++++ src/Protocol/ActivityPub/Receiver.php | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 9cf7df4e3..7a316c251 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1631,7 +1631,7 @@ class BBCode // Try to Oembed if ($try_oembed) { $text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4).*?)\[\/video\]/ism", '', $text); - $text = preg_replace("/\[audio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3).*?)\[\/audio\]/ism", '', $text); + $text = preg_replace("/\[audio\](.*?)\[\/audio\]/ism", '', $text); $text = preg_replace_callback("/\[video\](.*?)\[\/video\]/ism", $try_oembed_callback, $text); $text = preg_replace_callback("/\[audio\](.*?)\[\/audio\]/ism", $try_oembed_callback, $text); diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 7ce47bb22..071d93516 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -26,6 +26,7 @@ use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Protocol\ActivityPub; +use Friendica\Util\Crypto; use Friendica\Util\Network; use Friendica\Util\JsonLD; use Friendica\Util\DateTimeFormat; @@ -209,6 +210,9 @@ class APContact $apcontact['pubkey'] = null; if (!empty($compacted['w3id:publicKey'])) { $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value')); + if (strstr($apcontact['pubkey'], 'RSA ')) { + $apcontact['pubkey'] = Crypto::rsaToPem($apcontact['pubkey']); + } } $apcontact['manually-approve'] = (int)JsonLD::fetchElement($compacted, 'as:manuallyApprovesFollowers'); diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 30728ff11..508e5acd5 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -841,6 +841,10 @@ class Receiver continue; } + if (empty($element['href'])) { + $element['href'] = $element['name']; + } + $taglist[] = $element; } return $taglist;