Commit graph

272 commits

Author SHA1 Message Date
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
e955e204c4
MediaConfigMock: Change upload path
This changes the upload path in all test to 'test_uploads' to ensure no real uploads are lost.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-31 22:58:15 +02:00
Philip Molares
1835cb7499
PrivateAPI: Add media controller
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-25 21:20:56 +01:00
Philip Molares
fe0c7b425f
PrivateAPI: Add notes controller
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-24 00:12:54 +01:00
Philip Molares
86f5498f51
PrivateApi: Add config controller
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:16:34 +01:00
Philip Molares
9747ea209c
FrontendConfig: Add new service
This service handles the config for the frontend.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:16:01 +01:00
Philip Molares
a7c3d06216
Config: Add rendererOrigin and maxDocumentLength to AppConfig
These are used in the /config private API call.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:00:55 +01:00
Philip Molares
22081756b0
Config: Add identifier to all multi auth provider to AuthConfig
These are used in the /config private API call and needed to distinguish with which of the multiple auth providers a login should occur.
This also fixes the types of the multiple auth provider arrays to something that works, as `[{}]` specifics exactly on object in an array.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:07:43 +01:00
Philip Molares
e3f1d1b0f4
Config: Create new config mocks for tests
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:12:48 +01:00
Philip Molares
64846eb641
Config: Add two new Subconfigs
CustomizationConfig holds all possible customization configs.
ExternalConfig holds external services that may be configured.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:10:16 +01:00
Philip Molares
c6e341aab9
Config: Extend AppConfig mock
This is now more in line what you would get from the regular config code

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-02 10:49:39 +01: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
4dc18c01fb
Utils: Extract getServerVersionFromPackageJson into own file
We need this function in at least on other part of the application so extracting it into an util file was only logical.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 20:52:46 +01:00
Philip Molares
935d5cd548
PublicApi: Add GET /api/v2/notes/{note}/media
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-19 16:53:04 +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
53f5093630
Docs: Add more documentation to the public api
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-19 12:10:46 +01:00
Philip Molares
0e44f545a1
Docs: Add description for common http codes
These are the descriptions for all 401, 403, 404 and 204 HTTP responses in HedgeDoc.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-19 12:09:50 +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
29dbf0b657
PrivateAPI: Add history controller
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-03 15:25:11 +01:00
Philip Molares
b872694158
HistoryService: Add deleteHistory method
This method deletes all history entries of a user.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-03 15:23:45 +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
7a7b3d3a50
AppConfig: Fix bug in the schema of forbiddenNoteIds
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-14 17:54:50 +01:00
Philip Molares
82ef4a10cb
PublicAPI: Add /me/history/:note
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-05 12:01:43 +01:00
Philip Molares
521ddc36c6
HistoryService: Add unit test for getEntryByNoteIdOrAlias
Also add extra test to deleteHistoryEntry

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-05 12:01:04 +01:00
Philip Molares
6ed686e657
HistoryService: Add JSDocs for all methods
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-05 11:59:07 +01:00
Philip Molares
54d0aa2197
NotesService: Add unit tests for forbidden note alias
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 22:23:52 +01:00
Philip Molares
c82f317ef0
NotesService: Check if note alias is forbidden
If the note alias is forbidden return a BadRequest.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 22:21:31 +01:00
Philip Molares
dbbee13913
Errors: Add ForbiddenIdError
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 22:16:50 +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
b2008ae734
AppModule: Add reminder to remove synchronize
This auto creates schema on startup and is not intended for production use
See https://typeorm.io/#/connection-options/common-connection-options

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-27 22:58:34 +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
d2bce6e091
MediaConfig: Change s3 config
remove region as this is specified by endPoint now
add bucket in schema and actual assignment

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-23 16:13:33 +01:00
Philip Molares
5195955eb8
MediaConfig: Fix Joi schema alternatives
'...use' tries to go up one level and grab the value of 'use' there and not the same level 'use' as we want here

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-23 15:45:59 +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
3dd4bf1582
Refactor server version object into own interface
This makes the type of getServerVersionFromPackageJson() way easier
to read.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-27 21:21:41 +01:00
David Mehren
5987e2ed7e
Refactor config utils to use functions instead of consts
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-27 17:45:44 +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
56d28188e7
NotesController: Fix ESLint errors
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 22:33:47 +01:00
David Mehren
dd424cbcee
MeController: Fix ESLint errors
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 22:33:29 +01:00
David Mehren
0344a8294e
ConsoleLoggerService: Fix ESLint errors
We now use @types/cli-color to provide type information

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 20:39:25 +01:00
David Mehren
f79492fe63
NoteEntity: Fix ESLint errors
We now use @types/shortid to provide type information

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 21:10:24 +01:00
David Mehren
71e2f06bbb
Fix ESLint errors in main.ts
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 21:08:08 +01:00
David Mehren
cc1ca69bc1
Fix various ESLint errors in services
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 22:35:06 +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
208ff1d039
Fix various ESLint errors in configs
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 20:29:39 +01:00