Commit Graph

206 Commits

Author SHA1 Message Date
Diogo Peralta Cordeiro
91f8c86efa
[PLUGIN][ActivityPub] Support and federate scopes 2021-12-26 19:16:12 +00:00
Diogo Peralta Cordeiro
d4bc1d097d
[ENTITY][NoteTag][COMPONENT][Language] Add language to NoteTag and minor corrections 2021-12-26 06:22:30 +00:00
Diogo Peralta Cordeiro
78fddaf86a
[PLUGIN][ActivityPub] Notify mentions in tags 2021-12-26 06:22:28 +00:00
Diogo Peralta Cordeiro
9d0b39e680
[PLUGIN][ActivityPub] Support tags in notes 2021-12-25 18:04:31 +00:00
Diogo Peralta Cordeiro
36483a6ecd
[COMPONENT][Link] Ignore html anchors that include mention class 2021-12-25 18:04:30 +00:00
Diogo Peralta Cordeiro
e3efd25b43
[PLUGIN][ActivityPub] Fix typo in getObjectByUri 2021-12-24 02:46:45 +00:00
Diogo Peralta Cordeiro
3c79d82b80
[PLUGIN][ActivityPub][Note] Support inReplyTo 2021-12-24 02:46:39 +00:00
Diogo Peralta Cordeiro
1865d2b41e
[ActivityPub][Postman] Fill To and CC with mentions 2021-12-24 00:42:02 +00:00
Diogo Peralta Cordeiro
e2c0505620
[ActivityPub][Inbox] Add request to debug logs 2021-12-21 15:52:41 +00:00
Diogo Peralta Cordeiro
1832397363
[ActivityPub] Include recent actor type attribute in its creation
Improve debug logs
2021-12-20 13:32:49 +00:00
Diogo Peralta Cordeiro
a9c73a8f33
[PLUGIN][ActivityPub] Add mention tags 2021-12-20 13:32:48 +00:00
Diogo Peralta Cordeiro
a005a7bcea
[PLUGIN][ActivityPub] Add getUriByObject, so that we can construct activities referring to other known objects (local or foreign) 2021-12-20 13:32:46 +00:00
Diogo Peralta Cordeiro
1d09a02ad6
[FreeNetwork][ActivityPub] Sometimes remote Actors report empty full names in not very explicit manners 2021-12-19 19:04:05 +00:00
Hugo Sales
a81ac673ac
[CORE][ENTITY] Rename 'Entity::getWithPK' to 'Entity::getByPK' 2021-12-19 19:04:01 +00:00
Diogo Peralta Cordeiro
480a42cca5
[PLUGIN][ActivityPub] Introduce ActivitypubObject. Beware, inside the plugin, an Object can never be an Activity.
Many bug fixes and other major changes (interface changed, see EVENTS.md)
2021-12-08 23:24:23 +00:00
Diogo Peralta Cordeiro
330e09f2d3
[PLUGIN][ActivityPub] Only store a new object if there were no previous activities with it before 2021-12-05 21:09:30 +00:00
Diogo Peralta Cordeiro
5196b669b9
[PLUGIN][ActivityPub] Add attachment support to Notes 2021-12-05 21:04:20 +00:00
Diogo Peralta Cordeiro
19b8a7648e
[PLUGIN][ActivityPub] Implement Avatar support 2021-12-05 20:08:14 +00:00
Hugo Sales
e29e1cc87c
[ENTITY] Rename 'getFrom' to 'getBy' 2021-12-05 17:55:46 +00:00
Diogo Peralta Cordeiro
9512890264
[PLUGIN][ActivityPub] Implement Actor Update
Diverse minor bug fixes
2021-12-05 03:11:08 +00:00
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
Diogo Peralta Cordeiro
eeaad19754
[Attachment] Move Controller and Entities to a Component
There's no problem in having the templates in the core
2021-12-02 15:14:07 +00:00
Diogo Peralta Cordeiro
d044039272
[FreeNetwork] Initial multi-protocol support 2021-12-02 14:23:21 +00:00
Diogo Peralta Cordeiro
dbaee08038
[FreeNetwork] Move mentions logic from AP to FN and handle local webfinger mentions properly 2021-12-02 11:12:04 +00:00
Diogo Peralta Cordeiro
53c46127c1
[ActivityPub][Explorer] Store remote's url properly 2021-12-02 11:12:03 +00:00
Diogo Peralta Cordeiro
6f543ccc06
[ActivityPub][Model][Activity] Translate including objects 2021-12-01 20:53:51 +00:00
Diogo Peralta Cordeiro
424df54a1b
[ActivityPub] Add HTTP Signatures 2021-12-01 19:47:41 +00:00
Diogo Peralta Cordeiro
123544fa50
[ActivityPub] Port Postman 2021-12-01 19:47:40 +00:00
Diogo Peralta Cordeiro
df3fbbc9e7
[ActivityPub] Add ActivityToType
Minor bug fixes
2021-12-01 19:47:39 +00:00
Diogo Peralta Cordeiro
56526c9ba6
[ActivityPub][Inbox] Restore Create Note Functionality
Minor bug fixes
2021-11-29 22:42:46 +00:00
Diogo Peralta Cordeiro
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
Diogo Peralta Cordeiro
c862c9bf18
[ActivityPub] Make remote mentions great again 2021-11-01 12:16:46 +00:00
Hugo Sales
4d9a5aae5a
[ActivityPub] Always explicitly compare the results of Event::handle to the constants next or stop 2021-10-28 17:28:02 +01:00
Eliseu Amaro
d47f125894
[PLUGINS][Favourite] Refactored redirection to previous url. User is now unable to do invalid actions (ex. favour an already favourited note).
[PLUGINS][ActivityPub] Fixed favour route id to be more consistent.
2021-10-27 20:44:50 +01:00
Diogo Peralta Cordeiro
51c984849f
[ActivityPub] Port Explorer 2021-10-27 04:22:19 +01:00
Diogo Peralta Cordeiro
028ea79fff
[CORE][Router] Properly act on Accept headers 2021-10-27 04:19:30 +01:00
Diogo Peralta Cordeiro
8fdc52636f
[ActivityPub] Port RSA 2021-10-27 04:19:29 +01:00
Diogo Peralta Cordeiro
8544fe157b
[FreeNetwork] First steps porting webfinger/lrdd to v3, GET webfinger requests already have a basic result 2021-10-27 04:19:29 +01:00
Hugo Sales
9109c61af5
[TOOLS][CS-FIXER] Run new PHP CS Fixer config. Notably, adds strict_types 2021-10-27 04:19:28 +01:00
Diogo Peralta Cordeiro
517ed953f2
[FreeNetwork] First step towards de-duplication mechanism for federation
Refactored AS2 inside AP; [ENTITY][Activity] went from core to AP
Webfinger plugin will be part of FreeNetwork component
2021-10-06 11:48:22 +01:00
Diogo Peralta Cordeiro
7813723ca1
[ActivityPub] Inbox must work without actor, specify source for AS2 2021-09-20 17:03:23 +01:00
Diogo Peralta Cordeiro
d6f31d102a
[CORE][ActivityStreamsTwo][ActivityPub] Set all routes
Allow global routes to act for every actor
Fix Favoured stream query
2021-09-18 05:12:15 +01:00
Diogo Peralta Cordeiro
365edbaff0
[ActivityStreamsTwo] Initial Actor support
Various bug fixes
2021-09-15 10:26:53 +01:00
Hugo Sales
4e30e5aad9
[TOOLS] Fix all issues found by PHPStan level 2 2021-09-14 13:13:44 +01:00
Diogo Peralta Cordeiro
8880af8197
[ActivityStreamsTwo] Introduce a structure for data representation in ActivityStreams 2.0
Type factory borrowed from landrok/activitypub
2021-09-14 13:13:37 +01:00
Hugo Sales
ad67358c3b
[ActivityPub] Remove ActivityPub plugin until we're ready to work on it, as it needs significant work 2021-09-14 13:10:51 +01:00
Daniel
95f95d2dd8
[TESTS] Added unit tests 2021-09-14 13:10:08 +01:00
Hugo Sales
e2e53d9a2a
[AUTOGENERATED] Update auto generated code in entities 2021-09-14 13:06:56 +01:00
Hugo Sales
460712e15e
[GIT] Change my email to the new one in all files and bump copyright year 2021-09-14 13:06:56 +01:00
Hugo Sales
f95f69c778
Add some missing documentation to ActivityPub 2021-09-14 13:06:56 +01:00
Hugo Sales
cc758f6a8e
[AUTOGENERATED] Update autogenerated code in module entities 2021-09-14 13:06:51 +01:00
Hugo Sales
f60bdaa2f0
[DB][MODULES][ActivityPub] Cleanup table definitions 2021-09-14 13:06:45 +01:00
Hugo Sales
b624359b9a
[ActivityPub] Initial cleanup, removing 'die' statements, and ignoring the subfolders 2021-09-14 13:06:39 +01:00
Hugo Sales
11154a0d8c
[V3] Big Crunch
And so, just as it begins, so too must it end
One should not dwell and stall, for more is to come
2021-09-14 13:01:23 +01:00
Diogo Peralta Cordeiro
7d8988d50c [VersionBump] 2.0.0beta0
Updated composer and translations

