Commit graph

594 commits

Author SHA1 Message Date
Philip Molares
a4075bff54
Config: Fix .env.example file
The old upload path was 'public/uploads'. As there is no public anymore, we should at least keep uploads.
So basically this is a typo fix

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-14 17:37:05 +01:00
Philip Molares
ea4ccc76e4
StaticServe: Fix serving images under uploads/
This did not work until now, because path and prefix were swapped.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-15 07:39:52 +01:00
Philip Molares
698dd1a634
PublicApi: Add correct prefix
Using nest-router for this purpose as it is a rather easy addition to our structure. As we don't add the Router to any e2e tests we don't need to change them.

fixes #523

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-15 10:26:12 +01:00
Philip Molares
0366cb491f
Media E2E Tests: Delete uploaded files after test
Remove uploaded files after media e2e tests ran
Remove /uploads/ folder after all media e2e tests ran
This way the uploads folder doesn't grow while working on other e2e tests

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-13 22:58:44 +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
Renovate Bot
24a5f2646a
Update dependency typeorm to v0.2.31
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-16 19:17:45 +00:00
Renovate Bot
4979b9c5bc
Update dependency @types/node to v13.13.42
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-16 19:14:30 +00:00
Renovate Bot
540aae7dd5
Update dependency class-transformer to v0.4.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-16 19:14:45 +00:00
Renovate Bot
96fd807d37
Update linters to v4.15.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-16 19:09:10 +00:00
Renovate Bot
5d1854483b
Update dependency sqlite3 to v5.0.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-16 19:08:39 +00:00
Philip Molares
c4875ff8ca
Package.json: Switch yarn format and format:check
Make `yarn format` check the files and `yarn format:fix` do the actually
fixing

fixes #920

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-16 10:28:55 +01:00
Renovate Bot
9b211cec6f
Update dependency eslint to v7.20.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-13 00:59:10 +00:00
Renovate Bot
9338d2c2cd
Update linters
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-12 22:27:03 +00:00
Renovate Bot
08a02de19b
Update dependency typescript to v4.1.5
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-12 22:21:49 +00:00
Renovate Bot
0ee37cf37b
Update dependency ts-jest to v26.5.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-12 22:21:20 +00:00
Renovate Bot
f3f3708451
Update dependency ts-loader to v8.0.17
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-12 22:17:13 +00:00
Renovate Bot
d8f3792bf1
Update dependency mkdocs-material to v6.2.8
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-12 22:11:16 +00:00
Renovate Bot
be8e06032c
Update dependency joi to v17.4.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-12 22:11:05 +00:00
Renovate Bot
8ce096b7f5
Update dependency @types/node to v13.13.41
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-12 22:03:57 +00:00
Renovate Bot
38151e4702
Update NestJS packages
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-12 21:55:30 +00:00
Hugo Peixoto
06bcb4ae1a
Remove license of deleted file
config.json.example was deleted, but the license file was not. This
removes the leftover file.

Signed-off-by: Hugo Peixoto <hugo.peixoto@gmail.com>
2021-02-10 09:57:30 +00:00
Philip Molares
5edf5f1676
Tests: Fix GET /me e2e test
Since the /me route does work now, we should reactivate (and fix) this test, too.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 16:20:27 +01:00
Philip Molares
07dc15b127
Dev Docs: Add configuration to navigation
This makes it possible to access the developer documentation about configuration code.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 20:58:16 +01:00
Philip Molares
b2009ebab9
Dev Docs: Add .env.example file
This file contains a minimal working config to get the backend up and running.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 20:51:36 +01:00
Philip Molares
57f76499f0
Dev Docs: Add configuration documentation
This explains how the configuration code works and give some hints on what do look out for while working on the configuration code.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 20:50:49 +01:00
David Mehren
99ddee7815
Add missing logging context at various places
Our custom logger supports providing the name of the function that
calls the logger, this commit adds this context string where it
was previously missing.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-05 22:30:22 +01:00
Philip Molares
0dbcc9a653
Docs: Add api tags to group controller
For a better structure of the autogenerated apidoc website tags are used. Each Controller get it's own tag and will be put in a separate section.

