Commit Graph

240 Commits

Author SHA1 Message Date
Diogo Peralta Cordeiro 1c9f807595
[Embed] Fix some bugs and change AttachmentEmbed::url to ::media_url 2021-09-14 13:12:56 +01:00
Diogo Peralta Cordeiro c9090e6cee
[ATTACHMENTS][GSFile] Rename ValidateAndStore functions 2021-09-14 13:12:56 +01:00
Hugo Sales 6d31945401
[ATTACHMENTS] In sendFile, check that file exists or show a custom exception 2021-09-14 13:12:56 +01:00
Hugo Sales e9a96f1c9b
[DOCUMENTATION] Add high level code walkthrough to developer docs 2021-09-14 13:12:55 +01:00
Hugo Sales 7509913fcf
[ENTITY] Add field size to attachments, used for quota calculations 2021-09-14 13:12:54 +01:00
Hugo Sales be91fb754d
[CORE] Typo in GSFile and slight Twig weirdness in base template 2021-09-14 13:12:52 +01:00
Hugo Sales b1e514832b
[Embed][ENTITY] Fix embed route and use attachment_view rather than _show. Rename Entity::have to Entity::has, because grammar 2021-09-14 13:12:52 +01:00
Hugo Sales 2adb3c3521
[ATTACHMENTS] Add event 'AttachmentFileInfo' to allow a plugin to override the file displayed 2021-09-14 13:12:52 +01:00
Hugo Sales 7adc198a52
[ENTITY] Add meta method 'have*' to Entity base class, which checks if a field 'isset' 2021-09-14 13:12:51 +01:00
Hugo Sales 34059a8d3d
[ATTACHMENTS][EVENT] Add onHashFile event, which can be used to deduplicate files
Currently, we simply hash the contents of the file with sha256, but in the future we can use something smarter,
which could find visual feature similarity between images
2021-09-14 13:12:51 +01:00
Hugo Sales 5c78def973
[HTTPClient] Add utility functions for all HTTP methods 2021-09-14 13:12:23 +01:00
Hugo Sales 1b8f5b7bf0
[DB] Make DB::findOneBy throw a different exception if two values are found 2021-09-14 13:12:23 +01:00
Hugo Sales e94df546c3
[Posting] Extract and store URLs from note content. Introduce 'AttachmentStoreNew' event 2021-09-14 13:12:23 +01:00
Hugo Sales 7a90e844b7
[SECURITY][DB] Make user register 'atomic', by using a single transaction for inserting all objects, to avoid partial inserts 2021-09-14 13:12:23 +01:00
Hugo Sales e1995f44ce
[ATTACHMENTS] Move thumbnail controller to core and cleanup 2021-09-14 13:12:22 +01:00
Diogo Peralta Cordeiro e385a9ac29
[ATTACHMENTS] Even more further refactoring
Introduce Encoder plugins Instead of abstract upload and thumb modules

Ported attachment routes. In v3 thumbnail depends on existing attachment
so route updated accordingly.
2021-09-14 13:12:18 +01:00
Diogo Peralta Cordeiro 0eaccc32fe
[ATTACHMENTS] Further refactoring
Some key points:
- Components and Plugins shouldn't extend Module directly
- Avatars should be fetched via GSActor ID, not by nickname as that isn't unique
- Avatar now is a separate Component
- Common file utilities are now to be placed in Core\GSFile, this will
  handle storage and trigger validation
