Commit graph

666 commits

Author SHA1 Message Date
Renovate Bot
c2645472f0
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-03 01:12:21 +00:00
Philip Molares
8186c96806
PrivateHistoryE2E: Extend POST /me/history
Test the correct behaviour in error cases

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-12 10:55:16 +02:00
Philip Molares
258a38f8c0
ControllerTests: Add connection to controller tests
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-11 22:06:41 +02:00
Philip Molares
0933b88ff5
ESLint: Add extra rules for tests
Add afterEach and beforeAll as additional additionalTestBlockFunctions for jest/no-standalone-expect. This is necessary, because we use expects in those functions for the history service unit tests.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-18 14:02:55 +02:00
Philip Molares
ea7b0cb9c4
HistoryService: Add test for setHistory
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-11 22:06:36 +02:00
Philip Molares
524ad658d8
HistoryService: Add setHistory method
This is the transactional reimplementation of the business logic of the history controllers setHistory method (of the private api). This should prevent the problem that the history gets deleted, but a later error in the handling of the list of HistoryEntryImportDto let's the call fail.

See also: https://docs.nestjs.com/techniques/database#transactions

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-11 21:54:50 +02:00
Philip Molares
7c648e7056
HistoryService: Remove extra parameters from createOrUpdateHistoryEntry
As the function is now only called with a user and a note and the previous extra parameters are now added into the transactional setHistory method, this is no longer necessary.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-11 21:28:53 +02:00
Philip Molares
6b6aef284c
NotesService: Extract checkNoteIdOrAlias into own method
To reuse this functionality in the history services setHistory method, it was extracted into its own exported function.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-11 21:25:41 +02:00
Philip Molares
7e20bb0fef
[Project] Add seed script
This script invokes src/seed.ts to create a sqlite DB. The DB already contains some objects to manual test with. This ensures that devs easily can spin up a test instance of HedgeDoc and don't need to fumble around with the DB file.

See https://github.com/typeorm/typeorm#creating-a-connection-to-the-database

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-29 11:53:59 +02:00
Philip Molares
162f736647
PrivateApi: Add CORS-Header for rendererOrigin
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-02 17:36:51 +02:00
Philip Molares
bf13668548
PrivateApi: Serve under /api/private
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-02 17:33:42 +02:00
Philip Molares
1edc0d87c5
FrontendConfig: Fix unit test
Emulate the behaviour of the new app config: If renderOrigin is undefined instead use domain.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-27 23:33:13 +02:00
Philip Molares
662d428e3c
AppConfig: Move default for rendererOrigin to config file
As we only use rendererOrigin in the frontend config service, where domain will be used if it is not defined, it makes more sense to move this default behavior to the app config directly. That makes it easier to understand what this variable contains and that it defaults to domain.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-25 15:20:51 +02:00
Renovate Bot
116aa5e022
Pin dependency @tsconfig/node12 to 1.0.7
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-30 18:53:44 +00:00
Renovate Bot
34ae957dee
Update dependency rxjs to v7
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-30 18:53:59 +00:00
David Mehren
6ee2ddead5
Use node12 TypeScript base config
TypeScript recommends using a base config from https://github.com/tsconfig/bases.

Using this config reduces compile times by ~30%
and the size of the dist folder by ~45%.
It also enables the recommended `esModuleInterop` option,
which necessitated some changes to imports.
See also https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#support-for-import-d-from-cjs-from-commonjs-modules-with---esmoduleinterop

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 22:47:18 +02:00
Renovate Bot
c32c601d36
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-29 14:49:27 +00:00
Renovate Bot
448225e124
Update dependency eslint-plugin-jest to v24.3.6
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-27 20:32:19 +00:00
Renovate Bot
77d03dd4aa
Update definitelyTyped
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-27 14:46:56 +00:00
Philip Molares
33dce8f607
README: Replace HedgeDoc header with logo
We have such a lovely logo we should use it on our user-facing README.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-25 23:03:33 +02:00
Tilman Vatteroth
58075f787e
Remove banner from frontend config
NestJS adds the headers "Last Modified" and "ETag" to asset serving responses.
Therefore all the information we need for the banner are already given by the
file content or the file meta data.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2021-04-25 14:45:04 +02:00
Tilman Vatteroth
ff06f368de
Add serving of static assets under the relative URL '/public'
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2021-04-25 14:41:38 +02:00
Renovate Bot
fc3d98d23a
Update dependency mkdocs-material to v7.1.3
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-25 19:19:36 +00:00
Philip Molares
1f56ba95f4
Gitignore: Add .env
Because the new config is done via the file `.env`, it should not be possible to include it in the git repository.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-25 12:00:13 +02:00
Renovate Bot
608cc41527
Update linters
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 15:33:20 +00:00
Renovate Bot
dbf326d9a8
Update dependency ts-loader to v9.1.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 11:22:22 +00:00
Philip Molares
f99b157098
Docs: Fix mkdocs link
The link that was included in the reference was surrounded by paranthesis and therefore faulty.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-25 20:57:13 +02:00
Philip Molares
fac9f2735c
Reuse: Fix typo in HedgeDoc Icon Usage Guidelines
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-25 12:57:41 +02:00
Philip Molares
64e016f181
NotesE2ETest: Changed test for title and description
They should not return null and that's correctly tested now.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-24 21:33:47 +02:00
Philip Molares
6a4e0d96cf
Services: Use replaceNullWithEmptyString
Add the helper method replaceNullWithEmptyString to the services, where it is needed.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-24 21:16:06 +02:00
Philip Molares
4eb9f0dc11
Reuse: Add license information for dark mode logos
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-25 12:54:29 +02:00
Philip Molares
67e1ff3d07
Documentation: Add toggleable dark theme
The dark theme is mostly built on top of the mkdocs slate theme.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Co-Authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>