See https://docs.nestjs.com/openapi/operations#tags

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-04 13:44:08 +01:00
Philip Molares
744a55181e
Tests: Rename users.e2e-spec.ts to me.e2e-spec.ts
As users.e2e-spec.ts tests the MeController this commit renames the test appropriately

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 21:51:30 +01:00
Philip Molares
d457729ab7
Tests: Fix Mock Auth
This makes it possible to create the user before the mock auth guard does it's magic. This is necessary for some test, where we need the user object before the api is called.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 21:49:39 +01:00
Philip Molares
36f041f0e0
History: Add unit and e2e test
Add unit tests for history service
Adapt relevant me e2e tests to work

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 21:46:36 +01:00
Philip Molares
e55e62c2cd
History: Add history service and usage
Add history service to allow for CRUD operations.
Use history service in controllers to:
  1. Allow manipulating of history entries
  2. Guaranty the correct existence of history entries

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 21:22:55 +01:00
Philip Molares
300b464efd
History: Add HistoryEntry
With this the backend now can hold a history entry.
Also included in this commit are some minor changes to tests and services so they can still work.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 21:15:39 +01:00
David Mehren
2ee8ff4d91
Update docs with hint about 2.0 development
Replace the old docs index page with a hint where the (for now) 'real'
docs can be found and that HedgeDoc 2.0 is still in development.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-04 21:50:38 +01:00
David Mehren
effba43fe8
Delete old docs not relevant for 2.x
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-04 16:14:59 +01:00
Renovate Bot
7bf3f59dd8
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-01 22:38:57 +00:00
Sheogorath
93710eeb18
renovatebot: Configure renovatebot to update 1.x and 2.x branches
Currently renovatebot only cares about the default branch, which is
currently develop. In order to keep everything up-to-date we should
configure it, to also make sure that the master branch for 1.x will be
updated.

Therefore this patch adds the `baseBranches` config option, which allows
to define an array of branches to update.

Reference:

https://docs.renovatebot.com/configuration-options/#basebranches

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2021-02-02 22:16:33 +01:00
Renovate Bot
ea5ea73ae1
chore(deps): update dependency mkdocs-material to v6.2.7
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-01 21:06:50 +00:00
David Mehren
7efd73e02f
Expand PR template with hint about branches
Add a sub-step to the PR template to remind the user to use the correct
branch.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-01 21:53:37 +01:00
David Mehren
90674fb80e
Docs: Emphasize the difference between branches
To further reduce confusion between the `develop` and `master` branches,
this commit adds more information about them in the README
and the contribution docs.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-30 18:37:45 +01:00
David Mehren
c42871be66
Add commit guidelines to contribution docs
To ensure maintainability,
commit guidelines are added to our contribution documentation.
They include notes on commit structure and the commit message,
which evolved from issues that were encountered while developing.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-30 17:36:19 +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
Philip Molares
5920a1c72f
tests: Fix tests as part of the DTO Refactor
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-30 12:47:31 +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
Sheogorath
e8e269b1bb
Add issue config to add external links to the community forum
This patch adds a Issue template config, which can be used to link to
the forum for support requests as well as community discussions.

Note: The change in `.reuse/dep5` just makes sure the CI process doesn't
cry about licenses on files.

Reference:
https://docs.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2021-01-30 20:38:12 +01:00
Philip Molares
08ba52293c
auth: Fix undefined secret error
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-29 22:24:19 +01:00
Philip Molares
aa10e10412
auth: Fix UnauthorizedException throwing
Move conversion of Errors from AuthService to TokenStrategy.
This is necessary to correctly test the validateToken method.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-29 22:00:47 +01:00
Philip Molares
46b5cdfb47
auth: Fix secret length
The former length of 64 bytes (512-bit) is transformed into base64url (a 6-bit code) ~86 characters long. This is too long for bcrypt as it ignores any characters beyond the 72th.
This fix therefore reduces the amount of generated bytes to 54 (as 72*6/8 = 54) characters. This ensures that removing one character from the token the hash won't be the same anymore.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-28 12:18:20 +01:00
Philip Molares
8b27f6f393
auth: Fix handling of internal server errors
Catch all NotInDbErrors and TokenNotValidError and transform them to UnauthorizedException with the correct message.
This prevents nest from telling the api user that an internal server error has happened and instead display the correct http error code 401.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-27 21:55:30 +01:00
Renovate Bot
5a811b9109
chore(deps): update dependency ts-jest to v26.5.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-29 14:02:05 +00:00