- Some bug fixes
2021-09-14 13:11:51 +01:00
Hugo Sales 19850b5e0d
[DB] Fix bug in custom criteria format wrangling 2021-09-14 13:11:51 +01:00
Hugo Sales 7284c833a6
[DB] Allow DQL queries with table name rather than entity 2021-09-14 13:11:50 +01:00
Hugo Sales 0d01f1d060
[CORE] Add functionality to App\Core\Controller to get and validate GET parameters 2021-09-14 13:11:50 +01:00
Hugo Sales dc5bdfa1fb
[CORE] Rename NoteScope to VisibilityScope, as it will be used for attachment visbility too 2021-09-14 13:11:50 +01:00
Hugo Sales 9659762726
[DB] Add table map which allows using table names rather than entities in Doctrine operations 2021-09-14 13:11:50 +01:00
Hugo Sales 566c7694b5
[CONFIG][TWIG] Move twig config to php code to add support for placing templates in modules (plugins and components) 2021-09-14 13:11:49 +01:00
Hugo Sales 299bc5b551
[TWIG] Add way to launch events from TWIG, capture service and add way to render from a string 2021-09-14 13:11:49 +01:00
Hugo Sales 1687ecaa24
[FAVOURITE] Temporary commit to fix exception in timeline 2021-09-14 13:11:48 +01:00
Diogo Peralta Cordeiro ccf3aa990a
[MODULES] Introduce the concept of abstract modules to V3
Introduce placeholder for abstract upload and thumb modules
Temporarily supress some bugs
2021-09-14 13:11:45 +01:00
Hugo Sales faa362e2e2
[DB] Remove unique constraint from GSActor.nickname and fix register and related functionality 2021-09-14 13:10:23 +01:00
Hugo Sales 78548365da
[WEB] Fix translations and small inconsistency when opening on web 2021-09-14 13:10:23 +01:00
Hugo Sales 8b5bd40421
[TESTS] Add tests to all relevant methods under App\Util and fix errors that popup 2021-09-14 13:10:23 +01:00
Hugo Sales dc2a453e94
[TESTS] Add tests of Common and fix small oddities that pop up 2021-09-14 13:10:22 +01:00
Hugo Sales 8d25859de7
[LOG] Only try to log if setup, so logs can be disabled, in tests, for instance 2021-09-14 13:10:22 +01:00
Hugo Sales 7e648a296f
CACHE] Fix cache implementation with the help of tests and remove premature optimization for non-redis list caching
This complicated the code significantly and likely didn't help that much, if at all. The recommended setup is using Redis, anyway, which is plenty optimized
2021-09-14 13:10:22 +01:00
Hugo Sales 1028f05cd8
[TESTS] Fix unkept unit tests 2021-09-14 13:10:21 +01:00
Daniel ffb4b9df23
[Poll] Added modified param for Poll/Poll response, added PollTest 2021-09-14 13:10:12 +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 74e586182d
[DB] Merge definition of SchemaDefDriver with SchemaDefPass for clarity 2021-09-14 13:06:56 +01:00
Hugo Sales e8feb2ae84
[DOCUMENTATION][REFACTOR] Add documentation to all flagged function and do some small cleanup 2021-09-14 13:06:55 +01:00
Hugo Sales 1949e0b987
[EVENT] Rename event names to camel case to make finding handlers easier 2021-09-14 13:06:55 +01:00
Hugo Sales 44f51ce715
[CONFIG][CACHE] Move cache configuration from environment variables to the configuration file 2021-09-14 13:06:54 +01:00
Hugo Sales e949dd654a
[CONFIG] Various fixes to use new configuration format 2021-09-14 13:06:54 +01:00
Hugo Sales dd40255c4a
[CONFIG][DB] Remove config from the database, put it in yaml, so it can be baked into the container 2021-09-14 13:06:53 +01:00
Hugo Sales 46f1cf9529
[CORE] Add missing use statement in module base class 2021-09-14 13:06:53 +01:00
Hugo Sales 147ff89e74
[NoteAction] Refactor duplicated code out to base class 2021-09-14 13:06:53 +01:00
Hugo Sales 63d2d58e9e
[EXCEPTION] Make findOne return NotFoundException 2021-09-14 13:06:52 +01:00
Hugo Sales c0ce25c352
[MODULES] Fix module manager dev-mode rebuild 2021-09-14 13:06:52 +01:00
Hugo Sales 2164f21834
[Controller] Fix exception handler to recurse on the exception's previous (in some contexts, RedirectException gets wrapped) 2021-09-14 13:06:52 +01:00
Hugo Sales ffcf909bda
[UTIL] Update bitmap base class, making using easier 2021-09-14 13:06:52 +01:00
Hugo Sales 5fc7647c40
[MODULE][DB] Added support for loading entity definitions from modules 2021-09-14 13:06:51 +01:00
Hugo Sales b906dde059
[EXCEPTION][UI][UX] Add RedirectException, which can be thrown anywhere to redirect somewhere, and an exception handler 2021-09-14 13:06:51 +01:00
Hugo Sales e1181ab998
[DB][DEFAULTS] Change attachment storage location from uploads to attachments 2021-09-14 13:06:49 +01:00
rainydaysavings a9d5f8ac5b
[UI][TWIG] Fixing note actions placement and size, more descriptive rules 2021-09-14 13:06:49 +01:00
Hugo Sales 07078414bb
[FORM] Add names to forms 2021-09-14 13:06:48 +01:00
Hugo Sales 80cefca90d
[DB] Add wrapper for making native queries 2021-09-14 13:06:48 +01:00
Hugo Sales 5b7fcc44cf
[DB] Add helper for removing entities 2021-09-14 13:06:47 +01:00
Hugo Sales ea4f2c522b
[DB] Add support for calling methods with FQCN 2021-09-14 13:06:47 +01:00
Hugo Sales 0b50905ac8
[NOTE][UI] Add note replying and UI displaying 2021-09-14 13:06:45 +01:00
Hugo Sales 459f0bf41f
[CACHE] Fix bug in list caching 2021-09-14 13:06:45 +01:00
Hugo Sales a5cf89674e
[DEPENDENCY] Add tgalopin/html-sanitizer-bundle and transitively tgalopin/html-sanitizer 2021-09-14 13:05:57 +01:00
Hugo Sales 9159fe8d05
[CONTROLLER] Stop propagation of kernel.controller so notices aren't posted 5 times. Not sure why it happens otherwise 2021-09-14 13:05:56 +01:00
Hugo Sales 6f01b0cebe
[WRAPPER][HTTPClient] Static wrapper around Symfony's HTTP Client 2021-09-14 13:05:56 +01:00
Hugo Sales 44d4aade95
[DB][DEFAULTS] Add avatar/default 2021-09-14 13:05:55 +01:00
Hugo Sales 8cfa883c1b
[DB] Add 'dql' method to wrap 'createQuery' and replace 'Gsactor' with 'GSActor' 2021-09-14 13:05:55 +01:00
Hugo Sales e1002eb605
[MEDIA] Move avatar fetching and adding to ouput to media component 2021-09-14 13:05:55 +01:00
Hugo Sales 213cfe5285
[COMMAND] Fix 'bin/console doctrine:database:create' by only loading defaults if we have a connection 2021-09-14 13:05:54 +01:00
Hugo Sales 8716d700a6
[CORE][DB] Fix uses of db tables after previous restructure 2021-09-14 13:05:53 +01:00
Hugo Sales cd89cf04ff
[ROUTES] Add redirect from root to main/all, link from header to root, and change parameter order on RouteLoader::connect 2021-09-14 13:05:52 +01:00
Alexei Sorokin eb12ac5ef1
[DATABASE] Enable fulltext search by default
Also rename fulltext indices to more fitting names