(cherry picked from commit 60251d89ee)
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-17 12:42:03 +02:00
Philip Molares
4640735d18
PublicApi: Add option to keep media to DELETE /notes/{note}
This adds a body to the route DELETE /notes/{note} of the public api to specify if the associated media uploads of the note should be kept or deleted.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-01 01:23:12 +02:00
Philip Molares
bd4231c1c5
PrivateApi: Add option to keep media to DELETE /notes/{note}
This adds a body to the route DELETE /notes/{note} of the private api to specify if the associated media uploads of the note should be kept or deleted.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-01 01:22:34 +02:00
Philip Molares
b65297523c
MediaService: Add removeNoteFromMediaUpload method
This method replaces the associated note of a media upload with null.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-01 01:18:24 +02:00
Philip Molares
41765ac300
MediaUpload: Make note nullable
As it is possible to delete a note without also deleting the associated media uploads this needs to changed in the media upload entity, too.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-01 01:17:09 +02:00
Philip Molares
e2469eb441
Notes: Add NoteMediaDeletionDto
This is used to specify if the media uploads should be kept or deleted, when deleting a note.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-01 01:15:44 +02:00
David Mehren
61321fd992
CI: Run tests with Node.js 16
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-22 19:08:43 +02:00
Philip Molares
36cd0fd246
RevisionsService: Add missing awaits
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-22 18:26:19 +02:00
David Mehren
678f69f562
FilesystemBackend: Fix functionContext logging
This commit adds a few missing `functionContext` parameters in calls to
`this.logger` and fixes a copy-paste error in `ensureDirectory`

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-22 21:58:03 +02:00
Renovate Bot
e7cdc30eff
Update dependency ts-loader to v9.1.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-22 20:22:10 +00:00
Philip Molares
8a01720ef4
AppConfigMock: Use correct loglevel
Until now the app config mock used ts-loader's LogLevel instead of our own Loglevel, which is obviously wrong.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-22 22:23:59 +02:00
David Mehren
79065b8d3f
Media E2E tests: Add error handling for upload cleanup
Previously, `fs.rmdir` was called multiple times on the same path,
even when the path was already deleted.
This causes test failures in Node 16.

This commit extracts the cleanup code into a utility function
and ensures that no error is thrown when the given path is already deleted.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-22 21:29:23 +02:00
Philip Molares
20f527eb80
GithubWorkflow: Removed build on Node 10
This is not helpful anymore, because node 10 is nearly at the end of its LTS and because ts-loader 9 has node 12 as it minimum supported version and this is a key part of this application.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-20 11:29:20 +02:00
Renovate Bot
380365fc82
Update dependency ts-loader to v9
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-19 22:32:09 +00:00
Philip Molares
1ed22ba4bf
PrivateE2EMe: Add E2E test for private api /me routes
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-20 19:01:04 +01:00
Philip Molares
e90e2a8e19
Entities: Add onDelete CASCADE to entities
To better handle deletion of entities, all necessary other entities got the option onDelete CASCADE set. So everything that does not make any sense if something else is deleted will be deleted along side of it.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-11 15:03:23 +01:00
Philip Molares
56a46f57fc
PrivateAPI: Add me controller
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-05 00:30:47 +01:00
Philip Molares
f6121b58e8
MediaService: Change deleteFile
The former deleteFile was moved to the public apis media controller and the actual deletion functionality was moved in a separate function to be called on user deletion.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-20 18:58:59 +01:00
Philip Molares
63fcca6c0d
UsersService: Add unit tests
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-05 00:30:19 +01:00