Commit Graph

244 Commits

Author SHA1 Message Date
Hugo Sales e8f4563633
[UTIL][Formatting][COMPONENT][Link][Tag] Refactor code from formatting into Link and Tag, where appropriate. Drop 'perfect url regex' as the one used in v2 is better 2021-09-20 13:28:18 +01:00
Hugo Sales 04174bc56d
[UTIL][UI] Change how plaintext notes are rendered to be split into paragraphs. Remove span around tags 2021-09-20 13:27:27 +01:00
Hugo Sales 51c7e10483
[UTIL][HTML] Allow specifying `options: [raw => bool]`, whether to escape the provided inner HTML or not. Use with care 2021-09-20 13:27:21 +01:00
Diogo Peralta Cordeiro 67d62cf37b
[TWIG] Remove kludge event TwigPopulateVars 2021-09-18 07:27:35 +01:00
Diogo Peralta Cordeiro 941cbe6599
[Actor] Refactor GSActor into Actor 2021-09-18 05:12:17 +01:00
Hugo Sales b177cb69e7
[HTML][SECURITY] Harden implmentation of HTML generation 2021-09-18 05:12:08 +01:00
Hugo Sales 8f0a3e4977
[UI] Add mechanism for rendering note contents in different formats. Implement plaintext rendering. Use rendered field for note content, rather than the content itself 2021-09-18 05:12:06 +01:00
Hugo Sales 15a2a69274
[ROUTER] Add option `is_system_path`, to allow specifying that a route, such as `gsactor_view_nickname` should not be considered a system path, when checking for the collision of nicknames 2021-09-18 05:12:05 +01:00
Eliseu Amaro e9d809d441 [Security][Exception] Security exception handling, login and register. TODO EmailNotFoundException and NicknameNotFoundException. 2021-09-15 14:48:06 +01:00
Hugo Sales b74d944ae3
[TOOLS][PHPStan] Raise PHPStan level to 3 and fix new errors 2021-09-14 13:13:45 +01:00
Hugo Sales 4e30e5aad9
[TOOLS] Fix all issues found by PHPStan level 2 2021-09-14 13:13:44 +01:00
Hugo Sales add8f4a52f
[TOOLS] Fix all errors found by PHPStan level 1 2021-09-14 13:13:42 +01:00
Hugo Sales 277a080d7c
[EXCEPTION] Add `NotImplementedException` 2021-09-14 13:13:42 +01:00
Hugo Sales eb833b62e2
[TOOLS] Fix all level 0 errors found by PHPStan and move constant definition to bootstrap file 2021-09-14 13:13:42 +01:00
Hugo Sales cbbef90752
[UTIL][CONFIG] Ensure `setConfig` uses a `locals` key 2021-09-14 13:13:41 +01:00
Hugo Sales cd89106fc0
[EXCEPTION][RedirectException] Add prevention for open redirects by default and ensure we can redirect to the same page 2021-09-14 13:13:40 +01:00
Hugo Sales 16cde6dfd7
[PLUGINS][Reply] Redirect back to previous URL on note reply. Move controller to own class
This should be safe against open redirects, as it doesn't allow redirecting to other domains
2021-09-14 13:13:40 +01:00
Hugo Sales 141f919ca7
[CONFIG][TESTS] Fix error found by AdminPanel test 2021-09-14 13:13:36 +01:00
Hugo Sales c71a4b06ef
[CONFIG] Make it possible to write module configuration in a config.{php,yml,yaml,xml} file and set each value as properties in the module object 2021-09-14 13:13:36 +01:00
Diogo Peralta Cordeiro 2b457655ea
[CORE] Fix path configuration 2021-09-14 13:13:35 +01:00
Eliseu Amaro 44a581f0f6
[UTIL][FORM] Password form now shows the proper HTML class, and it's respective label. 2021-09-14 13:13:30 +01:00
Hugo Sales c3db2f60d2
[UTIL][EXCEPTIONS] Introduce NotStoredLocallyException 2021-09-14 13:13:28 +01:00
Diogo Peralta Cordeiro 63cbf4052f
[UTIL] Common::config wasn't a proper port from v2, it has to accept one argument only as well 2021-09-14 13:13:25 +01:00
Hugo Sales 809bf00aa9
[TemporaryFile][TESTS] Throw on attempt to write to null resource and fix tests 2021-09-14 13:13:24 +01:00
Hugo Sales 2851b899b8
[TESTS] Add test annotations to core classes 2021-09-14 13:13:23 +01:00
Hugo Sales 1b623a85ae
[UTIL][FormFields] Move FormFields class to Util\Form namespace 2021-09-14 13:13:22 +01:00
Hugo Sales 9ad2cb5e66
[UTIL][FormFields] Allow specifying whether a password is required and provide placeholder text 2021-09-14 13:13:20 +01:00
Hugo Sales 19318b3163
[UTIL][EXCEPTION] Add AuthenticationException, representing an auth error, status code 401 unauthorized 2021-09-14 13:13:20 +01:00
Hugo Sales 855d427442
[UTIL][FORM] Create a utility class that defines common form fields, such as passwords 2021-09-14 13:13:18 +01:00
Hugo Sales 0c54a3297f
[UTIL] Add a class that defines commonly used form fields 2021-09-14 13:13:17 +01:00
Hugo Sales d07cb79844
[EXCEPTION] Add Email related exceptions 2021-09-14 13:13:16 +01:00
Hugo Sales e250edf7fd
[UTIL][Nickname] Refactor Nickname and extract a validate function, as we'll want to perform normalization in select cases in the future, likely as a plugin 2021-09-14 13:13:16 +01:00
Hugo Sales 7a2574eafb
[CORE][TemporaryFile] Add option to specify attempts and better handle when reaching the attemp limit without being able to create a file 2021-09-14 13:13:15 +01:00
Diogo Peralta Cordeiro c020958690
[DOCS] Write exceptions chapter 2021-09-14 13:13:09 +01:00
Hugo Sales cb7fa0a081
[SECURITY] Remove aggressive normalization of nicknames. This will be moved to a plugin in the future and we'll open an RFC, as discussed 2021-09-14 13:13:04 +01:00
Diogo Peralta Cordeiro 861732176e
[Media] Support any kind of thumbnails in the Core
Sanitize Attachments instead of Validate (part 1)
Ensure the intended filetypes and mimetypes during Vips conversions (part 1)
Various bug fixes
2021-09-14 13:13:03 +01:00
Diogo Peralta Cordeiro 72dcff22f7
[MEDIA] We need permissions to run chmod in directories
It's better to have in the filename data that we couldnt't otherwise rapidly retrieve
2021-09-14 13:13:03 +01:00
Diogo Peralta Cordeiro c8cf8c3f13
[FILE][TemporaryFile] Fix various issues now that we also have Symfony's file abstractions 2021-09-14 13:13:03 +01:00
Hugo Sales 687b2e2bc7
[UTIL] Add utility to flatten the result of note queries 2021-09-14 13:13:02 +01:00
Hugo Sales 86400ce815
[UTIL] Provide static access to current request and utilities in Common 2021-09-14 13:13:02 +01:00
Hugo Sales e1a1d01844
[TESTS] Add GNUsocialTestCase, which initializes our infrastructure when bootKernel is called 2021-09-14 13:13:01 +01:00
Hugo Sales fbe0f36a53
[TESTS] Expand test coverage for App\Util\Forms\ArrayTransformer, App\Util\Notification and App\Twig\Runtime 2021-09-14 13:13:00 +01:00
Hugo Sales fc9b934bbc
[UTIL] Fix App\Util\TemporaryFile, adding default options and preventing warning on not enough permission 2021-09-14 13:12:59 +01:00
Hugo Sales ec1081ed43
[UTIL] Rename and rewrite isTaken to checkTaken 2021-09-14 13:12:59 +01:00
Hugo Sales a49ee453ab
[TESTS] Raise App\Util\HTML test coverage to 100% 2021-09-14 13:12:58 +01:00
Hugo Sales fbea08ca9b
[TESTS] Raise App\Util\Bitmap test coverage to 100% 2021-09-14 13:12:58 +01:00
Hugo Sales abda73b8e3
[TESTS] Raise App\Util\Common test coverage to 100% 2021-09-14 13:12:58 +01:00
Hugo Sales 2b83a4b627
[UTILS][TemporaryFile] Change way TemporaryFile takes arguments and it's internal implementation 2021-09-14 13:12:58 +01:00
Hugo Sales 3b39046a38
[UTIL] Fix bugs found in App\Util\Formatting by tests 2021-09-14 13:12:58 +01:00
Diogo Peralta Cordeiro 837f644458
[UTIL][Formatting] Add twigRenderFile 2021-09-14 13:12:55 +01:00
Hugo Sales 29457ef50d
[UTIL] Add option for setting a file suffix on TemporaryFile constructor and add missing TemporaryFileException 2021-09-14 13:12:54 +01:00
Hugo Sales 708a910870
[UTIL] Fix remove affix utilities, so they only try to remove an affix if the string starts/ends with it 2021-09-14 13:12:52 +01:00
Hugo Sales 60a9085e56
[FORMATTING] Add utilities to remove affixes from strings 2021-09-14 13:12:51 +01:00
Hugo Sales 2a74dced22
[UTIL] Add TemporaryFile class, courtesy of Alexei Sorokin from v2, a class that ensures files stored in /tmp are removed, as it doesn't happen in some cases 2021-09-14 13:12:51 +01:00
Hugo Sales 94edad43d9
[UTIL] Add method to validate url 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 ae0e410986
[TESTS] Fix Nickname test 2021-09-14 13:12:23 +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 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 e2e561e663
[DB][FKEY] Temporarily disable foreign key mapping, as there seems to be a bug in doctrine, which is under investigation 2021-09-14 13:10:23 +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 68de1b09b1
[NICKNAME] Don't throw when normalizing reserved nicknames 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 57dad5eca4
[NICKNAME] Add nickname min length config and check it in Nickname::normalize 2021-09-14 13:10:23 +01:00
Hugo Sales 5afd2c9843
Duplicate src/Util/Exception/NicknameTooLongException.php history in src/Util/Exception/NicknameTooShortException.php history. 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 b387ea9aa0
[TESTS] Fix error when testing cold redis cache 2021-09-14 13:10:22 +01:00
Hugo Sales 88e4044d02
[TESTS] Add tests for the bitmap utility and fix implementation 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 c539f17ba5
[TESTS] Add App\Core\Cache test 2021-09-14 13:10:22 +01:00
João Brandão 5516a77b33
[UI][TIMELINES] Refactored query for public stream 2021-09-14 13:10:19 +01:00
Diogo Machado f18a2a4bb6
[STATIC ANALYSIS] Started removal process for the errors found by PHPStan 2021-09-14 13:10:16 +01:00
Daniel c0d363e317
[Poll] Restructured templates, added misssing poll related css 2021-09-14 13:10:13 +01:00
Daniel 7a299162e1
[Poll] Polls now have an associated note, poll templates, start_show_styles event, started css 2021-09-14 13:10:13 +01:00
Daniel ffb4b9df23
[Poll] Added modified param for Poll/Poll response, added PollTest 2021-09-14 13:10:12 +01:00
Daniel c3aa2ae400
[FORM] Implement ActorArrayTransformer 2021-09-14 13:06:57 +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 e8feb2ae84
[DOCUMENTATION][REFACTOR] Add documentation to all flagged function and do some small cleanup 2021-09-14 13:06:55 +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 179d7f3335
[UTILS] Make bitmap not use a static class var and set object properties as lowercase 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 c07a0cdcd5
[EXCEPTION] Add base class to invalid form exception and add URL arguments to redirect exception 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 4c15271d36
[UI] Display error when submitted form is invalid 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 6165f7cd55
[Media] Display images and videos inline in notes 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 d95c22cb3e
[EXCEPTION] Fix exceptions not being translated 2021-09-14 13:06:48 +01:00
Hugo Sales 0b50905ac8
[NOTE][UI] Add note replying and UI displaying 2021-09-14 13:06:45 +01:00
Hugo Sales 8506a0248d
[UTIL][Common] Fix import 2021-09-14 13:05:54 +01:00
Hugo Sales a2269f5745
[UTIL][Common] Implement 'isSystemPath' 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 365168d03e
[EXCEPTION] Add ServerException and inherit previous throwable
imported from v2/5ea5d3007563f76a77efbfb66936315441922542
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 699f25a397
[AUTOGENERATED] Update autogenerated code 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 58b6026607
[UTIL] Fix and rename arrayRemoveKeys 2021-09-14 13:05:47 +01:00
Hugo Sales 48252d6b8c
[UTIL][FORM] Add form transformer array <--> string 2021-09-14 13:05:46 +01:00
Hugo Sales 3e6eb114c4
[UTIL] Add Common::array_remove_keys 2021-09-14 13:05:46 +01:00
Hugo Sales b3bce3efa1
[FORMATTING] Add option to split a string to array by both a comma and a space 2021-09-14 13:05:45 +01:00
Hugo Sales 921da28884
[FORM] Add DataTransformer to and from array 2021-09-14 13:05:45 +01:00
Hugo Sales 576d6eb11c
[UTIL][NICKNAME][FIX] Add self to constant 2021-09-14 13:05:44 +01:00
Hugo Sales 040c400bfe
[UTIL] Update Formatting::{toString,toArray} to allow spliting by either space or comma 2021-09-14 13:05:43 +01:00
Hugo Sales b772702895
[LIB][Util] Update Common::setConfig to throw an exception if appropriate, add Formatting::{toString,toArray} 2021-09-14 13:05:42 +01:00
Hugo Sales 17dc298dfa
[UTIL][NICKNAME] Small refactor and remove the check between user nickname and group_alias, as these will have different semantics 2021-09-14 13:05:42 +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 2796ac5228
[NOTIFICATION][DATABASE] Update user notification prefs table, implementation of Notification and define a base class for notification transport 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 8ce0f05371
[UTIL] Update Common::config to ensure the values queried exist 2021-09-14 13:05:39 +01:00
Hugo Sales fb53700be2
[LIB][Util] Remove Functional::arity as it got merged upstream as Functional\ary 2021-09-14 13:05:39 +01:00
Hugo Sales d6cd52cede
[LIB][Util] Make Common::config return the unserialized value instead of the entity 2021-09-14 13:05:39 +01:00
Hugo Sales 339003f210
[LIB][Util] Change methods in the Common class to camelCase, add isSystemPath (previously in Nickname.php) 2021-09-14 13:05:38 +01:00
Hugo Sales d0771f77bc
[UTIL][NICKNAME] Import nickname utilities and exceptions from v2 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 c602cf8422
[LIB][Util] Refactor and implement array indexing methods on RingBuffer 2021-09-14 13:05:35 +01:00
Hugo Sales 7f5e574cbf
[LIB][Util] Add Ring Buffer data structure 2021-09-14 13:05:34 +01:00
Hugo Sales 84be8e1711
[DOCUMENTATION] Fixed type annotations and documentation of Common::size_str_to_int 2021-09-14 13:05:29 +01:00
Hugo Sales 4ffb7c338f
[CORE] Refactoring core 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 988be9dbf1
[DATABASE] Fix 'relation config doesn't exist' 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
Hugo Sales f628665589
[FORMATTING] Cherry-pick of Diogo's 763ac735c0758624ebd5957993dc0676b865927a 2021-09-14 13:05:24 +01:00
Diogo Cordeiro cb7518a750
[DOCUMENTATION][TOOL] Small bug fixes and docblock elaboration 2021-09-14 13:05:24 +01:00
Hugo Sales 06b5fe2cdf
[TOOLS][DOCUMENTATION] Improvements to entity generation script 2021-09-14 13:04:39 +01:00
Hugo Sales a7cc7f4e27
[UTIL] Wrote HTML library to convert arrays to html 2021-09-14 13:04:39 +01:00
Hugo Sales fe73001c36
[DATABASE] Changed the type of the 'id' field of the ProfileList table from serial to int, as doctrine complains otherwise 2021-09-14 13:04:39 +01:00
Hugo Sales 42321b936f
[SCHEMADEF] Bug fixes 2021-09-14 13:04:38 +01:00
Hugo Sales e022a5e65e
[MODULES] Fix small error in modules manager 2021-09-14 13:04:38 +01:00
Hugo Sales c38b9a1503
[COMMON] Added toCamelCase and toSnakeCase functions 2021-09-14 13:04:37 +01:00
Hugo Sales 0c79dfc67b
[MODULES] Rename extensions to modules, add example plugin, change plugin location 2021-09-14 13:04:37 +01:00
Hugo Sales 596009c924
[DOCUMENTATION] Document All The Things! 2021-09-14 13:04:33 +01:00
Hugo Sales 5d1685b142
[CORE][ROUTES] Implemented custom router, with an interface similar to the old one, which allows routes to be seperated into files 2021-09-14 13:01:35 +01:00
Hugo Sales b50909a335
[CORE][COMMAND] Register internal structures on command event 2021-09-14 13:01:34 +01:00
Hugo Sales 6df658a987
[CORE][EXTENSIONS] Added extension (modules, plugins) loading and test plugin, which is able to handle events 2021-09-14 13:01:34 +01:00
Hugo Sales 1b45936f19
[DOCTRINE][SCHEMADEF] Small refactoring 2021-09-14 13:01:34 +01:00
Hugo Sales 2c9a732256
[CORE][DOCTRINE] Implement SchemaDefDriver, which transforms the old syntax from to doctrine's metadata 2021-09-14 13:01:34 +01:00
Hugo Sales cc72373e3d
[DOCTRINE][SCHEMADEF] Create a new metadata driver to allow us to continue using static schemaDef functions
This has the benefit of requiring fewer code changes, as well as providing a better isolation
between GNU social and symfony, useful in case the framework needs to be changed
2021-09-14 13:01:34 +01:00
Hugo Sales 2215b05894
[CORE][I18N] Fix the translation system 2021-09-14 13:01:33 +01:00
Hugo Sales 2b9a15c1e9
[CORE][I18N] Port the translation system to rely on symfony's 2021-09-14 13:01:33 +01:00
Hugo Sales feaee1b238
[CORE][EVENTS] Bring existing Events and Boostrapper back
- Adapt the existing event system to rely on Symfony's event dispatcher
2021-09-14 13:01:33 +01:00