Imported from v2/f84dbb369f01a1d4a9bc362d01cdd100cdc79313
2021-09-14 13:05:51 +01:00
Hugo Sales 4128a5403d
[MEDIA][EXCEPTIONS] Fix errors and deprecations 2021-09-14 13:05:51 +01:00
Hugo Sales 6438092d86
[AVATAR] Update way avatar is sent, to use proper symfony responses, make config('site', 's_static_delivery') into a boolean 2021-09-14 13:05:51 +01:00
Hugo Sales bd8f4bd277
[AVATAR] Fixed avatar upload, added avatar inline download and updated template and base controller 2021-09-14 13:05:51 +01:00
Hugo Sales 0ab6c2ef54
[DB] Add entity base class to allow sharing methods such as 'create' 2021-09-14 13:05:50 +01:00
Hugo Sales 4ba71426b6
[MODULE] Reload modules if modified, except in production environment 2021-09-14 13:05:48 +01:00
Hugo Sales 62e093c650
[EVENT][ROUTES] Add event to allow modules to add routes, 'add_route' 2021-09-14 13:05:47 +01:00
Hugo Sales 152828ed68
[FRAMEWORK] Avoid double initializing the framework 2021-09-14 13:05:47 +01:00
Hugo Sales aac653d2bd
[EVENT] Fix event handler and rename events to snake_case 2021-09-14 13:05:47 +01:00
Hugo Sales bc9de1c0fa
[MODULE] Added module base class 2021-09-14 13:05:47 +01:00
Hugo Sales 292c9dc862
[COMPOSER][MODULE] Add autoloading rules for components and plugins 2021-09-14 13:05:46 +01:00
Hugo Sales 04e31d273d
[MAIL] Make mailserver a required service 2021-09-14 13:05:46 +01:00
Hugo Sales 93f576679c
[FORM] Add Form::handle which automagically creates a form, handles a request, and writes the data to the given entity and update Form::create to do some more magic as well 2021-09-14 13:05:45 +01:00
Hugo Sales 22e292276c
[CORE][SECURITY][UX] Save previous url on /register and /logout 2021-09-14 13:05:45 +01:00
Hugo Sales db32a5fcfc
[DATABASE][TOOLS] Update local_user, SchemaDefDriver and bin/generate_entity_fields to use the phone_number type (which maps to a varchar 35 and does validation) 2021-09-14 13:05:44 +01:00
Hugo Sales 17f854b1d9
[CORE][UX] Save previous url to redirect back after registering 2021-09-14 13:05:44 +01:00
Hugo Sales 1e911f1ba4
[FORM] Add Form::isRequired 2021-09-14 13:05:43 +01:00
Hugo Sales 6adb527fe0
[DATABASE] Refactor DB.php and make findBy always return an array, instead of a doctrine collection 2021-09-14 13:05:43 +01:00
Hugo Sales 7c6112b887
[FORM][WRAPPER] Merge argument options, not replace 2021-09-14 13:05:41 +01:00
Hugo Sales 7a7f7d3ae1
[MAILER][WRAPPER] Add mailer wrapper that respects the configuration 2021-09-14 13:05:41 +01:00
Hugo Sales 7c35fde8bc
[FIX] Fix bug in DATABASE.php, since findBy can return different types 2021-09-14 13:05:41 +01:00
Hugo Sales c0da90bd3e
[COMMON][SECURITY][WRAPPER] Added security service static wrapper and Common::getUser 2021-09-14 13:05:41 +01:00
Hugo Sales 97fd7620e7
[CORE][ROUTES] Small refactor on entrypoint and RouteLoader 2021-09-14 13:05:41 +01:00
Hugo Sales cac00dd6d4
[CONTROLLER][ROUTES] Refactor the base Controller to not reinvent the wheel too much and rely on Symfony's events 2021-09-14 13:05:40 +01:00
Hugo Sales 59fcd042e9
[DEFAULTS] Add password hashing algorithm default settings 2021-09-14 13:05:40 +01:00
Hugo Sales 0eba267a73
[LOGIN] Implement password checking and related systems 2021-09-14 13:05:40 +01:00
Hugo Sales f3ccdf8017
[USER] Add UserRoles 2021-09-14 13:05:40 +01:00
Hugo Sales ae373c7d96
[DEFAULTS][FIX] Fix logic error that kept reloading the table when the file wasn't modified 2021-09-14 13:05:39 +01:00
Hugo Sales 3313897671
[UI][SESSION] Add login and logout pages 2021-09-14 13:05:39 +01:00
Hugo Sales 284fbe2c5b
[CORE] Refactor GNUsocial.php so it initializes itself as a service 2021-09-14 13:05:39 +01:00
Hugo Sales e482ecfb87
[I18N] Remove support for context until it proves necessary, as it broke the code 2021-09-14 13:05:39 +01:00
Hugo Sales fffa17448f
[CORE][I18n][DEFAULTS] Remove I18nHelper 2021-09-14 13:05:38 +01:00
Hugo Sales 07c033de33
[DEFAULTS] Update default reserved usernames 2021-09-14 13:05:38 +01:00
Hugo Sales 3992629a08
[DATABASE][WRAPPER] Add findBy method which allows finding entities with a complex expression 2021-09-14 13:05:38 +01:00
Hugo Sales 643a937152
[DATABASE][WRAPPER] Update DATABASE wrapper so entity names are provided without the namespace 2021-09-14 13:05:36 +01:00
Hugo Sales 09c2a762ef
[CACHE] Fix usage of the redis extension 2021-09-14 13:05:35 +01:00
Hugo Sales 31ad75564f
[CACHE][Redis] Add special support for redis (fixed size lists), set method and general fixes 2021-09-14 13:05:35 +01:00
Hugo Sales c549bea4a9
[CACHE] Add support for multiple pools with the syntax (as an example) SOCIAL_CACHE_ADAPTER='default=redis://localhost:6379,memcached://localhost:11211;db.config=apcu://' 2021-09-14 13:05:35 +01:00
Hugo Sales cfe1901b51
[DEFAULTS] Add modified time to config table (as value) and only reload the defaults if the file is newer 2021-09-14 13:05:35 +01:00
Hugo Sales e91a141474
[CACHE] Extend the static wrapper to support working with lists in caches that don't natively support them 2021-09-14 13:05:34 +01:00
Hugo Sales 0e0321cfef
[DEFAULTS][FIX] Fix defaults to use value from environment 2021-09-14 13:05:34 +01:00
Hugo Sales 9d2f6e7425
[CACHE][WRAPPER] Fix cache wrapper 2021-09-14 13:05:34 +01:00
Hugo Sales 4f85594bec
[FORMATTING][DEFAULTS] Fix formatting and remove redundant config defaults 2021-09-14 13:05:34 +01:00
Hugo Sales 65cc487a29
[CACHE] Add a static wrapper around symfony/cache 2021-09-14 13:05:33 +01:00
Hugo Sales aae883880f
[LOG][WRAPPER] Refactor log wrapper 2021-09-14 13:05:33 +01:00
Hugo Sales d48cb3f0b8
[QUEUE] Add queueing wrapper, default configuration and example usage 2021-09-14 13:05:33 +01:00
Hugo Sales 8e30b9423b
[MODULES] Make ModulesManager check if file exists 2021-09-14 13:05:33 +01:00
Hugo Sales 59b2b98537
[CONTROLLER] Add Controller base class, which handles rendering templates if requested HTML or json, accordingly 2021-09-14 13:05:32 +01:00
Hugo Sales 5eae3dc351
[CORE][DATABASE] Replace zero dates with CURRENT_TIMESTAMP and add defaults to all 'created' or 'modified'
This commit is a port from v2's 9a515b9234 ([SCHEMA] Improve timestamp storage) to v3.

