Commit Graph

10 Commits

Author SHA1 Message Date
626b4263f1
[PLUGIN][ActivityPub][Model][Actor] Fix internal logic for updating
Actors
2022-03-05 14:19:12 +00:00
51cccd0155
[PLUGIN][ActivityPub] Simplify DB usage 2022-02-20 05:03:40 +00:00
93276ce8d0
[AUTOGENERATED] Update autogenerated code 2021-12-27 03:06:30 +00:00
c79b1e4c94
[AUTOGENERATED] Update auto generated code 2021-12-26 19:16:15 +00:00
ec28f23025
[TOOLS] Run CS-fixer on all files 2021-12-26 19:16:15 +00:00
a81ac673ac
[CORE][ENTITY] Rename 'Entity::getWithPK' to 'Entity::getByPK' 2021-12-19 19:04:01 +00:00
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
424df54a1b
[ActivityPub] Add HTTP Signatures 2021-12-01 19:47:41 +00:00
89d36a68e5
[ENTITY][Actor] Add is_local, it's common to depend, and this makes it much faster, with a low space cost 2021-11-16 23:26:20 +00:00
8fdc52636f
[ActivityPub] Port RSA 2021-10-27 04:19:29 +01:00