Commit graph

4128 commits

Author SHA1 Message Date
renovate[bot]
877326717f
chore(deps): update dependency @typescript-eslint/parser to v4.31.1 (#1630)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-13 17:59:24 +00:00
Renovate Bot
86a4bac786
chore(deps): update dependency prettier to v2.4.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-09-13 17:49:41 +00:00
David Mehren
8093fe4f74
Merge pull request #1514 from hedgedoc/privateApi/auth/docs
docs: add documentation on private api authentication
2021-09-13 19:48:00 +02:00
David Mehren
cbc6be31d5
Merge pull request #1629 from hedgedoc/renovate/develop-test-packages
chore(deps): update dependency jest to v27.2.0 (develop)
2021-09-13 19:44:27 +02:00
David Mehren
8dc504f9ea
Merge pull request #1622 from hedgedoc/renovate/develop-linters
chore(deps): update linters (develop) (minor)
2021-09-13 19:43:49 +02:00
Renovate Bot
74ee75d92b
chore(deps): update linters
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-09-13 17:19:57 +00:00
Renovate Bot
73e1e96e79
chore(deps): update dependency jest to v27.2.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-09-13 08:47:08 +00:00
Philip Molares
bf3ec53c78 docs: add documentation on private api authentication
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-09-09 21:08:23 +02:00
David Mehren
67297f71a4
Merge pull request #1595 from Abhilasha06/deleteRevisions
Add new API to purge note history
2021-09-07 18:09:42 +02:00
Abhilasha Sinha
9d6aa10923 Add new API to purge note history #1064
Signed-off-by: Abhilasha Sinha <abhisinha662000@gmail.com>

Combine the describe block

Signed-off-by: Abhilasha Sinha <abhisinha662000@gmail.com>

Fix naming

Signed-off-by: Abhilasha Sinha <abhisinha662000@gmail.com>

Rename purgeRevision to purgeRevisions

Signed-off-by: Abhilasha Sinha <abhisinha662000@gmail.com>

Fix notes e2e test description

Signed-off-by: Abhilasha Sinha <abhisinha662000@gmail.com>

Add yarn.lock

Fix lint and format

Signed-off-by: Abhilasha Sinha <abhisinha662000@gmail.com>
2021-09-07 21:23:26 +05:30
renovate[bot]
8c8a32b6c4
chore(deps): update dependency @types/node to v14.17.15 (#1623)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-07 10:22:27 +00:00
renovate[bot]
32c42bfbc9
fix(deps): update dependency node-fetch to v2.6.2 (#1621)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-06 14:32:50 +00:00
David Mehren
7c618e7f9f
Merge pull request #1613 from hedgedoc/merge/tokenGuardAndStrategy 2021-09-06 12:12:44 +02:00
David Mehren
fe35f507b6
Merge pull request #1589 from hedgedoc/enhancement/getnotepipe 2021-09-06 12:12:15 +02:00
renovate[bot]
1d69dbf6fe
chore(deps): lock file maintenance (#1620)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-06 04:53:58 +00:00
renovate[bot]
d00b3a75e6
chore(deps): lock file maintenance (#1618)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-06 02:24:16 +00:00
David Mehren
9d21b5b786
Merge pull request #1615 from hedgedoc/readme-demo-develop
Update readme link to explanation page
2021-09-05 19:24:50 +02:00
Erik Michelson
419adb85bf
Update readme link to explanation page
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2021-09-05 11:57:45 +02:00
David Mehren
0dc472bba8
RevisionsService: Refactor getFirst/LastRevision
The functions now expect a `Note` object instead of a noteId to
make it more consistent with other functions.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 22:40:15 +02:00
David Mehren
5c7a787d7e
MediaService: Refactor saveFile
The function now expects a `Note` object instead of a noteId
and a `User` instead of a username to
make it more consistent with other functions.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 22:40:15 +02:00
David Mehren
279d90dad1
HistoryService: Remove getEntryByNoteIdOrAlias
As we now have a GetNotePipe, we can easily get rid of this function.
All clients can directly provide a `Note` instance
and use `getEntryByNote`.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 22:40:15 +02:00
David Mehren
b552fc10b6
HistoryService: Refactor deleteHistoryEntry
The function now expects a `Note` object instead of a noteId to
make it more consistent with other functions.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 22:40:15 +02:00
David Mehren
c515569299
HistoryService: Refactor updateHistoryEntry
The function now expects a `Note` object instead of a noteId to
make it more consistent with `updateHistoryEntryTimestamp`.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 22:40:15 +02:00
David Mehren
99db4bc336
UserService: Improve method naming
This renames `createOrUpdateHistoryEntry` to `updateHistoryEntryTimestamp`,
which reduces confusion with the similarly named
`updateHistoryEntry` function.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 22:40:15 +02:00
David Mehren
f667410b51
Public API: Test that forbidden notes can't be accessed
Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 22:40:15 +02:00
David Mehren
ea2dfafbd0
Private API: Use GetNotePipe
This replaces repeated calls to `noteService.getNoteByIdOrAlias`
and associated error handling with the `GetNotePipe`
in the `Param` decorator.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 21:42:54 +02:00
David Mehren
adc9ca6939
Public API: Remove superfluous try/catch
`getNoteMetadata` does not use a method that
can throw a `PermissionsUpdateInconsistentError`.
The try/catch-block seems to be a copy-paste error.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 21:42:54 +02:00
David Mehren
9da8d0efb0
Public API: Use GetNotePipe
This replaces repeated calls to `noteService.getNoteByIdOrAlias`
and associated error handling with the `GetNotePipe`
in the `Param` decorator.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 21:42:54 +02:00
David Mehren
1e3c08b3df
Implement GetNotePipe
This pipe transforms a note ID or alias to a Note object
by loading it from the database.
It also performs error handling

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 21:42:54 +02:00
David Mehren
5a47f208b4
Merge pull request #1599 from hedgedoc/renovate/develop-major-linters
chore(deps): update dependency eslint-plugin-prettier to v4 (develop)
2021-09-04 20:12:26 +02:00
David Mehren
1f017b33f2
Merge pull request #1598 from hedgedoc/renovate/develop-linters
chore(deps): update linters to v4.30.0 (develop) (minor)
2021-09-04 20:11:48 +02:00
Renovate Bot
bcdd42251b
chore(deps): update dependency eslint-plugin-prettier to v4
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-09-04 17:19:26 +00:00
Renovate Bot
defb2522df
chore(deps): update linters to v4.30.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-09-04 17:19:14 +00:00
David Mehren
83c36ee3f9
Merge pull request #1588 from hedgedoc/enhancement/requestuser_decorator
Introduce RequestUser decorator
2021-09-04 18:40:03 +02:00
Philip Molares
c22727dad7 refactor: move TokenAuthGuard in the same file as TokenStrategy
This should help to make clear why code is executed when the TokenAuthGuard is encountered by a request. Currently, one has to connect both files via the string 'token', which is a bit cryptic

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-09-04 18:09:17 +02:00
David Mehren
dc6d9dfc20
Merge pull request #1612 from hedgedoc/fix-toAuthTokenDtoTest
Fix copy paste error in auth toAuthTokenDto test
2021-09-04 17:12:06 +02:00
David Mehren
ba2e4b0e3a
Public API: Introduce RequestUser decorator
This introduces the `RequestUser` decorator
to extract the `User` from a request.

It reduces code duplication across the public API
and allows us to drop the override of the `Request` type from express.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-09-04 17:05:38 +02:00
Yannick Bungers
9c7ab01016 Fix copy paste error in auth toAuthTokenDto test
Add an hour difference between createdAt and validUntil to better detect
these errors.

Signed-off-by: Yannick Bungers <git@innay.de>
2021-09-03 19:19:55 +02:00
renovate[bot]
1a6e525446
chore(deps): update dependency mkdocs-material to v7.2.6 (#1606)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-01 22:18:35 +00:00
renovate[bot]
5dd0d21069
chore(deps): update dependency @types/node to v14.17.14 (#1603)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-01 00:40:16 +00:00
renovate[bot]
9b3f021a0b
chore(deps): update dependency @types/node to v14.17.13 (#1601)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-31 19:05:45 +00:00
renovate[bot]
99913acb8e
chore(deps): lock file maintenance (#1597)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-30 02:35:31 +00:00
David Mehren
664488e822
Merge pull request #1591 from hedgedoc/renovate/develop-pin-dependencies
chore(deps): pin dependency @trivago/prettier-plugin-sort-imports to 2.0.4 (develop)
2021-08-29 22:46:58 +02:00
David Mehren
bc04200f13
Merge pull request #1592 from hedgedoc/renovate/develop-linters
chore(deps): pin dependency eslint-plugin-prettier to 3.4.1 (develop)
2021-08-29 22:46:45 +02:00
Renovate Bot
de9e12e472
chore(deps): pin dependency eslint-plugin-prettier to 3.4.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-08-29 19:44:51 +00:00
Renovate Bot
d9c983d423
chore(deps): pin dependency @trivago/prettier-plugin-sort-imports to 2.0.4
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-08-29 19:44:38 +00:00
Yannick Bungers
d92b39eae2
Merge pull request #1590 from hedgedoc/chore/sort_imports 2021-08-29 21:16:00 +02:00
David Mehren
502b1b3202
Merge pull request #1573 from hedgedoc/renovate/develop-tsconfig-paths-3.x
chore(deps): update dependency tsconfig-paths to v3.11.0 (develop)
2021-08-29 20:09:06 +02:00
David Mehren
de56f962d3
Run prettier format checks in ESLint
This enables the prettier ESLint plugin.
In contrast to the prettier ESLint config (which is already enabled),
the plugin also runs checks against prettiers format rules
as part of ESLint.
This enables instant feedback in the editor,
when code violates the format rules and allows for quick-fix actions.

See also https://github.com/prettier/eslint-plugin-prettier#recommended-configuration

Signed-off-by: David Mehren <git@herrmehren.de>
2021-08-29 19:54:56 +02:00
David Mehren
3658204acb
Cleanup some imports
Signed-off-by: David Mehren <git@herrmehren.de>
2021-08-29 18:57:00 +02:00