As explained by Alexei Sorokin:

Avoid the use of deprecated MariaDATABASE "zero dates" globally. If they're present
as attribute defaults somewhere, they will be replaced with NULL implicitly.
The existing "zero dates" in MariaDATABASE storage will be left intact and this
should not present any issues.

The "timestamp" type in table definitions now corresponds to DATETIME in
MariaDATABASE 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 MariaDATABASE. But there is no such trigger implemented on
PostgreSQL as of this moment.
2021-09-14 13:05:29 +01:00
Hugo Sales e286f39551
[DEFAULTS] Small fixes and add check of SOCIAL_NO_RELOAD_DEFAULTS from the environment, to override the reloading of default values 2021-09-14 13:05:29 +01:00
Hugo Sales b7a8861f55
[CORE][Event] Move GSEvent to Event, no longer a name collision 2021-09-14 13:05:28 +01:00
Hugo Sales b32e173749
[FORM] Added Symfony Form wrapper 2021-09-14 13:05:28 +01:00
Hugo Sales bc6ead4ab1
[CORE][Symfony] Fixed deprecation resultant from Symfony 5.1 upgrade
User Deprecated: Since symfony/framework-bundle 5.1: Using type
"Symfony\Component\Routing\RouteCollectionBuilder" for argument 1 of
method "App\Kernel:configureRoutes()" is deprecated, use
"Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator"
instead.
2021-09-14 13:05:28 +01:00
Hugo Sales 753f852941
[I18N] Fix implementation of I18nHelper::formatICU 2021-09-14 13:05:28 +01:00
Hugo Sales 491e82f94e
[ROUTES] Add easier support for using TemplateController and improved documentation 2021-09-14 13:05:28 +01:00
Hugo Sales f28ff24f2a
[I18N] Small fixes. Still broken, though :') 2021-09-14 13:05:28 +01:00
Hugo Sales 8649b72192
[DEPENDENCY] Upgrade Symfony framework from 5.0 to 5.1 2021-09-14 13:05:28 +01:00
Hugo Sales 10ca51e72a
[I18N] Overhaul _m() implementation to support ICU message formats 2021-09-14 13:05:27 +01:00
Hugo Sales 711af58dcd
[I18N] Added ability to call `_m_dynamic` from any class, allowing it to define translations for dynamic-valued calls to `_m` 2021-09-14 13:05:27 +01:00
Hugo Sales dc7387cc8d
[I18N] Custom translation extractor based on Symfony's PhpExtractor, since we use instead of 2021-09-14 13:05:27 +01:00
Hugo Sales f283613443
[I18N] Refactor since rfc/use-static-function is not implemented
As the above mentioned RFC is not implemented, `_m` needs to be
outside of the I18n class, otherwise it would have to always be called
with `I18n::_m`.
2021-09-14 13:05:27 +01:00
Hugo Sales 186b9e7683
[ROUTES] Add static wrapper around Symfony's router 2021-09-14 13:05:27 +01:00
Hugo Sales 4ffb7c338f
[CORE] Refactoring core 2021-09-14 13:05:26 +01:00
Hugo Sales 436b44df89
[I18N] Fix i18n and add default domain 'Core' 2021-09-14 13:05:26 +01:00
Hugo Sales 13ae29cae2
[DEFAULTS] Fix default config loading logic 2021-09-14 13:05:26 +01:00
Hugo Sales 7c18f10bd2
[TOOLS] Fixed all licence blocks, to use the same, foldable, format 2021-09-14 13:05:26 +01:00
Hugo Sales 02db154495
[DOCUMENTATION][DEFAULTS] Documented all defaults and updated some. Restructured other documentation. 2021-09-14 13:05:26 +01:00
Hugo Sales 4deb446f39
[DEFAULTS] Remove deprecated defaults and convert them to snake_case 2021-09-14 13:05:26 +01:00
Hugo Sales a794c28e75
[DATABASE] Change the way defaults are loaded, bulk insert, reload everything in debug mode, only on http requests (not command line) 2021-09-14 13:05:25 +01:00
Hugo Sales 988be9dbf1
[DATABASE] Fix 'relation config doesn't exist' 2021-09-14 13:05:25 +01:00
Hugo Sales 0ccc359880
[DATABASE] Postgres doesn't understand '0000-00-00 00:00:00' for datetime, use '-infinity' 2021-09-14 13:05:25 +01:00
Hugo Sales b9bc88ddbf
[DATABASE][CONFIG] Loading defaults into database, doctrine static wrapper 2021-09-14 13:05:25 +01:00
Hugo Sales cdb863ba17
[DATABASE][CONFIG] Bring default configs from V2 and implement DATABASE wrapper 2021-09-14 13:05:25 +01:00
Hugo Sales dd559402cd
[CORE][UTIL] Moved classes from util to core
And splitted up Common
2021-09-14 13:05:25 +01:00