composer install --no-dev
composer dump-autoload --optimize
git add vendor/ --force
make updatepo
2021-07-18 12:51:07 +01:00
Diogo Peralta Cordeiro
31433db539 [ActivityPub][POSTMAN] Do not die on network errors 2021-07-16 18:03:12 +01:00
Diogo Peralta Cordeiro
55293e4008 [ActivityPub][INBOX] CREATE NOTE Attachments, we handle enclosures elsewhere
It was trying to make enclosures with objects instead of strings, also attachments don't use this, only links
2021-07-16 17:07:13 +01:00
Diogo Peralta Cordeiro
bb2c845f62 [ActivityPub][INBOX] CREATE NOTE now accepts <br> tag 2021-07-16 15:48:02 +01:00
Alexei Sorokin
b6ce12a267 Update the project homepage and IRC channel 2021-06-12 11:30:12 +03:00
Diogo Peralta Cordeiro
22b5dd8567 [Media] Fix several issues
[StoreRemoteMedia] Upgrade plugin to use the new Media system

API Changes:
- Added getters to File to better formalize the ideas of the commit "[Media] Fix issues with database file storage"

UI Changes:
- Now presented thumbnails are actual thumbnails (bug fix)
- Attachment actions have a slightly more extended behaviour

Many other minor bug fixes...
2021-02-21 16:03:46 +00:00
Diogo Peralta Cordeiro
f9290705f8 [ActivityPub] Attachment fetch should happen on StoreRemoteMedia 2021-02-21 16:03:46 +00:00
Diogo Peralta Cordeiro
b1e6b00545 [ActivityPub] Re-implement Delete Actor 2021-02-21 15:00:58 +00:00
Alexei Sorokin
52d67b0f44 Avoid ordering just by a timestamp
Try to also employ an id when possible.
Involves reworking some of the indices.
2020-09-15 16:59:27 +03:00
Alexei Sorokin
96f1cc1a5c [ActivityPub][INBOX][Delete] Stop if the ID is not present 2020-09-14 21:32:41 +03:00
Alexei Sorokin
647bf8c953 [ActivityPub] Fix use of ActivityPubPlugin::pull_remote_profile
It does not throw but return null.
2020-09-14 20:48:10 +03:00
Alexei Sorokin
adc689cb15 Avoid use of assignments bare inside statements
Either use them in a subroutine call or put parentheses around the assignment.
2020-09-08 12:42:51 +03:00
Alexei Sorokin
fc300607e5 [ActivityPub] Check if a Notice is public via CC as well 2020-09-01 01:20:13 +03:00
Diogo Cordeiro
8c20ed0c89 [ActivityPub] Fix note URIs 2020-08-31 22:18:49 +01:00
Diogo Cordeiro
c8e9cbdbb8 [ActivityPub] Tombstones now have datetimes 2020-08-30 01:59:38 +01:00
Diogo Cordeiro
11a7182594 [ActivityPub] Implement Failed Queue 2020-08-29 20:32:21 +01:00
Diogo Cordeiro
817074a787 [ActivityPub] Fix DELETE 2020-08-29 20:32:18 +01:00
Diogo Cordeiro
c75bf1a19d [ActivityPub] Fix issues concerning Activity URIs
And some other minor bugs.
2020-08-29 11:29:12 +01:00
Diogo Cordeiro
e4093343c2 [ActivityPub] Revert moving Disfavor to Queues
It seems this kind of notice isn't queued?
2020-08-27 02:14:47 +01:00
Diogo Cordeiro
101ea554ef [ActivityPub][Queues] Fix Like 2020-08-27 02:12:22 +01:00
Diogo Cordeiro
ef6a986dc6 [TheFreeNetwork] Do not allow lower priority protocols to handle remote actors already handled by the higher ones 2020-08-27 01:32:15 +01:00
Diogo Cordeiro
849ad494d8 [ActivityPub][NOTICE] Process attachments 2020-08-05 18:23:41 +01:00
Diogo Cordeiro
1428ac2cb0 [ActivityPub][NOTICE] Fix variable being wrongly reused 2020-08-05 17:53:31 +01:00
Diogo Cordeiro
efdc7d9ba0 [ActivityPub][INBOX][Delete] Support Delete Actor object being a Tombstone 2020-08-05 17:53:31 +01:00
Diogo Cordeiro
e4e41bb595 [ActivityPub][NOTICE] Fix other federation protocols mention handling 2020-08-04 20:00:55 +01:00
Diogo Cordeiro
379fbb6e5d [ActivityPub][SCRIPTS] Add fix_subscriptions.php 2020-08-04 17:12:01 +01:00
Diogo Cordeiro
a9c365a5eb [VersionBump] 2.0.0alpha0
Ran composer update and locale updater
2020-08-04 05:31:44 +01:00
t3nma
1675916fda [ActivityPub][QUEUES] Handle Create (AS1 POST) verb properly
Fixes a bug introduced in e504d13120
2020-08-03 18:21:47 +01:00
Alexei Sorokin
92e8c40c55 [DATABASE] Add explicit indices for all foreign keys
This adds a requirement for all definitions that have foreign keys to also
require indices for all source (local) attributes mentioned in foreign keys.

