Commit Graph

5152 Commits

Author SHA1 Message Date
Diogo Cordeiro 3b01aa31d3 [REALTIME] Reviewed both the superclass and its dist plugins 2021-07-16 19:44:36 +01:00
Alexei Sorokin 0bbcb5b098 [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).
2021-07-16 19:44:35 +01:00
Alexei Sorokin 05f4b1e97d [Xmpp] Use UnexpectedValueException in splitJid, a bit narrower 2021-07-16 19:44:35 +01:00
Alexei Sorokin eab5725698 [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.
2021-07-16 19:44:35 +01:00
Diogo Cordeiro fd68965255 [ActivityPub] New URI system 2021-07-16 19:44:35 +01:00
tenma b19da881c7 [TheFreeNetwork] First code: Module class and census event 2021-07-16 19:44:35 +01:00
tenma 3fb78ab108 [OStatus] Add script for profile deduplication and URI fixing 2021-07-16 19:44:35 +01:00
tenma 6a37c21ead [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
2021-07-16 19:44:35 +01:00
Alexei Sorokin b3c2dfd9c9 [AnonymousFave][DATABASE] Set the created timestamp on INSERT 2021-07-16 19:44:35 +01:00
Alexei Sorokin 0c1e9bbc17 [DAEMONS][TwitterBridge] Set PUBLICDIR 2021-07-16 19:44:35 +01:00
Alexei Sorokin ab020c7528 [COMPOSER] Remove some pre-composer remnants from the code 2021-07-16 19:44:35 +01:00
tenma 234ba7705f [ActivityPub] Fix successive "Cannot use object of type stdClass as array" errors in the postman 2021-07-16 19:44:35 +01:00
tenma 4901126519 [ActivityPub] Revert usage of bitwise-operator & in the inbox_handler class. 2021-07-16 19:44:35 +01:00
Diogo Cordeiro 9088e58a64 [ActivityPub] The protocol allows content to be null, GNU social doesn't, we'll reject silentiously
Reported by kaniini
2021-07-16 19:44:35 +01:00
Diogo Cordeiro 4133874e59 [ActivityPub] attributedTo itself is not required, if not present then it should be inferred from the actor
Reported by kaniini
2021-07-16 19:44:35 +01:00
Diogo Cordeiro b7ce5b91a4 [ActivityPub] Fix security issue concerning remote profile deletes
Reported by kaniini
2021-07-16 19:44:35 +01:00
Diogo Cordeiro 48eee0e018 [ActivityPub] Inbox Handler: Remove old guzzle import
Improve exception information in doc blocks
2021-07-16 19:44:35 +01:00
Diogo Cordeiro 174733edc8 [ActivityPub] Slightly increase robustness on exception handling
Also ported Activitypub_rsa to PHP7
Minor indentation fixes
2021-07-16 19:44:35 +01:00
Diogo Cordeiro c93049d0da [ActivityPub] Consistent headers in explorer requests
Minor indentation fixes
2021-07-16 19:44:35 +01:00
Miguel Dantas 9692150c23 Fix 'Call to a member function getPayload() on null'
Trying to enable the RedisCache with the latest nightly, getting this with the daemon:

sep 25 11:40:18 friedrich startdaemons.sh[21428]: PHP Fatal error:  Uncaught Error: Call to a member function getPayload() on null in /var/www/social/plugins/RedisCache/RedisCachePlugin.php:96
sep 25 11:40:18 friedrich startdaemons.sh[21428]: Stack trace:
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #0 /var/www/social/lib/util/event.php(89): RedisCachePlugin->onStartCacheSet('gnusocial:herds...', Object(HubSub), NULL, 86400, false)
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #1 /var/www/social/lib/cache/cache.php(202): Event::handle('StartCacheSet', Array)
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #2 /var/www/social/classes/Memcached_DataObject.php(520): Cache->set('gnusocial:herds...', Object(HubSub))
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #3 /var/www/social/classes/Memcached_DataObject.php(52): Memcached_DataObject->encache()
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #4 /var/www/social/classes/Managed_DataObject.php(50): Memcached_DataObject::getClassKV('HubSub', 'hashkey', 'a38b9dc516371af...')
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #5 /var/www/social/plugins/OStatus/classes/HubSub.php(47): Managed_DataObject::getKV('hashkey', 'a38b9dc516371af...')
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #6 /var/www/social/plugins/OStatus/lib/hubprepqueuehandler.php(68): HubSub::getByHashkey('https://herds.e...', 'https://raki.so...')
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #7 /var/www/social/plugins/RedisQueue/classes/RedisQueueManager.php(58): HubPrepQueueHandl in /var/www/social/plugins/RedisCache/RedisCachePlugin.php on line 96
Sign in to j
2021-07-16 19:44:35 +01:00
Alexei Sorokin 0fac7e49e2 Fix minor git merge resolving issues 2021-07-16 19:44:35 +01:00
Alexei Sorokin 1ba3416cd1 [SCRIPTS] Set PUBLICDIR in plugin scripts as well 2021-07-16 19:44:35 +01:00
Diogo Cordeiro 344db5dcdf [ActivityPub] Add missing parenthesis in class instantiation
Fixed some issues related to thrown exceptions in the doblocks; also boolean -> bool
2021-07-16 19:44:35 +01:00
Alexei Sorokin 5f87c14bf8 [ActivityPub] Fix an unhandled error in onStartGetProfileFromURI 2021-07-16 19:44:35 +01:00
Diogo Cordeiro d0e3f9c823 [ActivityPub] Fix some bugs with onStartNoticeSearch
Refactored Activitypub_profile::ensure_web_finger to Activitypub_profile::ensure_webfinger
Do not throw exceptions in the handling of this event because we don't
want to stop the regular search just because we were unable to find
ActivityPub actors or notes.
2021-07-16 19:44:35 +01:00
Diogo Cordeiro acd64ba54a [BugFix] Plugins ExtendedProfile and OverwriteThemeBackground - admin is identical to system path names. 2021-07-16 19:44:35 +01:00
Alexei Sorokin 8e9db78258 [OStatus] The unsubscribe state also needs a label 2021-07-16 19:44:35 +01:00
Diogo Cordeiro ee405df000 [MODULES] Make disable in admin panel effective 2021-07-16 19:44:35 +01:00
Alexei Sorokin 16b5ddd230 [DATABASE] Re-introduce PostgreSQL support 2021-07-16 19:44:35 +01:00
Alexei Sorokin 37e5983aca [DATABASE] Columns not in GROUP BY must not be queried 2021-07-16 19:44:35 +01:00
Alexei Sorokin 0e0c375e65 [DATABASE] Re-introduce the enum type abstraction 2021-07-16 19:44:35 +01:00
Alexei Sorokin 6b4344968d [DATABASE] Set all primary keys as "not null" explicitly 2021-07-16 19:44:35 +01:00
Alexei Sorokin 2b0251213f [DATABASE] Various table schema related fixes 2021-07-16 19:44:35 +01:00
Alexei Sorokin 3f17a0efea [DATABASE] Introduce a bool type in schema
PostgreSQL has a clear distinction between integers and booleans, so it makes
sense to draw a clear line.
2021-07-16 19:44:35 +01:00
Alexei Sorokin 9d87c37ac1 [DATABASE] Consistently use the "LIMIT $limit OFFSET $offset" syntax
The "LIMIT $offset, $limit" syntax is only supported by MySQL and MariaDB.
2021-07-16 19:44:35 +01:00
Alexei Sorokin 60ada8ae65 [DATABASE] Use time intervals in a SQL standard compliant way 2021-07-16 19:44:35 +01:00
Alexei Sorokin 6095a6de64 [DATABASE] Only use single quotation marks for SQL strings
Double quotation marks are only used for identifiers in the SQL standard.
2021-07-16 19:44:35 +01:00
Alexei Sorokin 6fae840ee7 [DATABASE] Set NULL in DB_DataObject in a more reliable manner
Also stop assuming that FeedSub::sub_state (enum) and FeedSub::sub_end
(datetime) can possibly be set to an empty string.
2021-07-16 19:44:35 +01:00
Alexei Sorokin d26aac77b3 [DATABASE] Always quote identifiers
The code used to operate under the assumption that MariaDB doesn't support
quoting identifiers. Not only is that not exactly true, but MariaDB has
reserved keywords that cannot be used as table or column names unquoted.
2021-07-16 19:44:35 +01:00
Miguel Dantas cb412d228c [OpportunisticQM] Revamped plugin to be able to use other poll based queuemanagers, no just the DB 2021-07-16 19:44:35 +01:00
Miguel Dantas b0e10f01cb [StompQueue] Changed StompQueueManager to use polling rather than sockets 2021-07-16 19:44:34 +01:00
Miguel Dantas 7cdd64f594 [PLUGINS] Added UnQueue, a new default plugin which does all actions immediately 2021-07-16 19:44:34 +01:00
Miguel Dantas 333b915740 [PLUGINS] Added DBQueue plugin 2021-07-16 19:44:34 +01:00
Miguel Dantas e3c34c4693 [PLUGINS] Added StompQueue plugin, based on the implementation in lib/queue/stompqueuemanager. Updated to new STOMP library version. Dropped liberalstomp.php and stompqueuemanager.php 2021-07-16 19:44:34 +01:00
Miguel Dantas 3fbf974dad [PLUGINS] Added RedisQueue 2021-07-16 19:44:34 +01:00
Miguel Dantas ab3e8ce21d [LIB_REFACTOR] Fix requires 2021-07-16 19:44:34 +01:00
Miguel Dantas 2ab2e22a36 [LIB_REFACTOR] Moving files into separate semantic categories 2021-07-16 19:44:34 +01:00
Miguel Dantas 5e16606358 [RedisCache] Fix call to getPayload on int. The library is badly documented, but seems to return the TTL instead of the normal redis response
Issue description as reported by aab:

About one day after enabling redis plugin:

PHP Fatal error:  Uncaught Error: Call to a member function getPayload() on int in /var/www/html/plugins/RedisCache/RedisCachePlugin.php:96
Stack trace:
0 /var/www/html/lib/event.php(89): RedisCachePlugin->onStartCacheSet('gnusocial:gatea...', Object(Queue_item), NULL, 86400, false)
1 /var/www/html/lib/cache.php(202): Event::handle('StartCacheSet', Array)
2 /var/www/html/classes/Memcached_DataObject.php(496): Cache->set('gnusocial:gatea...', Object(Queue_item))
3 /var/www/html/classes/Memcached_DataObject.php(416): Memcached_DataObject->encache()
4 /var/www/html/classes/Managed_DataObject.php(620): Memcached_DataObject->update(Object(Queue_item))
5 /var/www/html/classes/Queue_item.php(74): Managed_DataObject->update(Object(Queue_item))
6 /var/www/html/lib/dbqueuemanager.php(75): Queue_item::top(Array, Array)
7 /var/www/html/lib/iomaster.php(287): DBQueueManager->poll()
8 /var/www/html/lib/iomaster.php(161): IoMaster->poll()
9 /var/www/html/scripts/queuedaemon.php(112): IoMaster->service()
10 /var/www/html/lib/spawni in /var/www/html/plugins/RedisCache/RedisCachePlugin.php on line 96
2021-07-16 19:44:34 +01:00
Miguel Dantas ba593bfa39 [Memcached] Fix call to undefined method `close`
Issue description as reported by aab:

Memcached config in config.php:

    addPlugin('Memcached', [ 'servers' => ['127.0.0.1', 11211],
                             'defaultExpiry' => 86400 // 24h
                           ]);

Memcached and php-memchached installed.

The error appears when executing startdaemons.

Log:

    PHP Fatal error:  Uncaught Error: Call to undefined method Memcached::close() in /var/www/html/plugins/Memcached/MemcachedPlugin.php:202
    Stack trace:
    #0 /var/www/html/lib/event.php(89): MemcachedPlugin->onStartCacheReconnect(false)
    #1 /var/www/html/lib/cache.php(273): Event::handle('StartCacheRecon...', Array)
    #2 /var/www/html/lib/spawningdaemon.php(209): Cache->reconnect()
    #3 /var/www/html/lib/spawningdaemon.php(188): SpawningDaemon->resetDb()
    #4 /var/www/html/lib/spawningdaemon.php(118): SpawningDaemon->initAndRunChild(3)
    #5 /var/www/html/lib/daemon.php(168): SpawningDaemon->run()
    #6 /var/www/html/scripts/queuedaemon.php(186): Daemon->runOnce()
    #7 {main}
      thrown in /var/www/html/plugins/Memcached/MemcachedPlugin.php on line 202
2021-07-16 19:44:34 +01:00
Miguel Dantas a99ae06573 [Embed] Fix use of undefined `img_data`
Got error 'PHP message: PHP Notice: Undefined variable: img_data in /var/www/html/plugins/Embed/EmbedPlugin.php on line 544'
2021-07-16 19:44:34 +01:00
tenma fe2168c5ae [ActivityPub] Add support fox search-box profile/notice grabbing
NoticeSearchAction:
- Add new event before finding query matches

ActivityPubPlugin:
- Subscribe new searchNotice event
- Bump minor version number

Activitypub_explorer:
- Update lookup to make remote-grabbing optional
2021-07-16 19:44:34 +01:00
tenma 3392939004 [ActivityPub] Handle DELETE-Person activity
ActivityPubPlugin:
- update grab_notice_from_url to make online grab optional
- subscribe events of user and profile deletion
- bump minor version number

Activitypub_inbox_handler:
- separate handle_delete for delete-note and delete-person

Activitypub_postman:
- add delete-person logic

Activitypub_delete:
- update validation method to check for the "Person" type
- update to_array method to target the activity
2021-07-16 19:44:34 +01:00
tenma 58a9c71391 [AP] Fix subscription events
Both StartSubscribe and StartUnsubscribe had a wrong initial if-condition.
Furthermore, this events were calling Activitypub_profile::from_profile()
which is wrong because it creates the Activitypub_profile object when
the goal is only to check if it exists already.
2021-07-16 19:44:34 +01:00
tenma 6af86536aa [AP] Subscribe RemoteFollow plugin events for allowing following with the remote-follow button 2021-07-16 19:44:34 +01:00
tenma 66c5d17469 [OStatus] Port remote-follow to the RemoteFollow plugin
OStatusPlugin:
- Stop adding the remote-follow button
- Subscribe to required RemoteFollow plugin events
- Drop main/ostatussub route and update urls to the main/RemoteFollowSub route
- Bump plugin minor version number

actions/ostatusgroup,
actions/ostatuspeopletag:
- Update urls to the main/RemoteFollowSub route

lib/util:
- Port required functions from OStatusSubAction and adapt to be used with the new events
2021-07-16 19:44:34 +01:00
tenma 32ae48358d [RemoteFollow] Initial work in the RemoteFollow plugin
lib/default.php
- Add RemoteFollow to the list of default plugins

RemoteFollowPlugin:
- Subscribe events to add the remote-follow button

RemoteFollowInitAction:
- Handles the remote-follow form and getting the redirection url for follow completion

RemoteFollowSubAction:
- Handles the remote profile pulling and actual following
2021-07-16 19:44:34 +01:00
Miguel Dantas 12172f08d7 [DirectMessage] Fixed use of incorrect type which prevented posting notices with only one word 2021-07-16 19:44:34 +01:00
tenma 84ba14426c [AP] Update version info 2021-07-16 19:44:34 +01:00
tenma 13d7c3debe [AP] Prevent postman to include the actor's followers for every sent activity 2021-07-16 19:44:34 +01:00
tenma 738f9cb89c [AP] Support Private Messaging
ActivityPubPlugin:
- Subscribe DirectMessage events

Activitypub_inbox_handler:
- Update handle_create_note to create private messages

Activitypub_postman:
- Add create_direct_note for sending private messages

Activitypub_create:
- Update create_to_array to support the 'directMessage' attribute
- Add isPrivateNote to verify private activities

Activitypub_notice:
- Update create_note to support the 'directMessage' attribute
- Remove isPrivateNote

lib/models:
- Add Activitypub_message, the model in charge of private notes
2021-07-16 19:44:34 +01:00
tenma 3852ad175f [AP] Fix Follow collections
Activitypub_profile:
- Fix subscription-counter getter functions, invalid profiles were being counted

apActorFollowingAction:
- Small rewrite of generate_following, didn't make sense to not use try-catch block

apActorFollowersAction:
- Small rewrite of generate_followers, didn't make sense to not use try-catch block
2021-07-16 19:44:34 +01:00
tenma 83f179989e [AP] Handle unlisted/followers-only notices
Note that this commit isn't intended to add support for sending such notes
in GS. Instead, we handle the reception, storage and direct reply to this
type of notices, in AP.

ActivityPubPlugin:
- Subscribe the event StartNoticeSave to hack answering non-public notes

Activitypub_create:
- Add 'directMessage' attribute to the Create activity, defaulting to false for now
- Update validation method: validate 'directMessage' and add debug

Activitypub_notice:
- Handle incoming unlisted/followers-only notes
- Add support for unlisted-replies
- Add method to verify private (direct) notices

inbox_handler:
- Add handler for CREATE Note
- Prepare logic for private-messaging
- Overall refactor: Class members were continuously being passed as function arguments without need

SharePlugin:
- Stop showing the announce button in non public posts
2021-07-16 19:44:34 +01:00
tenma 0d9606ffbf [AP] Properly target public notices
ActivityPubPlugin:
- Use TO as principal audience, CC as secondary
- Update note validation
2021-07-16 19:44:34 +01:00
Miguel Dantas 4a56a61094 [RedisCache] Added plugin description, fixes 'empty msgid' error 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 8d9b88a8bc [OverwriteThemeBackground] This new plugin will let the admin set a custom background theme independent 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 616858ea89 [ExtendedProfile] Fix Admin menu option 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 5524cf331c [DOCUMENTATION][DEVELOPERS][PLUGINS] Some updates to Plugins doc 2021-07-16 19:44:34 +01:00
Diogo Cordeiro a43c10582f [TagCloud] Add Readme 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 8d848683ad [SearchSub][README] No longer is a default plugin since 8614cd77 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 0c6d94fca8 [SamplePlugin] Review and update with the latest GNU social best practices 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 68db757269 [ConversationTree] Format the plugin, add strict typing and fix docblocks 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 76609d8f37 [OfflineBackup] Fix plugin 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 33ac4aed32 [PLUGINS] Removed OpenX as the service doesn't exist anymore 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 2d7ca37036 [GroupFavorited] Fix plugin 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 3bf010ddd8 [ExtendedProfile] Hide 'Extra fields' from profile when no field was created by the sysadmin 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 9a9fa89a0c [ExtendedProfile] Allow to delete custom profile field 2021-07-16 19:44:34 +01:00
Diogo Cordeiro fd1a7a5e68 [Plugins] Incorporated GNUsocialExtendedProfile as part of ExtendedProfile
Also improved a lot of the plugin and made things in a way it would make sense
2021-07-16 19:44:34 +01:00
Diogo Cordeiro c71fa9099f [GNUsocialProfileExtensions] Fixed plugin 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 9bb6fc3f0d [PLUGINS] Removed GNUsocial{Photo, Photos, Video} as we don't need them anymore 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 3909d49982 [PLUGINS] Removed GeoURL as the service doesn't exist anymore 2021-07-16 19:44:34 +01:00
Diogo Cordeiro a4680524a7 [ForceGroup] Modernized plugin and improved documentation 2021-07-16 19:44:34 +01:00
Diogo Cordeiro 66edc49bcf [ChooseTheme] Fixed plugin 2021-07-16 19:44:33 +01:00
Diogo Cordeiro 0ecf9eb649 [BlankAd] Fixed plugin 2021-07-16 19:44:33 +01:00
Diogo Cordeiro 79cce82e50 [Awesomeness] Fixed plugin 2021-07-16 19:44:33 +01:00
Diogo Cordeiro 20a6f1d4f4 [CORE] Plugin API now extends a new Module API 2021-07-16 19:44:33 +01:00
Diogo Cordeiro c18f26145c [CORE] Move core plugins to a new modules directory
For reference (raised by rozzin in IRC):

* http://foldoc.org/module
* http://foldoc.org/library
* http://foldoc.org/plugin

As noted by XRevan86, modules are not necessarily non-essential.
As we will keep the modules directory in GS root [therefore, near to
plugins/], it is evidenced the difference between both.

This is a simple yet fundamental structural change. It doesn't change
functionality but makes clearer the way we understand GNU social's
internals.
2021-07-16 19:44:33 +01:00
Miguel Dantas 8e7ab891a5 [Embed] Added support for inline images 2021-07-16 19:44:33 +01:00
tenma 0b30d932fc [DirectMessage] Major plugin rework
This commit does the necessary rework to store private messages
as Notices and to support Federation. The plugin's README presents
some more detail about the changes and future work that is still
required to do.
2021-07-16 19:44:33 +01:00
Miguel Dantas 9ab13191af [Embed] Added support for inline images 2021-07-16 19:44:33 +01:00
Miguel Dantas bf885fbef8 [Embed] Only resize thumbnail if it's bigger than the desired size 2021-07-16 19:44:33 +01:00
Diogo Cordeiro 3cac110148 [ActivityPub] Move models from 'classes' to 'lib/models' 2021-07-16 19:44:33 +01:00
tenma ec749aa350 [ActivityPub] Fix WebFinger event subscription
ActivityPubPlugin:
- remove reference to the first argument of onEndWebFingerProfileLinks, no need
as it is an object
2021-07-16 19:44:33 +01:00
tenma b4b5d3e009 [ActivityPub] Fix handling of Delete Activity
inbox_handler:
- Call stronger validation method for Delete Activity objects
- Take into account mixed object in handle_delete

Activitypub_delete:
- Add validation method for Delete Activity objects
2021-07-16 19:44:33 +01:00
Diogo Cordeiro 489cab0f87 [ActivityPub] This is the first release of the plugin 2021-07-16 19:44:33 +01:00
tenma 130c839adf [ActivityPub] Use queues for notice distribution
ActivityPubPlugin:
- Change event-based notice distribution to queues logic

ActivityPub/lib:
- Add queue handler class activitypubqueuehandler.php

Misc:
- Add documentation for the (Start/End)InitializeQueueManager events
2021-07-16 19:44:33 +01:00
tenma 081eec3608 [OStatus] Fix notice enqueue
OStatusPlugin:
- Enqueue in the last position, as it should be. No need to worry about
the OMB comment, this protocol no longer have queue handlers that could
cause a conflict.
2021-07-16 19:44:33 +01:00
tenma 20d101e1f2 [ActivityPub] Ensuring federation with other software
ActivityPubPlugin:
- Prevent sending a Delete for an Announce

Activitypub_announce:
- Update announce_to_array to add id, to and cc information to the retrieved object

Activitypub_follow:
- Add id to the arguments of follow_to_array, useful for Accept-Follow activities

Activitypub_notice:
- Fix notice validation, url isn't a MUST

Activitypub_inbox_handler:
- Make handle_follow use the received activity id for the later Accept-Follow

Activitypub_postman:
- Fix call to the updated announce_to_array
- Fix successive unnecessary calls to ActivityPubPlugin::actor_uri()
2021-07-16 19:44:33 +01:00
brunoccast 3472eca45b [ActivityPub] Fix notice creation
Activitypub_notice:
- Perform url test, use id when missing.
2021-07-16 19:44:33 +01:00
brunoccast 37936d101e [ActivityPub] Routes
ActivityPubPlugin:
- Update routes to properly use the updated URLMapper
2021-07-16 19:44:33 +01:00
brunoccast 9de1c34bc0 [ActivityPub] Ensuring notice deletion
ActivityPubPlugin:
- Minor onDeleteOwnNotice rewrite

Activitypub_inbox_handler:
- Add deletion check to incoming notice

Activitypub_postman:
- Call the correct getUrl function
2021-07-16 19:44:33 +01:00
brunoccast 87423a0191 [ActivityPub] Ensuring Notice Favor/Disfavor
ActivityPubPlugin:
- Minor re-write of favor/disfavor event handlers

Activitypub_postman:
like/undo-like:
- fix proper getUrl() call
misc:
- make all activities accumulate errors (may be needed later) and log some information about it
2021-07-16 19:44:33 +01:00
brunoccast 233bdf57ac [ActivityPub] Ensuring notice distribution
ActivityPubPlugin:
- Fix of accepted activity verbs to include SHARES
- Add attention profiles to delivery when announcing

Activitypub_notice:
- New local function to retrieve original URL
- Removal of unnecessary 'Atom*' attributes
- Small fix to the ensuring of actor profile

Activitypub_profile:
- New local function to fetch AP profiles from a collection

Activitypub_postman:
- Fix url passed in the announce activity
2021-07-16 19:44:33 +01:00
brunoccast 25390bf96f [ActivityPub] Caching of Following/Followers interactions and collections
Follow interaction:
- Fixed mini-bug where the subscriber profile was being used as the subscribed
- Updated cache subscription-related values in both instances
- Tested and working with local GS instances

Unfollow interaction:
- Updated cache subscription-related values in both instances
- Tested and working with local GS instances

Followers/Following collections:
- Now returning ActivityPub profiles only
- Stored collections in cache

Misc:
- Fix bug concerning the retrieval of public/private-key after in-function generation
2021-07-16 19:44:33 +01:00
brunoccast 90cb222af5 [ActivityPub] Routes
ActivityPubPlugin:
- Update routes to properly use URLMapper
- Minor updates
2021-07-16 19:44:33 +01:00
Diogo Cordeiro 2f1ddd8280 [CORE] Add ActivityPub plugin
This is not the same as the one in https://notabug.org/diogo/gnu-social-activitypub-plugin
Differences to the first "release"
-> Doesn't use guzzle nor has any composer dependencies
-> Supports HTTP Signatures
-> Has basic l10n/i18n
-> Some minor bug fixes
2021-07-16 19:44:33 +01:00
Miguel Dantas 6bf888b520 [PLUGINS] Dropped Memcache in favor of Memcached. The difference between these is that they use a similarly php library to interact with memcache, but memcached is more modern 2021-07-16 19:44:33 +01:00
Miguel Dantas be1654237d [Memcached] Merged useful features from Memcache 2021-07-16 19:44:33 +01:00
Miguel Dantas ac97efbf21 [PLUGINS] Updated and reviewed the Memcached plugin 2021-07-16 19:44:33 +01:00
Miguel Dantas f689df3e68 [RedisCache] Added README with configuration instructions 2021-07-16 19:44:33 +01:00
Miguel Dantas df468f9605 [RedisCache] Fix use of undefined variable 2021-07-16 19:44:33 +01:00
Miguel Dantas d7c2c98a02 [PLUGINS] Removed direct call of EndCache events on all plugins, as it is now handled by the library 2021-07-16 19:44:33 +01:00
Miguel Dantas d8d7abee9f [CACHING] Imported Chimo's RedisCache plugin and fixed some small parts 2021-07-16 19:44:33 +01:00
Miguel Dantas 19d68c9f8e [COMPOSER] Added predis/predis and updated packages 2021-07-16 19:44:33 +01:00
Miguel Dantas 0bb35d7e7f [LinkPreview] Fix 'no candidate for action "embedproxy"' 2019-08-14 15:32:34 +01:00
Diogo Cordeiro e4bdb21a54 [NodeInfo] New endpoint and formula for computing active users
Seriously improved documentation
Now NodeInfo 2.0 is available at /api/nodeinfo/2.0.json
For active users we now also consider favourites and recently created accounts
Some further minor bug fixes and full review of the implementation
2019-08-12 05:35:27 +01:00
Miguel Dantas 0030fe3aeb [REFACTOR] Added explicit return type to all instances of QueueHandler::handle 2019-08-11 01:11:41 +01:00
Miguel Dantas aaabf82eff [CORE][QUEUE] Error checking and type declaration on handling notice queue events
Patch submitted by XRevan86
2019-08-08 02:44:14 +01:00
Miguel Dantas 52310a8ad8 [Embed] Fixed error related to oembed action 2019-08-07 23:57:40 +01:00
Miguel Dantas dbde8383c9 [Embed] Fixed use of undefined variable in fixup_files script 2019-08-03 17:49:36 +01:00
Miguel Dantas 6d552f15b6 [Embed] Resize thumbnails fetched by Embed to avoid keeping original images when we need only 128x128. Size configurable in config.php 2019-08-03 17:49:36 +01:00
Miguel Dantas ba15724a62 [FORMAT][Embed] Ran php-cs-fixer on Embed's files and small style fixes 2019-08-03 17:49:33 +01:00
Miguel Dantas 5be705ca2a [Embed] Updated fixup_files.php script to be able to fix broken oEmbedinfo using the --broken-oembed flag 2019-08-03 17:49:10 +01:00
Miguel Dantas 07b4cfaeae [Embed] Hide error from the UI and just don't display an image if the remote image is not valid 2019-08-03 17:49:10 +01:00
Miguel Dantas c9379b3608 [Embed] Fix bug where we we're losing track of a file, in case the image needed to be reencoded 2019-08-03 17:49:10 +01:00
Miguel Dantas 22c8c96249 [Embed] Fixed Embed tests 2019-08-03 17:49:10 +01:00
Miguel Dantas d66828c2bf [Embed] Fixed bug where sometimes images were written outside the site root 2019-08-03 17:49:09 +01:00
Miguel Dantas a244f3ba4d [Embed] Removed old oEmbed and OpenGraph implementation 2019-08-03 17:49:09 +01:00
Miguel Dantas 0c20d35206 [Embed] Refactoring and bug fixing 2019-08-03 17:49:09 +01:00
Miguel Dantas 462ea26303 [Embed] Using oscarotero/Embed as first attempt to get oEmbed/OpenGraph data, fallback
to previous implementation otherwise.
2019-08-03 17:49:09 +01:00
Miguel Dantas b25632ebc4 [PLUGINS] Fixed oEmbed dependents to use Embed 2019-08-03 17:49:06 +01:00
Miguel Dantas 2a2b3f72fb [Embed][DB] Renaming the 'file_oembed' table to 'file_embed' on upgrade 2019-08-03 17:48:28 +01:00
Miguel Dantas 52819d39d9 [OEmbed][Embed] Renamed OEmbed plugin to Embed 2019-08-03 17:48:26 +01:00
Diogo Cordeiro 39845444cc [DOCUMENTATION] Update description of extlib and vendor directories 2019-08-03 17:47:27 +01:00
Daniel Supernault 9c0354bbf1 [CORE] Remove function_exists() calls and add up default bcrypt cost to 12. 2019-08-03 17:47:26 +01:00
Daniel Supernault c09f1c2443 [CORE] Add Argon2I support
Add Argon2I support, disabled by default.
2019-08-03 17:47:25 +01:00
Daniel Supernault 912f2c3567 [CORE] Update AuthCryptPlugin
Added password_hash() (bcrypt) support with fallback to crypt() for older PHP versions.
2019-08-03 17:47:25 +01:00
Daniel Supernault ad51998d67 [CORE] Add timing safe backwards compatible password_verify 2019-08-03 17:47:25 +01:00
Diogo Cordeiro 1049080df5 [CORE] Move public resources to a /public directory
Advantages:
* Increases security by preventing direct access to file/
* We are careful and have a defined('GNUSOCIAL') || die() to prevent
  direct access to GS files, but we may miss one or a vendor/extlib may
  not be as careful
* Improves directory structure - It's more natural to physically
  separate what is public from what are GNU social resources
2019-08-03 17:47:25 +01:00
Diogo Cordeiro a1edc2c6a9 [CORE][COMPOSER] Move plugins extlibs to composer (where appropriate) 2019-08-03 17:47:24 +01:00
Diogo Cordeiro 2a06261f75 [CORE][COMPOSER] Move extlib packages with immediate composer correspondent to composer dependencies
This adds a composer.json for all dependencies that are available
2019-08-03 17:47:24 +01:00
brunoccast 0b58465fb9 [CORE] Fix notice delete-form
DeletenoticeAction:
- Added tombstone check before deletion

NoticeListItem:
- Added tombstone check before showing delete-form

ActivityVerb:
- The plugin was overwriting the deletenotice route. Added stronger
regexp to the connected routes.
2019-08-03 17:47:23 +01:00
Miguel Dantas ed7a88ce66 [StoreRemoteMedia] Added documentation for feature which limits the maximum filesize which is kept locally 2019-08-03 17:47:22 +01:00
brunoccast 5c0a3102ff [ROUTES] Allow accept-header specification during router creation
Router:
- Fix calls to connect, most of them were misusing the function's params

URLMapper:
- Minor fixes
- Documentation
- Add support for accept-header specification

Plugins/*:
- Fix calls to connect
2019-08-03 17:47:16 +01:00
Miguel Dantas 7070a14480 [CORE][StoreRemoteMedia] Fixed bug where sometimes images were written outside the site root 2019-08-03 17:31:43 +01:00
Miguel Dantas f746866b65 [StoreRemoteMedia] StoreRemoteMedia now uses the new filename format, which allows it to display correctly in the UI. Formatting fixes 2019-08-03 17:31:42 +01:00
Miguel Dantas 8f31a1a820 [MEDIA][OEMBED] Fixed regression in OEmbed, because it relied on accessing the files directly, which previous commits broke. The File table really should have a bool... 2019-08-03 17:31:42 +01:00
Miguel Dantas da82048d77 [MEDIA] Fix trying to display file wich is not available locally 2019-08-03 17:31:41 +01:00
Diogo Cordeiro f717081893 [OEmbed] Revert filename change introduced with 96ce758c 2019-08-03 17:30:52 +01:00
Diogo Cordeiro 01b5118c6f [Oembed] Refactoring and some improvements (namely documentation)
Imported some changes from postActiv
2019-08-03 17:30:52 +01:00
Diogo Cordeiro d1fc7c0774 [CORE] MySQL 5.5 support fully restored 2019-07-25 15:35:24 +01:00
Diogo Cordeiro 6c8d2e159e [DOCUMENTATION] Plugin events should be declared in the plugin's directory not in the core 2019-07-15 03:25:16 +01:00
Diogo Cordeiro db9bb6b5a1 [OStatus] null being returned instead of an empty array
Fixes: "Invalid argument supplied for foreach" in onEndFindMentions
2019-07-10 00:34:46 +01:00
Diogo Cordeiro 44653d339d [Poll] Refactoring and minor bug fixes 2019-06-23 23:06:04 +01:00
Diogo Cordeiro f2705180e0 [TagSub] Fix User's tags list issue
Issue introduced with 6d9f390b and 9a92b58057
2019-06-18 14:56:55 +01:00
Diogo Cordeiro 3f8593268e [Nodeinfo][TRANSLATION] Fix languages meta-data 2019-06-12 03:25:02 +01:00
Diogo Cordeiro 8ea83aac48 [OStatus] Wrong exception was being caught 2019-06-12 02:20:58 +01:00
Diogo Cordeiro c93547b080 [OpenID] Added support for GS's Internal Session Handler 2019-06-10 16:49:48 +01:00
Diogo Cordeiro 54f75683c7 [OpenID] s/sync/synch
This commit also fixes the translation in /plugins/OpenID/actions/finishopenidlogin.php#L203-L204 (s/Syncronize/Synchronize)
Sync is a bad technical jargon and we should use Synch instead.
Synch is already used in other parts of GNU social as seen in plugins/TwitterBridge/classes/Twitter_synch_status.php
2019-06-10 15:51:56 +01:00
brunoccast 1e4063254b [OpenID] Added synchronization button and corresponding action
UI:
- "Delete" area is now "Actions" area
- Updated themes to better reflect the changes

Routes:
- index.php?action=finishsyncopenid => finishsyncopenid

Translations:
- Updated OpenID translation files
- Updated OpenID POT file

Versioning:
- Bump OpenID minor version
- Bump GS patch version

Why would have labeling the Synchronize button of Sync been of bad taste? - answered by XRevan86:

In "synchronise" "ch" is a digraph meaning /k/ (actually /x/ turned into /k/ in English but whatever).
So… not separate letters.
It's like "ph" in "alphabet", or "sh" in "sheep", or "ch" in "chop" -- "ch" can mean a whole variety of sounds.
2019-06-09 17:04:26 +01:00
brunoccast 69a1d77480 [OpenID] Add sync confirmation in both OpenID settings and login connection 2019-06-09 17:00:06 +01:00
brunoccast c7afe2f86c [TRANSLATION] Update Plugin POs 2019-06-09 16:10:03 +01:00
Diogo Cordeiro 5f4e3fe0eb [TRANSLATION] Update POTs and normalize files 2019-06-08 18:41:10 +01:00
Miguel Dantas fb95af1cf5 Added Spanish, Polish and Esperanto translations to NodeInfo plugin 2019-06-08 18:36:04 +01:00
Diogo Cordeiro 02c67fd114 [Nodeinfo][DATABASE][Usage_stats] Fix wrong type for modified column 2019-06-07 15:02:10 +01:00
Diogo Cordeiro b6be1a3659 [DATABASE][User_openid_prefs] Fix wrong type for modified column
Patch submited by Sorokin Alexei (XRevan86)
2019-06-07 15:02:09 +01:00
Diogo Cordeiro df84ccd916 Nodeinfo has a special rule for upgrades 2019-06-07 15:02:08 +01:00
Diogo Cordeiro 46f98b3142 [VersionBump] 1.19.0, fairly late
The core plugins whose version was attached to GS's were reseted to 2.0.0.

2.0.0 was chosen as reset version for plugins because it is higher than
  the one that was set by inheriting GS version. Furthermore, it's a
  major change from prior plugin versioning system thus it also makes
  semantic sense.

Justification for version bump:

== GS ==
9a4ab31f26 1.19.0
c13b935201 1.18.3
c13b935201 1.18.2
18fc39d2cf 1.18.1
c083a8bcc2 1.18.0
e8783d46d0 1.17.1
d9a42550ff 1.17.0
1536d3ef29 1.16.0
c03ed457a6 1.15.0
d2e6519bad 1.14.2
fe411e8138 1.14.1
b17e0b4169 1.14.0
daa5f87fd4 1.13.0
d75b5d2f4a 1.11.7
f6dbf66983 1.11.6
6cf674f8f8 1.11.5
7845a09b34 1.11.4
e4d432295d 1.11.3
339204f1ee 1.11.2
a4e679a118 1.11.1
7967db6ff5 1.11.0
bc030da320 1.10.1
9cc7df51d6 1.10.0
bf7f17474d 1.9.2
8a07edec5f 1.9.1
0042971d74 1.9.0
6b5450b7e6 1.8.0
5dcc98d1c6 1.7.0
e6667db0cd 1.6.0
3290227b50 1.5.0
a59c439b46 1.4.0
496ab8c920 1.3.10
986030060b 1.3.9
1d529c021a 1.3.8
f89c052cf8 1.3.7
38f2ecefac 1.3.6
e473937cb9 1.3.5
9a39ebe66f 1.3.4
ddc3cecfc0 1.3.3
2b43d484eb 1.3.2
e8e487187e 1.3.1

== Plugins ==
XMPP plugin
e0887220b0 bump patch
e186ad57d0 bump patch

OStatus
e186ad57d0 bump patch

Nodeinfo
ceae66a30f bump minor
586fb5a517 bump major
195296846e bump minor
2019-06-07 15:02:08 +01:00
brunoccast 43df2d201c Extend Action with redirect after login logic, update some actions to use it 2019-06-07 15:02:07 +01:00
brunoccast 691df04103 PSR2-format 2019-06-07 15:02:07 +01:00
Diogo Cordeiro 2e9fa8f4b7 [DOCUMENTATION] Reorganize documentation 2019-06-05 22:48:28 +01:00
Guillaume Hayot d7adc4e13f
Changing URI to community plugins page 2019-05-26 20:40:36 +02:00
Guillaume Hayot c13b935201
Removing community plugins 2019-05-26 20:34:47 +02:00
Diogo Cordeiro ceae66a30f [Nodeinfo] Fix twitterimport enabled check 2019-05-11 20:52:02 +01:00
Diogo Cordeiro 1536d3ef29 [XML/HTML Outputter] General improvements and refactoring as well as some bug fixes 2019-05-07 15:57:19 +01:00
Diogo Cordeiro 688fa4839c [Nodeinfo] Correct HELP info on fix_stats.php 2019-05-06 23:27:38 +01:00
Diogo Cordeiro 7845a09b34 RSVP asHTML throws a pretty exception that should go out of the div, by XRevan86 2019-04-26 23:08:16 +01:00
Diogo Cordeiro e4d432295d Only variables should be assigned by reference
caught by XRevan86
2019-04-26 23:03:37 +01:00
Diogo Cordeiro a4e679a118 Add Registration form hook points by XRevan86 2019-04-26 00:59:38 +01:00
Diogo Cordeiro 195296846e Add russian translation to NodeInfo plugin by XRevan86 2019-04-26 00:43:58 +01:00
Diogo Cordeiro 7967db6ff5 Various obvious bug fixes and better PHP 7 support
Many of these came from a XRevan86 patch
2019-04-26 00:34:17 +01:00
Diogo Cordeiro c4f962a7d0 Fix wrong path on Realtime cleanupchannels script by XRevan86 2019-04-25 23:12:58 +01:00
Diogo Cordeiro bc030da320 Fix undefined variables on Favorite plugin by XRevan86 2019-04-25 23:12:58 +01:00
Diogo Cordeiro 9cc7df51d6 Some obvious bug fixes for i18n 2019-04-25 23:12:46 +01:00
Diogo Cordeiro fc4aa470b2 StoreRemoteMedia - removeRemoteMedia script - Add missing newline in bad limit error 2019-04-23 22:11:29 +01:00
Diogo Cordeiro 586fb5a517 Faster NodeInfo stats 2019-04-22 20:03:28 +01:00
Diogo Cordeiro e186ad57d0 OStatus and XMPP plugins now inform Nodeinfo plugins about their activity 2019-04-22 07:28:45 +01:00
Diogo Cordeiro e6667db0cd Add chimo's Nodeinfo plugin as a default GNU social plugin 2019-04-22 06:50:28 +01:00
Diogo Cordeiro e0887220b0 XmppPlugin - Fix preg_match() - Compilation failed
Disallowed Unicodecode point (>= 0xd800 && <= 0xdfff)
2019-04-21 17:13:07 +01:00
Diogo Cordeiro 3290227b50 Modern version of XMPPHP extlib
Original XMPPHP is no longer maintained
Therefore I've done some optimizations and imported some commits from birkner and zorn-v forks.
None of the forks really looked ready to be adopted...
2019-04-21 17:13:07 +01:00
Diogo Cordeiro 7b6c887d76 OStatus plugin - Merge some bug fixes by XRevan86 2019-04-20 23:27:46 +01:00
Diogo Cordeiro 0df8531834 Fix typo on 986030060b 2019-04-19 21:16:42 +01:00
Diogo Cordeiro 986030060b XMPPHP - Fix string as array usage errors on PHP 7 2019-04-19 15:56:51 +01:00
Diogo Cordeiro 2d20656e22 [StoreRemoteMedia] script removeRemoteMedia.php was trying to remove already removed files
Sometimes different posts are associated with the same file, that case wasn't considered
Thanks to XRevan86 for spotting this issue.
2019-04-18 01:03:09 +01:00
Diogo Cordeiro 98ebe1f63b [StoreRemoteMedia] script removeRemoteMedia.php was deleting every file posted without being via web interface
Added two more options: delete image-only attachments; delete previews (like oembed thumbs)
Some further minor improvements.
Thanks to colegota for spotting this issue.
2019-04-17 02:05:04 +01:00
Diogo Cordeiro 8c9efff1ac Merge branch 'issue-326' into 'master'
Script for removing remote files until a given date

See merge request diogo/gnu-social!5
2018-09-14 21:33:54 +00:00
Chimo 2b43d484eb UserFlag: Pass proper profile to FlaggedProfileListItem
Fixes #333
2018-08-16 19:16:15 -04:00
Diogo Cordeiro 4211206e3b Script for removing remote files until a given date 2018-08-09 17:26:05 +01:00
mmn ffe14fe5f3 Merge branch 'nightly' into 'nightly'
fixed hard coded twitter char limit

See merge request gnu/gnu-social!154
2017-12-17 17:41:14 +00:00
mmn c285f80b18 Merge branch 'cas-user-whitelist' into 'nightly'
Added CAS user whitelist feature

See merge request gnu/gnu-social!142
2017-12-17 17:38:21 +00:00
mmn 1e1543dd72 Test if $casSettings['user_whitelist'] is an array - and then perform in_array(...) instead of just checking if it's != null. 2017-12-17 17:37:24 +00:00