Tilman Vatteroth
25ee20c15d
refactor: rename ready function to match its intent
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-07-06 12:07:03 +02:00
Tilman Vatteroth
f4a1999a8b
fix(communication): send ready event when both sides are ready
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-28 21:50:48 +02:00
Tilman Vatteroth
bb54746ccf
fix(backend): prevent realtime connections getting prepared for closed websocket
...
The setAdapter function checks if the websocket is closed.
If this is the case then an error is thrown and the whole process will be canceled. If the adapter isn't set before the realtime connection object is prepared then the connection will subscribe to all the events and THEN the process will be canceled. Because the MessageTransporter has no adapter (and won't get one), the connection will never get a disconnect event and clean up.
This causes the flood of "cant send message over closed websocket" messages.
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-27 15:19:49 +02:00
David Mehren
4d50f2ec33
fix(backend): immediately use our custom logger
...
While the DI and database initialization is running, NestJSs default logger is normally used. Our custom logger was only being initialized after DI setup is complete.
Errors encountered during DI setup were buffered and only printed after DI init was complete, or the app exited on error.
This led to the app not printing anything for a minute in certain cases.
This commit replaces the initial logger with our ConsoleLoggerService that logs everything.
After DI init is complete, that logger is replaced with a normal instance of ConsoleLoggerService that uses the real config from DI.
Fixes https://github.com/hedgedoc/hedgedoc/issues/4306
Signed-off-by: David Mehren <git@herrmehren.de>
2023-06-25 21:49:01 +02:00
Tilman Vatteroth
cf02c35b49
fix: save created revision on realtime note destroy
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-21 14:17:25 +02:00
Avinash
b3eb6e4339
feat: increased test coverage for authService
...
Signed-off-by: Avinash <avinash.kumar.cs92@gmail.com>
2023-06-21 14:07:00 +02:00
Avinash
239e21f4cb
refactor: removed unused userServices
...
Signed-off-by: Avinash <avinash.kumar.cs92@gmail.com>
2023-06-21 14:07:00 +02:00
Tilman Vatteroth
c25c0fac92
fix: don't save revisions on creation
...
sometimes we create revisions for notes that don't exist yet. If we try to persist a revision that is referring to a non-existing note the whole attempt crashes.
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-20 11:44:38 +02:00
Tilman Vatteroth
bb355feddc
fix: improve and adjust tests
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-20 11:44:38 +02:00
Tilman Vatteroth
eb986b1504
test: improve select query mock builder
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-20 11:44:38 +02:00
Tilman Vatteroth
f95f5406be
fix: make other services use the revision create method
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-20 11:44:38 +02:00
Tilman Vatteroth
7161ffd5f2
fix: adjust seeding to new revision create signature
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-20 11:44:38 +02:00
Tilman Vatteroth
e84096b5dc
feat: generate metadata from content on revision creation
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-20 11:44:38 +02:00
Tilman Vatteroth
90df9a4e32
feat: move title and description to revision entity
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-20 11:44:38 +02:00
Tilman Vatteroth
ac825edbe3
fix: replace RouterModule from nest-router with @nestjs/core
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-16 23:00:06 +02:00
Philip Molares
0a8945d934
feat(backend): handle username always in lowercase
...
This should make all usernames of new users into lowercase. Usernames are also searched in the DB as lowercase.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-04 21:55:19 +02:00
Tilman Vatteroth
753c6e593f
refactor: remove isomorphic-ws
...
The package caused some issues while working on other features.
Mostly because bundlers have been unable to determine the correct
websocket constructor.
So I replaced it with a more object-oriented approach.
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-06-02 17:40:25 +02:00
Tilman Vatteroth
d1ce1cb3e4
refactor: turn random word list source from json to ts
...
This prevents future import issues
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-30 09:17:05 +02:00
Tilman Vatteroth
11ccd678de
test: add test for permissions guard
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
a852c79947
refactor: replace permission check methods with ordered permission enum
...
This commit replaces the "mayWrite", "mayRead" and "checkPermissionOnNote"
functions with one that returns a sortable permission value.
This is done because many places in the code need to do actions based on the fact if
the user has no, read or write access. If done with the may-functions then the permission
data need to be looked through multiple times.
Also, the whole check code is split into more functions that are tested separately and make it easier
to understand the process.
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
4e298cccfb
refactor: make class fields of permissions guard read-only
...
They're only read and never written after the construction
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
6e0e63688b
refactor: allow only one required permission in require-permission decorator
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
9ca6485219
refactor: extract permission metadata key
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
488238d854
refactor: rename "Permissions" enum to "RequiredPermission"
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
6b73016583
refactor: rename "Permissions" decorator to "RequirePermission"
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
4c384cc8de
test: add test for get note interceptor
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
b1dc383a7a
refactor: use "extractNoteFromRequest" in permission guard
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
ab5aebc9c4
refactor: extract "extract note from request" logic into separate function
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
65fb110a1e
refactor: move permissions decorator and guard into permissions directory
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Tilman Vatteroth
22f0abbfbe
fix: remove redundant permission guard annotations
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-19 19:10:45 +02:00
Avinash
e73d28dba1
feat(backend): added test realtime note service
...
Signed-off-by: Avinash <avinash.kumar.cs92@gmail.com>
2023-05-15 20:49:59 +02:00
Avinash
d15a8b18d9
fix(backend): updated realtime connection's acceptEdit, close connection based on permission
...
Signed-off-by: Avinash <avinash.kumar.cs92@gmail.com>
2023-05-15 20:49:59 +02:00
Tilman Vatteroth
e3a3690b58
refactor(realtime): solve circle dependencies in realtime-user-status-adapter.ts
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-15 17:59:28 +02:00
Tilman Vatteroth
39fff87f52
fix: migrate import code
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-12 19:14:34 +02:00
Tilman Vatteroth
d29e840bc6
fix(realtime): allow realtime user status updates from users that have read-only access
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-09 20:33:23 +02:00
Tilman Vatteroth
b199cdba67
test: increase coverage of constructor tests
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-09 12:33:09 +02:00
Tilman Vatteroth
2f59869e12
fix: retrieve read-only state for realtime user status adapter from connection
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-09 12:33:09 +02:00
Tilman Vatteroth
f012282a41
fix: restore of test state
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-09 12:33:09 +02:00
Tilman Vatteroth
02a3b7f07b
refactor: make displayName readonly
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-09 12:33:09 +02:00
Tilman Vatteroth
3c1ea7bda9
fix: allow change of accept edits in realtime connection
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-09 12:33:09 +02:00
Tilman Vatteroth
eebbb79d08
fix: retrieve read-only state for y-doc-sync-server-adapter from connection
...
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-09 12:33:09 +02:00
Yannick Bungers
ed3c688e8b
refactor: extract mocking in permissions.service.spec.ts
...
Signed-off-by: Yannick Bungers <git@innay.de>
2023-05-07 20:45:15 +02:00
Yannick Bungers
d73bbcaeff
fix: increase test coverage
...
Signed-off-by: Yannick Bungers <git@innay.de>
2023-05-07 20:45:15 +02:00
Yannick Bungers
dad60a25ea
fix: change logging from id to publicId in media upload
...
Signed-off-by: Yannick Bungers <git@innay.de>
2023-05-07 20:45:15 +02:00
Yannick Bungers
c20e20b30a
refactor: exclude create permission from note permission check
...
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-07 20:45:15 +02:00
Yannick Bungers
fad5e1e22e
test: add private api tests for checkPermissionOnNote and checkMediaDeletePermission
...
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-07 20:45:15 +02:00
Yannick Bungers
001a49329c
refactor: extract permission checking from controllers and guard
...
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-07 20:45:15 +02:00
Yannick Bungers
485f7cd338
feat: Add guest file uploads and add deletion for note owners
...
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-07 20:45:15 +02:00
Yannick Bungers
0f464dedfe
fix: clean up decorators in the public notes.controller.ts
...
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-07 20:45:15 +02:00
Yannick Bungers
d369132519
fix: add CompleteRequest type to have better type checks for HTTP-Request attribute injection.
...
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-05-07 20:45:15 +02:00