Commit graph

3153 commits

Author SHA1 Message Date
Philip Molares
c593965d5a 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-05 23:08:32 +01:00
Philip Molares
7cdb40585e 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-05 23:08:32 +01:00
Yannick Bungers
1e0b38ce23
Merge pull request #844 from hedgedoc/fix/logging-context
Add missing logging context at various places
2021-02-05 22:45:16 +01:00
David Mehren
8b62b7d93c
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
David Mehren
763f67d5fb
Merge pull request #801 from hedgedoc/feature/history 2021-02-05 21:30:52 +01:00
David Mehren
3fd0328feb
Merge pull request #833 from hedgedoc/docs/develop-cleanup 2021-02-05 19:46:30 +01:00
David Mehren
7ddcfc5b2c
Merge pull request #832 from hedgedoc/doc/apiTags
[Docs] Add api tags to group controller
2021-02-05 19:46:17 +01:00
Philip Molares
88ed1ec8ba 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-05 14:13:34 +01:00
David Mehren
d4dcae7d79
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:55:27 +01:00
Philip Molares
24ccb1fcd0 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-04 21:50:19 +01:00
Philip Molares
1becc9b3d2 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-04 21:50:19 +01:00
Philip Molares
10ef4fcee1 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-04 21:50:19 +01:00
Philip Molares
7f1afc30c9 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-04 21:50:19 +01:00
Philip Molares
b76fa91a3c 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-04 21:50:14 +01:00
David Mehren
55703e0aec
Delete old docs not relevant for 2.x
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-04 21:47:04 +01:00
David Mehren
8a65dceef0
Merge pull request #793 from hedgedoc/renovate/lock-file-maintenance
Lock file maintenance
2021-02-04 15:22:59 +01:00
David Mehren
ad8dacd850
Merge pull request #803 from hedgedoc/feature/renovate-all
renovatebot: Configure renovatebot to update 1.x and 2.x branches
2021-02-03 10:59:02 +01:00
Sheogorath
0b2752e7db
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:33:06 +01:00
Renovate Bot
757ce5a84d
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-01 22:38:57 +00:00
David Mehren
315e149cb6
Merge pull request #792 from hedgedoc/renovate/mkdocs-material-6.x
chore(deps): update dependency mkdocs-material to v6.2.7
2021-02-01 23:37:38 +01:00
Yannick Bungers
5299cfb0c1
Merge pull request #789 from hedgedoc/docs/branch_confusion 2021-02-01 22:21:39 +01:00
David Mehren
5660d73e15
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 22:19:10 +01:00
David Mehren
7de88a7946
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-02-01 22:18:59 +01:00
Renovate Bot
34de07fbc7
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
5a207c4ab4
Merge pull request #787 from hedgedoc/chore/commit-guidelines
Add commit guidelines to contribution docs
2021-02-01 21:43:10 +01:00
David Mehren
f7f2752af7
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-02-01 21:40:38 +01:00
David Mehren
6bce4c241b
Merge pull request #786 from hedgedoc/refactor/dto 2021-02-01 20:19:36 +01:00
David Mehren
5cb8173070
Merge pull request #790 from hedgedoc/github/support-template
Add issue config to add external links to the community forum
2021-01-31 11:52:16 +01:00
Sheogorath
495ca5bbc9
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-31 01:51:37 +01:00
Yannick Bungers
c2b6c6fe49 Reformat code by yarn format
Signed-off-by: Yannick Bungers <git@innay.de>
2021-01-31 00:12:00 +01:00
Philip Molares
a7f35aaeec tests: Fix tests as part of the DTO Refactor
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-31 00:11:58 +01:00
Yannick Bungers
b07d6d478c 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:15:05 +01:00
Yannick Bungers
3431934ceb
Merge pull request #778 from hedgedoc/fix/secretLength 2021-01-29 22:27:54 +01:00
Philip Molares
08b3dd5db9 auth: Fix undefined secret error
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-29 22:24:19 +01:00
Philip Molares
ba517b3cfe 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
5a727d530b 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-29 21:32:54 +01:00
David Mehren
b49c802c79
Merge pull request #776 from hedgedoc/fix/UnauthorizedException
auth: Fix handling of internal server errors
2021-01-29 20:52:36 +01:00
Philip Molares
84915b61ac 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-29 20:33:56 +01:00
David Mehren
63b61f304b
Merge pull request #783 from hedgedoc/renovate/ts-jest-26.x
chore(deps): update dependency ts-jest to v26.5.0
2021-01-29 19:24:55 +01:00
David Mehren
d8a02aa409
Merge pull request #780 from hedgedoc/fix/inconsistentEnvVars
config: Fix inconsistent env vars
2021-01-29 19:24:01 +01:00
Renovate Bot
1f26c992a1
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
Philip Molares
2f17291079 config: Fix inconsistent env vars
This should make the translation from env var name to config name and vice versa more consistent.

Fixes #751

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-28 23:28:16 +01:00
Yannick Bungers
333b5a07e6
Merge pull request #768 from hedgedoc/feat/split-openapi
Swagger: Split public and private API
2021-01-27 23:13:49 +01:00
David Mehren
13fcd72f2d
Merge pull request #770 from hedgedoc/renovate/nestjs-packages
fix(deps): update nestjs packages to v7.6.7
2021-01-27 20:07:14 +01:00
David Mehren
3ba64f15f1
Swagger: Split public and private API
Fixes #759

Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-27 20:02:25 +01:00
David Mehren
932cb636ff
Merge pull request #771 from hedgedoc/fix/base64Url 2021-01-27 19:49:02 +01:00
Renovate Bot
df3e389b6f
fix(deps): update nestjs packages to v7.6.7
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-27 17:26:10 +00:00
David Mehren
4d03577bba
Merge pull request #772 from hedgedoc/renovate/mkdocs-material-6.x
Update dependency mkdocs-material to v6.2.6
2021-01-27 18:25:36 +01:00
Renovate Bot
c39d159cf2
Update dependency mkdocs-material to v6.2.6
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-27 17:23:14 +00:00
David Mehren
b029d3100a
Merge pull request #769 from hedgedoc/renovate/pymdown-extensions-8.x
Update dependency pymdown-extensions to v8.1.1
2021-01-27 18:22:23 +01:00