Commit Graph

5045 Commits

Author SHA1 Message Date
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
Diogo Cordeiro bb32c0af3b [SensitiveContent] Fix plugin settings
Also reformatted the code and minor bug fixed it
2020-04-07 13:28:29 +01:00
nee 63fd2c7037 [SensitiveContent] Add option to activate for not-logged-in visitors
Remove redundant setting retrival code.

An example config.php entry to activate the new config:
$config['site']['sensitivecontent']['hideforvisitors'] = true;
2020-04-07 02:59:35 +01:00
nee 520a2ba202 [SensitiveContent] Don't crash in GNU social classic
When an attachment has no thumbnail (for example when it's a video).
2020-04-07 02:59:30 +01:00
Diogo Cordeiro 6898cff623 [PLUGINS] Remove VideoThumbnails not useful anymore 2020-04-03 12:20:27 +01:00
Diogo Cordeiro f4558e3c41 [ActivityPub] Fix profile url handling 2020-03-28 03:16:24 +00:00
Diogo Cordeiro 073a181778 [ActivityPub] Fix undefined tag index 'type' in Activitypub_notice 2020-02-14 17:25:26 +00:00
Alexei Sorokin e7ab305335 [CORE] Use monotonic time via hrtime() where applicable
The realtime clock is not reliable when calculating elapsed time.
2020-01-07 19:48:13 +03:00
Diogo Cordeiro 60446dfc20 [CORE] Better queues defaults 2019-12-11 02:23:37 +00:00
Diogo Cordeiro dc211c9c44 [ActivityPub][Postman] Fix not sending notices to self 2019-12-11 01:30:25 +00:00
Diogo Cordeiro 27babac6dc [Ostatus] Partially revert 69add504e6
updateuris isn't needed after alll, we should solve this with TFNM and existing infrastructure.
2019-12-11 01:30:15 +00:00
Diogo Cordeiro 3e2b7cddc8 [ActivityPub][RSA] Revision, increase type scrictness and improve docs 2019-12-10 23:51:40 +00:00
Diogo Cordeiro 80ba2b3ccc [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
2019-12-10 23:50:56 +00:00
Diogo Cordeiro b730582336 [CORE] Add GNUSOCIAL_ENGINE_REPO_URL and increase usage of GNUSOCIAL_ENGINE_URL 2019-11-21 00:21:22 +00:00
Alexei Sorokin 562d84c375 [Xmpp] Adjust type declarations for changes in XMPPHP 2019-11-16 20:44:18 +03:00
Diogo Cordeiro 51b5b1c08c [ActivityPub][RSA] Fix types of generate_keys 2019-11-16 15:32:49 +00:00
Diogo Cordeiro ca2dde9a41 [ExtendedProfile] Fix updates and allow to delete values 2019-11-03 19:49:10 +03:00
Diogo Cordeiro e0b17fc97d [REALTIME] Reviewed both the superclass and its dist plugins 2019-11-03 15:37:49 +00:00
Alexei Sorokin 9124617055 [Xmpp] Latin-1 space characters are not forbidden for XMPP resources
Also use mb_strlen() with the 8bit encoding to count octets, strlen() is not as
reliable (mbstring.func_overload).
2019-11-02 13:54:26 +03:00
Alexei Sorokin b312712d1b [Xmpp] Use UnexpectedValueException in splitJid, a bit narrower 2019-11-02 13:29:00 +03:00
Alexei Sorokin 5bc1b8695e [DATABASE] Disable 'NULL' strings evaluation as SQL NULLs
Use $object->sqlValue('NULL') (identical to DataObject_Cast'ing) instead and
fix related issues like (email|sms)settings considering these NULLs as a
false positive for the E-Mail address still being set when it's been removed.

There could also be security implications to the now-disabled approach of
considering 'NULL' strings as SQL NULLs.
2019-11-02 12:21:43 +03:00
Diogo Cordeiro d921f3dadb [ActivityPub] New URI system 2019-11-10 17:47:51 +00:00
tenma 3634af3fdc [TheFreeNetwork] First code: Module class and census event 2019-11-03 00:43:21 +00:00
tenma 69add504e6 [OStatus] Add script for profile deduplication and URI fixing 2019-11-03 00:43:21 +00:00
tenma a0d30b6872 [ActivityPub] Fix some small known problems
ActivityPubPlugin:
- Rework onProfileDeleteRelated to account for the tables _rsa and _pending_follow_requests
- Update onEndShowAccountProfileBlock to stop creating the ap_profile if it doesn't exist (we'll handle this in a different manner)

Activitypub_profile:
- Remove unnecessary code from from_profile method and add return type information

Explorer:
- Update travel_collection to call itself instead of _lookup, that was wrong
2019-11-03 00:43:21 +00:00