Commit Graph

21 Commits

Author SHA1 Message Date
eli
80d1be323d [COMPONENTS][Search][CSS] Extra header forms now accessible through a details element. Re-organizing templates structure. 2021-10-04 12:17:14 +01:00
Diogo Peralta Cordeiro
05f16a3084
[ENTITY][AttachmentThumbnail] Now thumbnails are always only available in three sizes: small, medium, big
Commit jointly produced with eli (Eliseu Amaro)

Breaking change: Entity changed to only store the tinyint referring to the size stored

With this, the logic was simplified and now it's not possible to make an
instance produce unnecessary thumbs. The aspect ratio is preserved and
thus the thumbs will always look nice. New configuration was added to
maintain flexibility.
2021-09-22 15:13:46 +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
Diogo Peralta Cordeiro
2a3db65216
[CONTROLLER][Attachment] Some attachments may not have dimensions 2021-09-14 13:13:34 +01:00
Hugo Sales
6799052ff5
[ATTACHMENTS] Ensure thumbnail dimensions are bounded and change way cropping is implemented 2021-09-14 13:13:32 +01:00
Hugo Sales
3843348c1b
[CONTROLLER][Attachment] Small refactor and add testing annotation 2021-09-14 13:13:28 +01:00
Diogo Peralta Cordeiro
968e3431e1
[Attachment] Sometimes we can't provide download of original file 2021-09-14 13:13:26 +01:00
Diogo Peralta Cordeiro
3f61537140
[ENTITY] Split Attachment in various new entities
Remove Attachment Scope
Fixed some minor bugs

Scope will be implemented later in v3. It doesn't make sense to have
the scope handling being per attachment. Different actors can post
the same attachment with different scopes. The attachment controller
will assume the highest level of scope applied to the attachment and
the rest will be handled at the note level.

Motivation:
* Remove title from attachment, as it's part of the relation between attachment and note.
* Remove actor from attachment, many actors may publish the same attachment.
* Remove is_local from attachment,  as it's part of the relation between attachment and note.
* Remove remote_url from attachment, different urls can return the same attachment.

Addition:
* Attachment now has a lives attribute,  it's a reference counter with a nicer name
* GSActorToAttachment
* GSActorToRemoteURL
* RemoteURL
* RemoteURLToNote
* RemoteURLToAttachment
* AttachmentToNote now has a title attribute
2021-09-14 13:13:24 +01:00
Hugo Sales
e0a0df502e
[TESTS] Raise test coverage for Attachment controller to 100% 2021-09-14 13:13:19 +01:00
Hugo Sales
518995d155
[CONTROLLER][Attachment] Assert that the supplied is positive and add documentation 2021-09-14 13:13:17 +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
091f4b5194
[ATTACHMENTS] Do not create thumbnails for attachments with mimetype different from 'image|video' 2021-09-14 13:12:57 +01:00
Diogo Peralta Cordeiro
adb6680a01
[ATTACHMENTS] Respect config for smart crop 2021-09-14 13:12:57 +01:00
Diogo Peralta Cordeiro
8cb64ede7f
[AttachmentShowRelated] Move Attachment related to plugin 2021-09-14 13:12:55 +01:00
Hugo Sales
aea8639d44
[ATTACHMENTS] Restrict thumbnail generation to allowed sizes. Defaults to only configured sizes, but can be extended with the event 'GetAllowedThumbnailSizes'. The intention is to prevent DoS attacks, since handling a thumbnail request is a relatively slow process 2021-09-14 13:12:53 +01:00
Hugo Sales
436528172c
[ATTACHMENTS] Add controller and templates for the attachment show page, which shows extra info about an attachment, such as related notes and tags 2021-09-14 13:12:53 +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
Diogo Peralta Cordeiro
3afa872cec
[UI] Use thumbnail path for thumbs 2021-09-14 13:12:22 +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