Commit Graph

23 Commits

Author SHA1 Message Date
Diogo Peralta Cordeiro ae7516c893
[ATTACHMENTS] Always store in the same location 2021-08-14 17:00:48 +01:00
Diogo Peralta Cordeiro 32ad5dbd74
[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-08-14 17:00:46 +01:00
Hugo Sales 8e627f2c18
[TESTS] Add test annotations to core classes 2021-08-14 16:12:59 +01:00
Diogo Peralta Cordeiro 1556b3e019
[CORE][GSFile] Allow storing files under /file 2021-08-05 03:22:57 +01:00
Hugo Sales 6b098a26f7
[CORE][GSFile] Ensure files are stored inside the configured storage folder, with a relative filename in the database 2021-08-03 19:37:56 +00:00
Hugo Sales d1e92a80e5
[CORE][GSFile] Assert that the destination folder where to store the attachment is inside the INSTALLDIR and store the filepath in the database 2021-08-03 19:23:02 +00:00
Hugo Sales 4297eb71a0
[CORE][GSFile] Change actor_id paramenter of validateAndStoreFileAsAttachment to optional and reorder them and their usages 2021-08-03 19:23:02 +00:00
Hugo Sales 1f9acaf4ef
[TESTS] Add tests for GSFile 2021-08-03 19:13:30 +00:00
Diogo Peralta Cordeiro 832a5c0bd9 [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-07-22 21:10:45 +01:00
Diogo Peralta Cordeiro 4d2131808a [FILE][TemporaryFile] Fix various issues now that we also have Symfony's file abstractions 2021-07-20 23:46:18 +01:00
Hugo Sales 041d19a22d [ATTACHMENTS] Don't store an attachment if it's a dupplicate, reuse it 2021-05-02 15:48:33 +00:00
Diogo Peralta Cordeiro 676210f76a [ATTACHMENTS] Follow URL redirects and don't duplicate attachments 2021-05-02 00:00:03 +01:00
Diogo Peralta Cordeiro 5a40d1f3e3 [Embed] Fix some bugs and change AttachmentEmbed::url to ::media_url 2021-05-01 23:58:49 +01:00
Diogo Peralta Cordeiro ced6e236ce [ATTACHMENTS][GSFile] Rename ValidateAndStore functions 2021-05-01 23:57:51 +01:00
Hugo Sales 650bfec699 [ATTACHMENTS] In sendFile, check that file exists or show a custom exception 2021-05-01 13:02:14 +00:00
Hugo Sales 93e1e4b7a9 [ENTITY] Add field size to attachments, used for quota calculations 2021-04-30 23:08:08 +01:00
Hugo Sales d49de9d35e [CORE] Typo in GSFile and slight Twig weirdness in base template 2021-04-28 20:16:59 +00:00
Hugo Sales 6da8cf7f14 [ATTACHMENTS] Add event 'AttachmentFileInfo' to allow a plugin to override the file displayed 2021-04-28 15:01:40 +00:00
Hugo Sales f388554166 [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-04-27 20:53:59 +00:00
Hugo Sales c1db9bd0a3 [Posting] Extract and store URLs from note content. Introduce 'AttachmentStoreNew' event 2021-04-25 21:20:28 +00:00
Hugo Sales 5ec7717fa1 [ATTACHMENTS] Move thumbnail controller to core and cleanup 2021-04-19 13:22:50 +01:00
Diogo Peralta Cordeiro 2f137f8b44 [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-04-19 13:22:04 +01:00
Diogo Peralta Cordeiro 0f52638a80 [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-04-19 13:21:32 +01:00