diff --git a/Code/ActivityStreams/ASObject.php b/Code/ActivityStreams/ASObject.php index e56087242..677bdcf2d 100644 --- a/Code/ActivityStreams/ASObject.php +++ b/Code/ActivityStreams/ASObject.php @@ -5,6 +5,7 @@ namespace Code\ActivityStreams; class ASObject { + public $string; public $ldContext; public $id; public $type; @@ -76,13 +77,18 @@ class ASObject public function __construct($input = null, $strict = false) { - if (isset($input) && is_array($input)) { - foreach ($input as $key => $value) { - $key = ($key === '@context') ? 'ldcontext' : $key; - if ($strict && !property_exists($this, $key)) { - throw new UnhandledElementException("Unhandled element: $key"); + if (isset($input)) { + if (is_string($input)) { + $this->string = $input; + } + elseif(is_array($input)) { + foreach ($input as $key => $value) { + $key = ($key === '@context') ? 'ldcontext' : $key; + if ($strict && !property_exists($this, $key)) { + throw new UnhandledElementException("Unhandled element: $key"); + } + $this->{$key} = $value; } - $this->{$key} = $value; } } return $this; @@ -795,11 +801,19 @@ class ASObject public function toArray() { + if ($this->string) { + return $this->string; + } $returnValue = []; foreach ((array) $this as $key => $value) { if (isset($value)) { $key = ($key === 'ldcontext') ? '@context' : $key; - $returnValue[$key] = $value; + if ($value instanceof ASObject || $value instanceof Link) { + $returnValue[$key] = $value->toArray(); + } + else { + $returnValue[$key] = $value; + } } } return $returnValue; diff --git a/Code/ActivityStreams/AssertionMethod.php b/Code/ActivityStreams/AssertionMethod.php new file mode 100644 index 000000000..44f772d80 --- /dev/null +++ b/Code/ActivityStreams/AssertionMethod.php @@ -0,0 +1,87 @@ +id; + } + + /** + * @param mixed $id + * @return AssertionMethod + */ + public function setId($id) + { + $this->id = $id; + return $this; + } + + /** + * @return mixed + */ + public function getType() + { + return $this->type; + } + + /** + * @param mixed $type + * @return AssertionMethod + */ + public function setType($type) + { + $this->type = $type; + return $this; + } + + /** + * @return mixed + */ + public function getController() + { + return $this->controller; + } + + /** + * @param mixed $controller + * @return AssertionMethod + */ + public function setController($controller) + { + $this->controller = $controller; + return $this; + } + + /** + * @return mixed + */ + public function getPublicKeyMultibase() + { + return $this->publicKeyMultibase; + } + + /** + * @param mixed $publicKeyMultibase + * @return AssertionMethod + */ + public function setPublicKeyMultibase($publicKeyMultibase) + { + $this->publicKeyMultibase = $publicKeyMultibase; + return $this; + } + + + + +} \ No newline at end of file diff --git a/Code/ActivityStreams/Link.php b/Code/ActivityStreams/Link.php index 08559b945..47ea024e1 100644 --- a/Code/ActivityStreams/Link.php +++ b/Code/ActivityStreams/Link.php @@ -16,13 +16,18 @@ class Link public function __construct($input = null, $strict = false) { - if (isset($input) && is_array($input)) { - foreach ($input as $key => $value) { - $key = ($key === '@context') ? 'ldcontext' : $key; - if ($strict && !property_exists($this, $key)) { - throw new UnhandledElementException("Unhandled element: $key"); + if (isset($input)) { + if (is_string($input)) { + $this->string = $input; + } + elseif(is_array($input)) { + foreach ($input as $key => $value) { + $key = ($key === '@context') ? 'ldcontext' : $key; + if ($strict && !property_exists($this, $key)) { + throw new UnhandledElementException("Unhandled element: $key"); + } + $this->{$key} = $value; } - $this->{$key} = $value; } } return $this; @@ -174,11 +179,19 @@ class Link public function toArray() { + if ($this->string) { + return $this->string; + } $returnValue = []; foreach ((array) $this as $key => $value) { if (isset($value)) { $key = ($key === 'ldcontext') ? '@context' : $key; - $returnValue[$key] = $value; + if ($value instanceof ASObject || $value instanceof Link) { + $returnValue[$key] = $value->toArray(); + } + else { + $returnValue[$key] = $value; + } } } return $returnValue; diff --git a/Code/ActivityStreams/PublicKey.php b/Code/ActivityStreams/PublicKey.php index a664e2e87..d3ddf5db8 100644 --- a/Code/ActivityStreams/PublicKey.php +++ b/Code/ActivityStreams/PublicKey.php @@ -26,5 +26,43 @@ class PublicKey extends ASObject return $this; } + /** + * @return mixed + */ + public function getSignatureAlgorithm() + { + return $this->signatureAlgorithm; + } + + /** + * @param mixed $signatureAlgorithm + * @return PublicKey + */ + public function setSignatureAlgorithm($signatureAlgorithm) + { + $this->signatureAlgorithm = $signatureAlgorithm; + return $this; + } + + /** + * @return mixed + */ + public function getPublicKeyPem() + { + return $this->publicKeyPem; + } + + /** + * @param mixed $publicKeyPem + * @return PublicKey + */ + public function setPublicKeyPem($publicKeyPem) + { + $this->publicKeyPem = $publicKeyPem; + return $this; + } + + + } diff --git a/Code/Daemon/Notifier.php b/Code/Daemon/Notifier.php index 263616e72..f13afaa38 100644 --- a/Code/Daemon/Notifier.php +++ b/Code/Daemon/Notifier.php @@ -60,7 +60,7 @@ require_once('include/bbcode.php'); * * and ITEM_ID is the id of the item in the database that needs to be sent to others. * - * ZOT + * Nomad * permissions_create abook_id * permissions_accept abook_id * permissions_reject abook_id @@ -74,7 +74,6 @@ require_once('include/bbcode.php'); * single_mail mail_id (deliver to a singleton network from the appropriate clone) * location channel_id * request channel_id xchan_hash message_id - * rating xlink_id * keychange channel_id * */ diff --git a/Code/Lib/Activity.php b/Code/Lib/Activity.php index e36d49ebf..ccf75094d 100644 --- a/Code/Lib/Activity.php +++ b/Code/Lib/Activity.php @@ -1216,7 +1216,7 @@ class Activity $activity['inReplyTo'] = $item['thr_parent']; $cnv = get_iconfig($item['parent'], 'activitypub', 'context'); if (!$cnv) { - $cnv = $activity['parent_mid']; + $cnv = $item['parent_mid']; } } if (!isset($cnv)) { @@ -1709,6 +1709,13 @@ class Activity 'publicKeyPem' => $p['xchan_pubkey'] ]; + $ret['assertionMethod'] = [ + 'id' => $current_url . '?operation=ed25519key', + 'type' => 'Multikey', + 'controller' => $current_url, + 'publicKeyMultibase' => (new Multibase())->publicKey($c['channel_epubkey']) + ]; + $ret['manuallyApprovesFollowers'] = !$auto_follow; if ($ret['type'] === 'Group') { $ret['capabilities'] = ['acceptsJoins' => true]; @@ -4828,8 +4835,9 @@ class Activity { return ['@context' => [ ACTIVITYSTREAMS_JSONLD_REV, - 'https://w3id.org/security/v1', - // 'https://www.w3.org/ns/did/v1', + 'https://w3id.org/security/v1', + 'https://www.w3.org/ns/did/v1', + 'https://w3id.org/security/multikey/v1', // 'https://w3id.org/security/data-integrity/v1', self::ap_schema($contextType) ]]; @@ -4850,7 +4858,7 @@ class Activity 'oauthRegistrationEndpoint' => 'litepub:oauthRegistrationEndpoint', 'sensitive' => 'as:sensitive', 'movedTo' => 'as:movedTo', - 'alsoKnownAs' => 'as:alsoKnownAs', + // 'alsoKnownAs' => 'as:alsoKnownAs', 'EmojiReact' => 'as:EmojiReact', 'discoverable' => 'toot:discoverable', 'indexable' => 'toot:indexable', diff --git a/Code/Module/Linkinfo.php b/Code/Module/Linkinfo.php index 5a40dc016..b87b149c8 100644 --- a/Code/Module/Linkinfo.php +++ b/Code/Module/Linkinfo.php @@ -548,6 +548,9 @@ class Linkinfo extends Controller case "og:image": $siteinfo["image"] = $attr["content"]; break; + case "og:image:alt": + $siteinfo["image_alt"] = $attr["content"]; + break; case "og:title": $siteinfo["title"] = $attr["content"]; break; @@ -568,6 +571,7 @@ class Linkinfo extends Controller } $src = self::completeurl($attr["src"], $url); + $alt = $attr["alt"]; $photodata = @getimagesize($src); if (($photodata) && ($photodata[0] > 150) and ($photodata[1] > 150)) { @@ -581,7 +585,9 @@ class Linkinfo extends Controller } $siteinfo["images"][] = ["src" => $src, "width" => $photodata[0], - "height" => $photodata[1]]; + "height" => $photodata[1], + "alt" => ($alt ?? "") + ]; } } } else { @@ -589,12 +595,17 @@ class Linkinfo extends Controller unset($siteinfo["image"]); + $alt = $siteinfo["image_alt"]; + unset($siteinfo["image_alt"]); + $photodata = @getimagesize($src); if (($photodata) && ($photodata[0] > 10) and ($photodata[1] > 10)) { $siteinfo["images"][] = ["src" => $src, "width" => $photodata[0], - "height" => $photodata[1]]; + "height" => $photodata[1], + "alt" => ($alt ?? '') + ]; } } diff --git a/Code/Update/_1273.php b/Code/Update/_1273.php new file mode 100644 index 000000000..4c7f2aa42 --- /dev/null +++ b/Code/Update/_1273.php @@ -0,0 +1,30 @@ +\n" "Language-Team: LANGUAGE \n" @@ -110,13 +110,13 @@ msgstr "" msgid "Your service plan only allows %d channels." msgstr "" -#: Code/Import/Friendica.php:191 Code/Lib/Channel.php:512 +#: Code/Import/Friendica.php:191 Code/Lib/Channel.php:502 msgid "Default Profile" msgstr "" #: Code/Import/Friendica.php:237 Code/Import/Friendica.php:238 -#: Code/Import/Friendica.php:246 Code/Lib/Channel.php:561 -#: Code/Lib/Channel.php:563 Code/Module/Settings/Channel.php:621 +#: Code/Import/Friendica.php:246 Code/Lib/Channel.php:551 +#: Code/Lib/Channel.php:553 Code/Module/Settings/Channel.php:621 #: Code/Module/Settings/Channel.php:624 Code/Module/Settings/Channel.php:625 #: Code/Module/Settings/Profile_edit.php:881 Code/Module/Affinity.php:66 #: Code/Module/Connedit.php:697 Code/Widget/Affinity.php:31 @@ -847,7 +847,7 @@ msgstr "" msgid "Probe" msgstr "" -#: Code/Lib/Apps.php:438 Code/Lib/Libprofile.php:753 Code/Lib/Activity.php:3073 +#: Code/Lib/Apps.php:438 Code/Lib/Activity.php:3080 Code/Lib/Libprofile.php:753 #: Code/Module/Profperm.php:131 msgid "Profile" msgstr "" @@ -1012,7 +1012,7 @@ msgstr "" msgid "Unpin from navbar" msgstr "" -#: Code/Lib/Apps.php:1260 Code/Lib/Apps.php:1351 Code/Lib/Activity.php:2303 +#: Code/Lib/Apps.php:1260 Code/Lib/Apps.php:1351 Code/Lib/Activity.php:2310 #: Code/Module/Cdav.php:876 Code/Module/Cdav.php:877 Code/Module/Cdav.php:883 #: Code/Module/Embedphotos.php:339 Code/Module/Photos.php:854 #: Code/Module/Photos.php:1322 Code/Storage/Browser.php:182 @@ -1082,6 +1082,65 @@ msgstr "" msgid "Account '%s' deleted" msgstr "" +#: Code/Lib/Activity.php:473 +msgid "Quoted post" +msgstr "" + +#: Code/Lib/Activity.php:3078 +msgid "Activity" +msgstr "" + +#: Code/Lib/Activity.php:3084 +#, php-format +msgid "Likes %1$s's %2$s" +msgstr "" + +#: Code/Lib/Activity.php:3087 +#, php-format +msgid "Doesn't like %1$s's %2$s" +msgstr "" + +#: Code/Lib/Activity.php:3090 +#, php-format +msgid "Flagged %1$s's %2$s" +msgstr "" + +#: Code/Lib/Activity.php:3093 +#, php-format +msgid "Blocked %1$s's %2$s" +msgstr "" + +#: Code/Lib/Activity.php:3101 +#, php-format +msgid "Will attend %s's event" +msgstr "" + +#: Code/Lib/Activity.php:3104 +#, php-format +msgid "Will not attend %s's event" +msgstr "" + +#: Code/Lib/Activity.php:3107 +#, php-format +msgid "May attend %s's event" +msgstr "" + +#: Code/Lib/Activity.php:3110 +#, php-format +msgid "May not attend %s's event" +msgstr "" + +#: Code/Lib/Activity.php:3115 +#, php-format +msgid "📢 Repeated %1$s's %2$s" +msgstr "" + +#: Code/Lib/Activity.php:3712 include/misc.php:1668 include/misc.php:3129 +#: include/items.php:3006 +#, php-format +msgid "%1$s (%2$s)" +msgstr "" + #: Code/Lib/Navbar.php:104 msgid "Remote authentication" msgstr "" @@ -1244,55 +1303,55 @@ msgstr "" msgid "request-header: " msgstr "" -#: Code/Lib/Channel.php:55 +#: Code/Lib/Channel.php:45 msgid "Empty name" msgstr "" -#: Code/Lib/Channel.php:59 +#: Code/Lib/Channel.php:49 msgid "Name too long" msgstr "" -#: Code/Lib/Channel.php:287 +#: Code/Lib/Channel.php:277 msgid "No account identifier" msgstr "" -#: Code/Lib/Channel.php:299 +#: Code/Lib/Channel.php:289 msgid "Nickname is required." msgstr "" -#: Code/Lib/Channel.php:313 Code/Lib/Channel.php:783 +#: Code/Lib/Channel.php:303 Code/Lib/Channel.php:777 #: Code/Module/Changeaddr.php:72 msgid "Reserved nickname. Please choose another." msgstr "" -#: Code/Lib/Channel.php:318 Code/Lib/Channel.php:788 +#: Code/Lib/Channel.php:308 Code/Lib/Channel.php:782 #: Code/Module/Changeaddr.php:77 msgid "" "Nickname has unsupported characters or is already being used on this site." msgstr "" -#: Code/Lib/Channel.php:402 +#: Code/Lib/Channel.php:392 msgid "Unable to retrieve created identity" msgstr "" -#: Code/Lib/Channel.php:709 Code/Lib/Channel.php:807 +#: Code/Lib/Channel.php:703 Code/Lib/Channel.php:801 msgid "Unable to retrieve modified identity" msgstr "" -#: Code/Lib/Channel.php:1868 Code/Module/Cover_photo.php:289 +#: Code/Lib/Channel.php:1862 Code/Module/Cover_photo.php:289 #: Code/Module/Cover_photo.php:291 Code/Widget/Cover_photo.php:92 msgid "cover photo" msgstr "" -#: Code/Lib/Channel.php:2170 Code/Module/Rmagic.php:88 boot.php:1127 +#: Code/Lib/Channel.php:2164 Code/Module/Rmagic.php:88 boot.php:1127 msgid "Remote Authentication" msgstr "" -#: Code/Lib/Channel.php:2171 Code/Module/Rmagic.php:89 +#: Code/Lib/Channel.php:2165 Code/Module/Rmagic.php:89 msgid "Enter your channel address (e.g. channel@example.com)" msgstr "" -#: Code/Lib/Channel.php:2172 Code/Module/Rmagic.php:92 +#: Code/Lib/Channel.php:2166 Code/Module/Rmagic.php:92 msgid "Authenticate" msgstr "" @@ -1363,31 +1422,31 @@ msgstr "" msgid "Room is full" msgstr "" -#: Code/Lib/Connect.php:58 Code/Lib/Connect.php:178 +#: Code/Lib/Connect.php:56 Code/Lib/Connect.php:175 msgid "Channel is blocked on this site." msgstr "" -#: Code/Lib/Connect.php:63 +#: Code/Lib/Connect.php:61 msgid "Channel location missing." msgstr "" -#: Code/Lib/Connect.php:140 +#: Code/Lib/Connect.php:138 msgid "Remote channel or protocol unavailable." msgstr "" -#: Code/Lib/Connect.php:172 +#: Code/Lib/Connect.php:169 msgid "Channel discovery failed." msgstr "" -#: Code/Lib/Connect.php:185 +#: Code/Lib/Connect.php:182 msgid "Protocol not supported" msgstr "" -#: Code/Lib/Connect.php:198 +#: Code/Lib/Connect.php:195 msgid "Cannot connect to yourself." msgstr "" -#: Code/Lib/Connect.php:276 +#: Code/Lib/Connect.php:273 msgid "error saving data" msgstr "" @@ -2284,65 +2343,6 @@ msgstr "" msgid "📢 Repeated %1$s's %2$s" msgstr "" -#: Code/Lib/Activity.php:473 -msgid "Quoted post" -msgstr "" - -#: Code/Lib/Activity.php:3071 -msgid "Activity" -msgstr "" - -#: Code/Lib/Activity.php:3077 -#, php-format -msgid "Likes %1$s's %2$s" -msgstr "" - -#: Code/Lib/Activity.php:3080 -#, php-format -msgid "Doesn't like %1$s's %2$s" -msgstr "" - -#: Code/Lib/Activity.php:3083 -#, php-format -msgid "Flagged %1$s's %2$s" -msgstr "" - -#: Code/Lib/Activity.php:3086 -#, php-format -msgid "Blocked %1$s's %2$s" -msgstr "" - -#: Code/Lib/Activity.php:3094 -#, php-format -msgid "Will attend %s's event" -msgstr "" - -#: Code/Lib/Activity.php:3097 -#, php-format -msgid "Will not attend %s's event" -msgstr "" - -#: Code/Lib/Activity.php:3100 -#, php-format -msgid "May attend %s's event" -msgstr "" - -#: Code/Lib/Activity.php:3103 -#, php-format -msgid "May not attend %s's event" -msgstr "" - -#: Code/Lib/Activity.php:3108 -#, php-format -msgid "📢 Repeated %1$s's %2$s" -msgstr "" - -#: Code/Lib/Activity.php:3705 include/misc.php:1668 include/misc.php:3129 -#: include/items.php:3006 -#, php-format -msgid "%1$s (%2$s)" -msgstr "" - #: Code/Lib/Libzotdir.php:88 msgid "Directory Options" msgstr "" @@ -7447,7 +7447,7 @@ msgstr "" msgid "Restricted or Premium Channel" msgstr "" -#: Code/Module/Follow.php:151 +#: Code/Module/Follow.php:146 msgid "Connection added." msgstr "" diff --git a/version.php b/version.php index ad8de45a7..ae0e4650c 100644 --- a/version.php +++ b/version.php @@ -1,2 +1,2 @@