Philip Molares
ff44a6567e
Tests: Removed all eslint-disable lines
...
As we now disable what we don't need in the eslint config, we don't need this anymore.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-12 17:06:59 +02:00
Philip Molares
1df74df65c
FileMediaBackend: Fix generated urls
...
All urls should be of the form `uploads/<filename>.<extension>` regardless of what the uploadDirectory is, because the backend proxies all locally uploaded files.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-31 23:01:29 +02:00
Philip Molares
c1a9eee6a4
Config: Move config mocks in own folder
...
To clean up the config folder, all mocks are now in it's own folder.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:12:01 +01:00
Philip Molares
890de2dea1
MediaService: Add listUploadsByNote method
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-19 16:47:52 +01:00
Philip Molares
47ca8be78b
Docs: Add ApiProperty to all Dtos
...
This makes it possible for the autogenerated openapi file to contain all the dtos instead of nothing.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-19 12:08:34 +01:00
Philip Molares
6e29ffba65
MediaService: Remove allowedMimeType application/pdf
...
Uploading PDFs does not work with imgur and therefore HedgeDoc should not offer that.
See #533
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-15 22:41:40 +01:00
Yannick Bungers
f47d85b301
Add GET /me/media
...
Returns all media files uploaded by the authenticated user.
Signed-off-by: Yannick Bungers <git@innay.de>
2021-03-14 17:47:16 +01:00
Philip Molares
966f5ee2fe
Config: Add forbiddenNoteIds to AppConfig
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 22:15:04 +01:00
Philip Molares
d6e8d9a592
S3Backend: Add S3 MediaBackend
...
Add minio dependency
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-23 16:14:14 +01:00
Philip Molares
1942df0da0
AzureBackend: Add Azure MediaBackend
...
Add @azure/storage-blob dependency
This is the relevant part of the official azure sdk.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-22 22:33:56 +01:00
Philip Molares
95b3c628ce
DBSchema: Add fileUrl to media_upload table
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-27 11:24:41 +01:00
Philip Molares
a00a093a14
ImgurBackend: Add Imgur MediaBackend
...
Add node-fetch dependency.
This was chosen as other libs we use already use node-fetch.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-26 16:16:00 +01:00
Philip Molares
c64ca9c012
MediaUploadEntity: Add fileUrl
...
Save the fileUrl, returned to the user on creation, in the DB.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-26 16:12:14 +01:00
David Mehren
b128efebff
Enforce explicit function return types
...
This re-enables the `@typescript-eslint/explicit-module-boundary-types`
check and also enables the
`@typescript-eslint/explicit-function-return-type` check.
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-27 17:41:32 +01:00
David Mehren
05926c08d6
FilesystemBackend: Fix ESLint errors
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-26 12:24:35 +01:00
David Mehren
21403ba606
Fix various ESLint errors in unit tests
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 20:20:04 +01:00
David Mehren
9485597e6f
ESLint: Enable @typescript-eslint/return-await rule
...
This ensures stack traces are helpful at the cost of a slightly
lower performance (one more tick in the event loop).
Fixes #838
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-20 20:14:36 +01:00
Philip Molares
0e4b65ca9d
MediaBackendInterface: Correct JSDoc of deleteFile
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-27 12:24:02 +01:00
Philip Molares
2c6af85f14
FilesystemBackend: Remove getFileURL
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-27 11:38:50 +01:00
Philip Molares
4ef3fd029d
MediaBackendInterface: Remove getFileURL
...
closes #957
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-26 16:15:46 +01:00
Philip Molares
8e7be737fa
FilesystemBackend: Throw MediaBackendError where appropriate
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-25 13:52:50 +01:00
Philip Molares
8515d824b7
MediaService: Add MediaBackendError
...
This get's thrown when the backend can't perform the required action.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-25 13:51:54 +01:00
Philip Molares
b1683a5c64
GroupsService: Create new GroupsService
...
This service is necessary as we plan to have functions to create and manipulate groups in the future.
The GroupInfoDto was moved from the file note-permissions.dto.ts to mimic the UserInfoDto.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 11:41:15 +01:00
Yannick Bungers
68cbb5a9c2
Add relation between User and Group
...
This represents the users which are members of this group
Signed-off-by: Yannick Bungers <git@innay.de>
2021-01-27 22:58:55 +01:00
Philip Molares
3ebea8ed77
MediaService: Add unit tests
...
The file test.zip is used to fail the saveFile test with 'MIME Type not supported'
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-13 22:12:19 +01:00
Philip Molares
c4289c9693
MediaService: Add JS-Docs to media service
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-13 22:06:33 +01:00
Yannick Bungers
22aaa956a7
Reformat code by yarn format
...
Signed-off-by: Yannick Bungers <git@innay.de>
2021-01-30 18:09:00 +01:00
Yannick Bungers
0d5b9dea00
Refactoring of controllers and service interfaces
...
DTO should only be used for sending information to and from user.
Services now have methods which return normal internal objects and
methods which convert them to DTOs. This conversion is done in the
controlers
Signed-off-by: Yannick Bungers <git@innay.de>
2021-01-30 00:06:38 +01:00
Philip Molares
508ad26771
auth: Add tests for AuthService
...
Move AuthTokens to auth folder
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-22 15:29:10 +01:00
Philip Molares
4372106ef0
tests: Removed unnecessary import of appConfigMock
...
As suggested by an review of David Mehren
Co-authored by: David Mehren <git@herrmehren.de>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-19 12:45:36 +01:00
Philip Molares
072ef223e0
config: splits config in multiple files
...
splits the big appConfig in multiple configs
adds media.config.mock.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-15 16:57:04 +01:00
Philip Molares
286575315e
Extend config with various options from 1.x
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2020-12-31 22:37:37 +01:00
David Mehren
18c6694bcb
Add config to tests in various places
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-08 12:56:25 +01:00
David Mehren
e8e82076d0
FilesystemBackend: Use scoped appConfig
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-08 12:53:16 +01:00
David Mehren
67c7c4b8d1
MediaService: Get media backend from configuration
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-08 13:06:44 +01:00
David Mehren
cd37eef45e
Get port and upload path from config
...
Signed-off-by: David Mehren <git@herrmehren.de>
Co-authored-by: Yannick Bungers <git@innay.de>
2020-10-30 22:35:57 +01:00
David Mehren
3801b1b042
Format with Prettier 2
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-06 23:48:53 +01:00
Tilman Vatteroth
7aeaf488c4
Change year in copyright to 2021
...
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
2021-01-06 21:36:07 +01:00
Philip Molares
dc63c76f43
added reuse information
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-05 22:12:38 +01:00
David Mehren
c95c68541c
Fix tests
...
Signed-off-by: David Mehren <git@herrmehren.de>
Co-authored-by: Yannick Bungers <git@innay.de>
2020-10-24 21:11:16 +02:00
David Mehren
ff0651e659
FilesystemBackend: Ensure uploads directory exists
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-24 12:28:52 +02:00
David Mehren
2b23dcc5a9
MediaService: Simplify saveFile
signature
...
As the `saveFile` method only really uses the files `Buffer`, this commit changes the signature so it directly gets a `Buffer` instead of a complicated `MulterFile` object. This also simplifies testing.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-24 11:49:01 +02:00
David Mehren
eeb3f6f5a7
MediaService: Implement delete feature
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-17 21:54:08 +02:00
David Mehren
5262a58639
FilesystemBackend: ESLint fixes
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-17 21:53:34 +02:00
David Mehren
c2c51f1eef
MediaService: Only allow upload of common image formats and PDFs
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-17 20:50:20 +02:00
David Mehren
d41b68b41a
Add various missing imports and provider ovverides in unit tests
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-17 20:21:22 +02:00
David Mehren
0cc9c6b347
MediaService: Improve error handling and logging
...
Add debug logging to `saveFile` method and throw the proper errors when problems with the mime type are encountered
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-17 18:50:53 +02:00
David Mehren
a877f57875
FilesystemBackend: Implement deleteFile
and getFileURL
.
...
We use `fs.unlink` instead of `fs.rm`, as the latter is only available in the fsPromises API since Node 14.14
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-17 16:24:30 +02:00
David Mehren
c0cbcc863a
Add MediaService
...
This service is responsible for operations regarding uploaded media. It should perform save, get and delete operations with the configured backend.
The service also checks, if the mime type of the uploaded media is allowed.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-16 22:35:53 +02:00
David Mehren
23ba2026cc
Do not save file extension as a separate field.
...
It turned out that saving the file extension in a separate field is not necessary. Instead, the extension is saved in the complete filename in the `id` field.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-16 22:32:58 +02:00