Commit Graph

5169 Commits

Author SHA1 Message Date
Alexei Sorokin
08145f635f Implement a class for automatic temporary file handling
And adopt it all over the code.
2020-09-04 13:15:23 +03:00
Alexei Sorokin
55136c1c6f [DirectMessage] Simplify the inbox query 2020-09-02 15:12:20 +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
Alexei Sorokin
11ebb98919 [DATABASE] Fix use of ORDER BY with DISTINCT
statuses/retweets_of_me has performance fixed, so it is also stripped of its
"bad query" status.
2020-08-27 11:15:39 +03: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
Alexei Sorokin
db593496a7 [Directory] Fix SQL string quotation 2020-08-26 16:27:35 +03:00
Alexei Sorokin
00c492891e [Foreign_link] Change the type of "credentials" to blob
TwitterOAuthClient::packToken uses \0 as a delimeter which can cause issues on
TEXT or VARCHAR.
2020-08-25 16:06:37 +03:00
Alexei Sorokin
0e81f9c726 [OpenID] Correct table definition types
"server_url" should not be blob.
Lengths are adjusted to Auth/OpenID/(PostgreSQL|MySQL)Store.php.
2020-08-24 16:27:44 +03:00
Alexei Sorokin
20e5a6d1f3 [TwitterBridge][DAEMONS] Fix database connection clean-up 2020-08-24 15:43:14 +03:00
Alexei Sorokin
afd18db381 [TwitterBridge] Create Foreign_user before Foreign_link
To keep foreign key constraints intact.
2020-08-13 23:59:40 +03:00
tenma
2f845e98e8 [FFmpeg] Add FFmpeg plugin
FFmpeg plugin serves as a better performant/quality alternative to
resize animated GIFs than the ImageMagick plugin.
2020-08-14 23:32:15 +01:00
tenma
8a2c1658a8 [ImageMagick] Remove unnecessary code
ImageMagickPlugin:
- Remove animated thumbnail setting, we'll be able to use FFmpeg for performance
- Remove onFillImageFileMetadata and onCreateFileImageThumbnailSource(), these
  are handled just fine by ImageFile
- Bump minor version number

README:
- Update
2020-08-14 19:48:02 +01:00
Alexei Sorokin
b65c200922 [File] Fix file deletion violating foreign keys 2020-08-13 23:56:31 +03:00
Alexei Sorokin
33caf31237 [RedisCache] Connections should not be shared by daemon threads 2020-08-13 22:51:22 +03:00
Alexei Sorokin
cb7effca05 [Memcached] Do not set persistent connections for daemons 2020-08-13 22:51:22 +03:00
Alexei Sorokin
8745a3e824 [Embed] Fix a query typo in fixup_files.php
Regression introduced in ec86de2bc4
2020-08-13 22:51:22 +03:00
Alexei Sorokin
2109c7b830 [Bookmark] Silence a warning when no tags in BookmarkForm 2020-08-12 13:19:59 +03:00
Alexei Sorokin
629857d3ef [Bookmark] Fix undefined variable "rendered" in Activity options 2020-08-12 13:12:36 +03:00
Alexei Sorokin
14e2621a05 [RSSCloud] Avoid the deprecated in PHP each() function 2020-08-11 19:40:46 +03:00
Alexei Sorokin
2abe910ff5 [RSSCloud] Update schema definition 2020-08-11 18:23:45 +03:00
Alexei Sorokin
535b87bb64 [RedisCache][DiskCache] Check if unserialize succeeded 2020-08-10 11:12:31 +03:00
Alexei Sorokin
e63c0d1b03 [TwitterBridge] Check if Notice::$lat and Notice::$lon are defined 2020-08-10 10:35:45 +03:00
Alexei Sorokin
07b0aa8f52 [DATABASE] Fix remaining misuses of SQL's GROUP BY 2020-08-10 19:29:04 +03:00
Alexei Sorokin
7cb10b71bb [RequireValidatedEmail] Only check current user posts
This check made registration impossible when welcomeuser didn't have validation
as well.

