Commit Graph

93 Commits

Author SHA1 Message Date
Alexei Sorokin
2f7d6ef07b [ActivityPub][INBOX][Delete] Stop if the ID is not present 2021-07-16 19:44:41 +01:00
Alexei Sorokin
04018ea4ca [ActivityPub] Fix use of ActivityPubPlugin::pull_remote_profile
It does not throw but return null.
2021-07-16 19:44:41 +01:00
Alexei Sorokin
9efbef720d Avoid use of assignments bare inside statements
Either use them in a subroutine call or put parentheses around the assignment.
2021-07-16 19:44:41 +01:00
Alexei Sorokin
6cb3a0c390 [ActivityPub] Check if a Notice is public via CC as well 2021-07-16 19:44:41 +01:00
Diogo Cordeiro
238652b15d [ActivityPub] Fix note URIs 2021-07-16 19:44:41 +01:00
Diogo Cordeiro
c3cdde0873 [ActivityPub] Tombstones now have datetimes 2021-07-16 19:44:41 +01:00
Diogo Cordeiro
82f1fc7ca2 [ActivityPub] Implement Failed Queue 2021-07-16 19:44:41 +01:00
Diogo Cordeiro
751b23f6fe [ActivityPub] Fix DELETE 2021-07-16 19:44:41 +01:00
Diogo Cordeiro
af0366ed58 [ActivityPub] Fix issues concerning Activity URIs
And some other minor bugs.
2021-07-16 19:44:41 +01:00
Diogo Cordeiro
300c4e3d04 [ActivityPub] Revert moving Disfavor to Queues
It seems this kind of notice isn't queued?
2021-07-16 19:44:41 +01:00
Diogo Cordeiro
5f35d9633d [ActivityPub][Queues] Fix Like 2021-07-16 19:44:41 +01:00
Diogo Cordeiro
c834d27dd6 [TheFreeNetwork] Do not allow lower priority protocols to handle remote actors already handled by the higher ones 2021-07-16 19:44:41 +01:00
Diogo Cordeiro
33721c85cd [ActivityPub][NOTICE] Process attachments 2021-07-16 19:44:38 +01:00
Diogo Cordeiro
7e559f0cd0 [ActivityPub][NOTICE] Fix variable being wrongly reused 2021-07-16 19:44:38 +01:00
Diogo Cordeiro
f3df3762f1 [ActivityPub][INBOX][Delete] Support Delete Actor object being a Tombstone 2021-07-16 19:44:38 +01:00
Diogo Cordeiro
ce4ceaf8c7 [ActivityPub][NOTICE] Fix other federation protocols mention handling 2021-07-16 19:44:38 +01:00
Diogo Cordeiro
30024b4d47 [ActivityPub][SCRIPTS] Add fix_subscriptions.php 2021-07-16 19:44:38 +01:00
Diogo Cordeiro
10f0a15614 [VersionBump] 2.0.0alpha0
Ran composer update and locale updater
2021-07-16 19:44:38 +01:00
t3nma
119783f80e [ActivityPub][QUEUES] Handle Create (AS1 POST) verb properly
Fixes a bug introduced in e504d13120
2021-07-16 19:44:38 +01:00
Alexei Sorokin
bee3dea9c2 [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.
2021-07-16 19:44:38 +01:00
Alexei Sorokin
903a9d2667 [DOCUMENTATION] Adopt PSR-12 and clarify on arrays 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
452f05512f [ActivityPub][Explorer] More robust exception handler for invalid remote answers 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
7022d85b93 [ActivityPub][AProfile] Complete strict typing 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
235122280d [ActivityPub] Increase type strictness on Explorer 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
05790c124c [ActivityPub] Fix wrong type handling on AProfile:update_profile 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
b5180d6096 [ActivityPub] Fix bug introduced with 4d171b27
Too few arguments to function Activitypub_notice::create_notice()
2021-07-16 19:44:37 +01:00
Diogo Cordeiro
8ec2af0020 [TheFreeNetwork] Fix small logic issue regarding StartTFNLookup return 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
d81e795cc0 [ActivityPub][SCRIPTS] Make update profiles work with an uri 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
4bbfb2dd56 [ActivityPub][QUEUES] Add Like, Undo and Delete 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
2b4aaca14a [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
2021-07-16 19:44:37 +01:00
Diogo Cordeiro
64108aa51d [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
2021-07-16 19:44:37 +01:00
Diogo Cordeiro
9f4c4edb02 [ActivityPub][Ostatus] Fetch avatars in accordance to the new media system 2021-07-16 19:44:37 +01:00
Alexei Sorokin
26115482ef [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.
2021-07-16 19:44:37 +01:00
Alexei Sorokin
eb993df072 [DATABASE] Fix MariaDB schema verification 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
32a7cd6458 [ActivityPub][HTTPSignatures] Fix verify 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
78f0ab022c [ActivityPub][Inbox] Signature verification after Actor update would always fail 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
c7e1352618 [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.
2021-07-16 19:44:37 +01:00
Diogo Cordeiro
25f67a1ce9 [ActivityPub][Inbox] get_all_headers was nginx only 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
bc1af78bf7 [TESTS] Move AcceptHeader from ActivityPub plugin to Core
Delete temporary ActivityPub tests (they were to be deleted long ago)
2021-07-16 19:44:37 +01:00
Alexei Sorokin
d01f44ee99 [DATABASE] Some query improvements
Make common_sql_weight employ standard SQL functions for the timestamp
difference in seconds.
Also replace UTC_TIMESTAMP in the MariaDB-specific part with CURRENT_TIMESTAMP
as it is the only occurence and GNU social sets UTC as a default timezone.

In a delete_orphan_files.php script simplify the main query considerably.

In clean_profiles.php stop using COUNT as if it is ANY, that is unnecessary
punishment for the database. Instead implement the anti-join with a
left outer join.

In Autocomplete and Activitypub_profile use joins instead of a WHERE OR
anti-pattern for the semi-joins.

In lib/ui/galleryaction.php replace a CROSS JOIN with an INNER JOIN.

In actions/sup.php remove a redundant subquery: WHERE is applied before
grouping either way.
2021-07-16 19:44:36 +01:00
Alexei Sorokin
434f07430d [DATABASE] Use "<>" as an SQL non-equality sign in more cases
A follow-up to commit 644b417f6c
2021-07-16 19:44:36 +01:00
susdiv
4153a93390 [ActivityPub] Fix Postgres incompatible query in Following and Followed collection 2021-07-16 19:44:36 +01:00
tenma
12945c4d20 [ActivityPub] Remove TFN's deprecated Census event 2021-07-16 19:44:36 +01:00
tenma
9fcccd8b5a [ActivityPub] Add TheFreeNetwork module's support in handling profile insertion
Activitypub_profile:
- Update do_insert to trigger TFN's assistance in inserting the profile

explorer:
- Use the new LRDD's method for grabbing profile aliases
2021-07-16 19:44:36 +01:00
tenma
a17c010bb9 [ActivityPub] Autofix profile URIs through alias discovering
Activitypub_profile:
- Add updateUri method

explorer:
- Add grab_aliases method
- Update grab_local_user's online course to grab and test aliases
2021-07-16 19:44:36 +01:00
Diogo Cordeiro
6598b89db0 [ActivityPub] Fix profile url handling 2021-07-16 19:44:36 +01:00
Diogo Cordeiro
4a90f281ed [ActivityPub] Fix undefined tag index 'type' in Activitypub_notice 2021-07-16 19:44:36 +01:00
Diogo Cordeiro
351e356bb4 [ActivityPub][Postman] Fix not sending notices to self 2021-07-16 19:44:36 +01:00
Diogo Cordeiro
e7778bd5d7 [ActivityPub][RSA] Revision, increase type scrictness and improve docs 2021-07-16 19:44:36 +01:00
Diogo Cordeiro
73af7be061 [ActivityPub] Properly handle Actor URIs by using events correctly
This should fix nulls on explorer lookups inputed by postman after generate_followers/getSubscribers, that I think were caused by calling common_profile_uri that, curiously, only handles local profiles
2021-07-16 19:44:36 +01:00