gnu-social/plugins
Diogo Peralta Cordeiro 778cb57d83
[PLUGIN][ActivityPub] Finish base ActivityStreams 2.0 interface
Instructions below

To extend an Activity properties do:

public function onActivityPubValidateActivityStreamsTwoData(string $type_name, array &$validators): bool {
    if ($type_name === '{Type}') {
        $validators['attribute'] = myValidator::class;
    }
    return Event::next;
}

The Validator should be of the form:

use ActivityPhp\Type;
use ActivityPhp\Type\Util;
use Plugin\ActivityPub\Util\ModelValidator;

class myValidator extends ModelValidator
{
    /**
     * Validate Attribute's value
     *
     * @param mixed $value from JSON's attribute
     * @param mixed $container A {Type}
     * @return bool
     * @throws Exception
     */
    public function validate($value, $container): bool
    {
        // Validate that container is a {Type}
        Util::subclassOf($container, Type\Extended\Object\{Type}::class, true);

        return {Validation Result};

To act on received activities do:

public function onActivityPubNew{Type}(&$obj): bool {

To add information to Activities being federated by ActivityPub do:

public function ActivityPubAddActivityStreamsTwoData(string $type_name, &$type): bool {

To implement an ActivityStreams 2.0 representation do:

public function onActivityPubActivityStreamsTwoResponse(string $route, arrray $vars, ?TypeResponse &$response = null): bool {
        if ($route === '{Object route}') {
                $response = ModelResponse::handle($vars[{Object}]);
                return Event::stop;
        }
        return Event::next;
}
2021-12-04 21:05:07 +00:00
..
ActivityPub [PLUGIN][ActivityPub] Finish base ActivityStreams 2.0 interface 2021-12-04 21:05:07 +00:00
AttachmentShowRelated [PLUGINS][AttachmentShowRelated] Fixed note template error. Fixed if statement. 2021-11-24 12:46:32 +00:00
AudioEncoder [PLUGIN][VideoEncoder] Some videos don't have images (video stream), only audio, handle that 2021-12-03 03:32:44 +00:00
Cover [Attachment] Move Controller and Entities to a Component 2021-12-02 15:14:07 +00:00
DeleteNote [Plugins][FAVOURITE] No longer a form, a link to a new page is provided instead. The amount of forms per page were blocking rendering for the majority of its duration. 2021-10-27 04:19:32 +01:00
Directory [UI][CONTROLLER][ENTITY][DOCS] Refactor term 'timeline' into 'feed' 2021-11-26 13:05:23 +00:00
EmailNotifications [TOOLS][CS-FIXER] Run new PHP CS Fixer config. Notably, adds strict_types 2021-10-27 04:19:28 +01:00
Embed [COMPONENT][Link] Fix some minor issues with empty headed links, typo in event handler's name, and refactor entity to inside component 2021-12-03 00:46:52 +00:00
Favourite [ENTITY][Note] Add getLanguageLocale() and getNoteLanguageShortDisplay() 2021-12-02 15:05:49 +00:00
FileQuota [TOOLS][CS-FIXER] Run new PHP CS Fixer config. Notably, adds strict_types 2021-10-27 04:19:28 +01:00
ImageEncoder [COMPONENT][Attachment] Do not show download links for non-local attachments 2021-12-03 03:32:43 +00:00
Oomox [PLUGINS][Oomox] Further checks done when handling form requests. Improved documentation, fixed typos and diminished repeated calls 2021-12-03 03:32:38 +00:00
Poll [CORE][CONTROLLER][Network] Refactor term 'network' into 'feeds' 2021-11-26 23:34:37 +00:00
ProfileColor [TOOLS][CS-FIXER] Run new PHP CS Fixer config. Notably, adds strict_types 2021-10-27 04:19:28 +01:00
RelatedTags [TOOLS][DOCS] Add missing doc blocks, as signaled by doc-checker 2021-12-01 19:47:44 +00:00
Repeat [ENTITY][Note] Add getLanguageLocale() and getNoteLanguageShortDisplay() 2021-12-02 15:05:49 +00:00
Reply [ENTITY][Note] Add getLanguageLocale() and getNoteLanguageShortDisplay() 2021-12-02 15:05:49 +00:00
StemWord [COMPONENTS][Tag] Split tag into words and stem each 2021-11-25 20:37:53 +00:00
StoreRemoteMedia [PLUGIN][VideoEncoder] Some videos don't have images (video stream), only audio, handle that 2021-12-03 03:32:44 +00:00
TreeNotes [PLUGINS][Reply] Fix return on getReplyToNote 2021-11-29 23:12:09 +00:00
VideoEncoder [PLUGIN][VideoEncoder] Some videos don't have images (video stream), only audio, handle that 2021-12-03 03:32:44 +00:00
XMPPNotifications [TOOLS][CS-FIXER] Run new PHP CS Fixer config. Notably, adds strict_types 2021-10-27 04:19:28 +01:00