[AP] Subscribe RemoteFollow plugin events for allowing following with the remote-follow button
This commit is contained in:
parent
66c5d17469
commit
6af86536aa
|
@ -50,7 +50,7 @@ const ACTIVITYPUB_PUBLIC_TO = ['https://www.w3.org/ns/activitystreams#Public',
|
||||||
*/
|
*/
|
||||||
class ActivityPubPlugin extends Plugin
|
class ActivityPubPlugin extends Plugin
|
||||||
{
|
{
|
||||||
const PLUGIN_VERSION = '0.1.0alpha0';
|
const PLUGIN_VERSION = '0.2.0alpha0';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Actor's URI from its local $profile
|
* Returns a Actor's URI from its local $profile
|
||||||
|
@ -657,6 +657,28 @@ class ActivityPubPlugin extends Plugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to grab and store the remote profile by the given uri
|
||||||
|
*
|
||||||
|
* @param string $uri
|
||||||
|
* @param Profile &$profile
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function onRemoteFollowPullProfile(string $uri, ?Profile &$profile): bool
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$aprofile = $this->pull_remote_profile($uri);
|
||||||
|
if ($aprofile instanceof Activitypub_profile) {
|
||||||
|
$profile = $aprofile->local_profile();
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// No remote ActivityPub profile found
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_null($profile);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Delivery Events *
|
* Delivery Events *
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
|
@ -8,6 +8,11 @@ It includes general information about the plugin.
|
||||||
|
|
||||||
This plugin adds [ActivityPub](https://www.w3.org/TR/activitypub/) support to GNU social.
|
This plugin adds [ActivityPub](https://www.w3.org/TR/activitypub/) support to GNU social.
|
||||||
|
|
||||||
|
## Additional functionality
|
||||||
|
|
||||||
|
The RemoteFollow plugin is recommended as it increases the UX significatively,
|
||||||
|
it adds a remote follow button to user profiles.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
* **[Diogo Cordeiro](https://www.diogo.site/)**
|
* **[Diogo Cordeiro](https://www.diogo.site/)**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user