MariaDB/MySQL creates indices for source attributes automatically, so this
serves as a way to get rid of those automatic indices and create clean explicit
ones instead.

In PostgreSQL, most of the time, indices on the source are necessary to
decrease performance penalty of foreign keys (like in MariaDB), but they aren't
created automatically, so this serves to remove that difference between
PostgreSQL and MariaDB.
2020-07-31 16:36:40 +03:00
Alexei Sorokin
434ce56e33 [DOCUMENTATION] Adopt PSR-12 and clarify on arrays 2020-07-27 19:19:42 +03:00
Diogo Cordeiro
0def5f1dca [ActivityPub][Explorer] More robust exception handler for invalid remote answers 2020-07-23 15:54:40 +01:00
Diogo Cordeiro
6db56cc949 [ActivityPub][AProfile] Complete strict typing 2020-07-21 23:22:07 +01:00
Diogo Cordeiro
871f3c4bfe [ActivityPub] Increase type strictness on Explorer 2020-07-21 12:26:23 +01:00
Diogo Cordeiro
395fe8cb10 [ActivityPub] Fix wrong type handling on AProfile:update_profile 2020-07-21 12:02:07 +01:00
Diogo Cordeiro
3a2ec3ef9c [ActivityPub] Fix bug introduced with 4d171b27
Too few arguments to function Activitypub_notice::create_notice()
2020-07-07 17:57:48 +01:00
Diogo Cordeiro
6526bdc824 [TheFreeNetwork] Fix small logic issue regarding StartTFNLookup return 2020-07-05 18:26:49 +01:00
Diogo Cordeiro
1967f46a69 [ActivityPub][SCRIPTS] Make update profiles work with an uri 2020-07-05 17:38:28 +01:00
Diogo Cordeiro
e504d13120 [ActivityPub][QUEUES] Add Like, Undo and Delete 2020-07-05 16:58:05 +01:00
Diogo Cordeiro
2f284f4274 [ActivityPub][INBOX][Delete] Fix misconceptions
References:
- https://socialhub.activitypub.rocks/t/the-delete-activity-and-its-misconceptions/137
- https://socialhub.activitypub.rocks/t/the-update-activity-more-than-caching/260
2020-07-05 16:46:37 +01:00
Diogo Cordeiro
4d171b27a4 [ActivityPub][NOTE] Do not extract actor from attributedTo
There was no checking of attributedTo, actors and referent object IDs to make
sure they exist in the same domain. Therefore, one could spoof messages from
people by doing attributedTo: whoever-i-want-to-spoof
2020-07-05 15:38:12 +01:00
Diogo Cordeiro
fe4a9a6189 [ActivityPub][Ostatus] Fetch avatars in accordance to the new media system 2020-07-05 15:37:52 +01:00
Alexei Sorokin
9a515b9234 [SCHEMA] Improve timestamp storage
Avoid the use of deprecated MariaDB "zero dates" globally. If they're present
as attribute defaults somewhere, they will be replaced with NULL implicitly.
The existing "zero dates" in MariaDB storage will be left intact and this
should not present any issues.

The "timestamp" type in table definitions now corresponds to DATETIME in
MariaDB with "DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", which
should be close enough to the original behaviour for compatibility purposes.
It is now the recommended type for "modified" attributes, because of the
update trigger on MariaDB. But there is no such trigger implemented on
PostgreSQL as of this moment.
2020-06-29 01:41:46 +03:00
Alexei Sorokin
b924c180ae [DATABASE] Fix MariaDB schema verification 2020-06-28 20:05:11 +03:00
Diogo Cordeiro
737f3eb553 [ActivityPub][HTTPSignatures] Fix verify 2020-06-28 00:58:16 +01:00
Diogo Cordeiro
6e3954f3bb [ActivityPub][Inbox] Signature verification after Actor update would always fail 2020-06-28 00:49:55 +01:00
Diogo Cordeiro
7869a7c1b0 [ActivityPub][Inbox] With PHP 7.3 we don't need get_all_headers workaround anymore
Furthermore, it was broken on Apache2 because the actual function
doesn't put the resulting array's key in lowercase.
2020-06-27 20:43:43 +01:00