And rename the "grandfatherCutoff" option to "exemptBefore".
"Grandfathering" is a relatively obscure term linked to the history of the
United States of America, so replace that with something self-descriptive.
2020-08-09 23:58:25 +03:00
Alexei Sorokin
042e4b070c [EmailAuthentication] Check if e-mail with filter_var 2020-08-09 20:35:31 +03:00
Alexei Sorokin
b20c0bdec7 Clean Notice_prefs and Fave_tally when a notice is deleted 2020-08-08 12:22:35 +03:00
Alexei Sorokin
0a6bb5190f [ExtendedProfile] Clean up of missing array indices handling 2020-08-07 11:59:17 +03:00
Alexei Sorokin
cf353f8829 [TwitterBridge] Do not fail on missing notice 2020-08-07 11:42:21 +03:00
t3nma
22d650469b [TwitterBridge] Fix issue "Only variables should be assigned by reference"
From the docs: "The new operator returns a reference automatically, so
assigning the result of new by reference is not allowed as of PHP 7.0.0"
2020-08-06 17:25:27 +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
09c3236afc [TheFreeNetwork][fix_duplicates.php] Don't die because you couldn't federate an undo follow 2020-08-04 13:03:33 +01:00
Alexei Sorokin
e206995268 Set HTTP status codes with http_​response_​code() 2020-08-04 14:12:17 +03: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
20be1d179a [OpenID][DATABASE] Store UNIX timestamps as BIGINT 2020-07-31 18:40:53 +03: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
0bfa747382 [DATABASE] Fix index identifiers and clean up redundant ones 2020-07-31 16:12:48 +03:00
t3nma
be3c4263b3 [DirectMessage] Update ApiDirectMessageNew action
- Messages are now saved as Notices
2020-07-29 17:50:29 +01:00
t3nma
f00852a619 [DirectMessage] Update ApiDirectMessage action
- getMessages() is now fetching from the Notice table as supposed
- every show{format}* method is properly updated to use Notice objects
- json and xml responses retrieve multi-recipients without compromising
  backwards compatibility
2020-07-28 05:49:37 +01:00
t3nma
83df8848c8 [DirectMessage] Update inboxMessages() to stop fetching replies
This is yet to be supported in the plugin.
2020-07-28 05:48:43 +01:00
t3nma
99183ce4e2 [DirectMessage] PSR12-format 2020-07-28 04:46:10 +01:00
Alexei Sorokin
434ce56e33 [DOCUMENTATION] Adopt PSR-12 and clarify on arrays 2020-07-27 19:19:42 +03:00
Alexei Sorokin
ec86de2bc4 [DATABASE] Update "modified" in Managed_DataObject instead of a DBMS trigger
Instead of relying on the MariaDB's ON UPDATE CURRENT_TIMESTAMP trigger update
"modified" attributes in Managed_DataObject. Every raw query that needs
adjusting is adjusted, as they won't update "modified" automatically anymore.

The main goal behind this change is to fix "modified" updates on PostgreSQL.
2020-07-27 19:10:33 +03:00
Alexei Sorokin
341f3d0ea5 [DATABASE] Fix more incorrect uses of quotation in SQL 2020-07-26 15:28:05 +03:00
Diogo Cordeiro
0def5f1dca [ActivityPub][Explorer] More robust exception handler for invalid remote answers 2020-07-23 15:54:40 +01:00
Alexei Sorokin
ac94374f48 [RemoteFollow] Fix location display 2020-07-22 19:49:24 +03:00
Alexei Sorokin
f9e38c1a8d [LRDD] Fix unhandled bad data in HostMeta, LinkHTML and WebFinger 2020-07-22 01:30:04 +03:00
Diogo Cordeiro
6db56cc949 [ActivityPub][AProfile] Complete strict typing 2020-07-21 23:22:07 +01:00
Alexei Sorokin
7081720ecb [DATABASE] Check SQL boolean values with "IS TRUE"
This way UNKNOWN (NULL) explicitly turns to FALSE when three-valued logic is
reduced to binary.
In pgsqlschema, however, use "IS FALSE" as boolean attributes in pg_index are
non-nullable, there is no outer join and there's no clear preference for NULL
reduction.

Over-complicated constructions in TagCloud queries have been simplified, which
should not affect their performance.

Additionally, in TagCloud's lib/subscriptionspeopleselftagcloudsection.php
a typing mistake in an equi-join of "profile_tag" and "profile_list" on
"tagger" was fixed.
That regression was introduced in f446db8e2a
2020-07-21 18:06:39 +03:00
Diogo Cordeiro
f7ded4d87b [UserFlag] Fix type of onUserRightsCheck 2020-07-21 13:37:36 +01:00
Diogo Cordeiro
67780ca4a9 [UserFlag] Increase strict typing of main file
Run php-cs-fixer
Correct case of class name onDeleteRelated event handlers
2020-07-21 12:43:52 +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
af936f6f8e [Bookmark] Fix misuse of XMLOutputter
Argument 3 passed to htmloutputter::input() must be of the type string or null, array given, called in /srv/gnusocial/plugins/Bookmark/forms/bookmark.php on line 166
2020-07-17 20:56:51 +01:00
Diogo Cordeiro
5512e95e0a [ExtendedProfile] Fix misuse of XMLOutputter
Argument 1 passed to xmloutputter::text() must be of the type string, null given, called in /srv/gnusocial/plugins/ExtendedProfile/lib/extendedprofilewidget.php on line 556
2020-07-17 20:50:16 +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
Alexei Sorokin
08283f6c54 [RedisCache] Catch string return type from Predis\Client::setex 2020-07-06 20:10:12 +03: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
Diogo Cordeiro
1db6943702 [ActivityPub][Inbox] get_all_headers was nginx only 2020-06-26 14:08:47 +01:00
Diogo Cordeiro
e8dff6c4a0 [TESTS] Move AcceptHeader from ActivityPub plugin to Core
Delete temporary ActivityPub tests (they were to be deleted long ago)
2020-06-25 15:50:12 +01:00
Diogo Cordeiro
23ed816035 [ExtendedProfile] Fix XML type bug 2020-06-24 21:44:25 +01:00
Diogo Cordeiro
aa7aff3f6b [TESTS] Fix CommandInterpreterTest
Also corrected a bad refactoring that affected Xmpp plugin test
2020-06-24 13:54:38 +01:00
Alexei Sorokin
194976135f [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.
2020-06-10 16:52:00 +03:00
Alexei Sorokin
0eec6fcfb6 [DATABASE] Replace NOW() with CURRENT_TIMESTAMP 2020-06-09 20:26:06 +03:00
Alexei Sorokin
09a772419a [DATABASE] Use "<>" as an SQL non-equality sign in more cases
A follow-up to commit 644b417f6c
2020-06-08 18:31:22 +03:00
Alexei Sorokin
6c035d01d4 [DATABASE] Start transactions with START TRANSACTION
"BEGIN" is non-standard and unnecessary.
2020-06-08 12:25:01 +03:00
susdiv
97bddc4537 [Autocomplete] Fix postgres incompatible query in AutocompleteAction 2020-06-05 19:14:37 +00:00
susdiv
b8c0fa9fa0 [ActivityPub] Fix Postgres incompatible query in Following and Followed collection 2020-06-05 17:48:21 +00:00
Hugo Sales
7e83ddf80e [FIX] Fix 'Trying to access array offset on value of type null' in AntiBrutePlugin and SimpleCaptchaPlugin when using scripts 2020-05-24 16:55:37 +00:00
tenma
a9be720f09 [OStatus] Remove TFN's deprecated Census event and fix small typo in the code 2020-05-09 11:50:26 +01:00
tenma
d7906f113e [ActivityPub] Remove TFN's deprecated Census event 2020-05-09 11:50:26 +01:00
tenma
cfba91ea43 [OStatus] Add TheFreeNetwork module's support in handling profile insertion
Ostatus_profile:
- Update createActivityObjectProfile to trigger TFN's assistance in inserting the profile
2020-05-09 11:50:26 +01:00
tenma
134b6f6478 [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
2020-05-09 11:50:25 +01:00
tenma
9aedcc7997 [OStatus] Update salmonaction to use the new LRDD's method for grabbing aliases 2020-05-09 11:50:25 +01:00
tenma
35547e28ea [LRDD] Add a new method for grabing profile aliases 2020-05-09 11:50:25 +01:00
tenma
c6543e1f95 [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
2020-05-09 11:50:25 +01:00
Hugo Sales
6c844315aa [CORE] Fix 'Array and string offset access syntax with curly braces is deprecated' in AuthCryptModule and DirectionDetectorPlugin 2020-05-04 10:47:23 +00:00
Alexei Sorokin
872bb1388d [Nodeinfo] Count active users for full days and without silenced 2020-04-17 18:13:05 +03:00
Diogo Cordeiro
e58188d136 [UI] Small improvement on attachment's visual 2020-04-07 13:28:34 +01:00