123 Commits

Author SHA1 Message Date
Tom Moor
117c4f5009 feat: Comment resolving (#7115) 2024-07-02 03:55:16 -07:00
Hemachandar
1bf9012992 feat: Add lastUsedAt to API keys (#7082)
* feat: Add lastUsedAt to API keys

* rename column to lastActiveAt

* switch order
2024-06-20 06:18:35 -07:00
Hemachandar
3af9861c4a feat: add API key expiry options (#7064)
* feat: add API key expiry options

* review
2024-06-18 18:34:45 -07:00
Tom Moor
593f7a79b8 Remove ability to create additional API keys with an existing API key 2024-06-05 06:53:07 -04:00
Tom Moor
c9d5ff7ca5 fix: Remove trust of state.host in auth error redirect 2024-06-05 06:45:23 -04:00
Tom Moor
86abd274b0 fix: Simplify redirect logic for self-hosted (#6867) 2024-05-04 07:45:31 -07:00
Tom Moor
b458bb3af9 Refactor required route role 2024-04-06 21:43:15 -04:00
Tom Moor
8ee266f7b1 chore: Track lastActiveAt for teams (#6491) 2024-02-04 11:14:18 -08:00
Tom Moor
c2b7d01c7d feat: Add setting to allow users to send invites (#6488) 2024-02-03 17:37:39 -08:00
Tom Moor
aadd916336 fix: Mismatch between route registered vs checked for custom rate limiters 2024-01-22 22:40:17 -05:00
Apoorv Mishra
7e61a519f1 Type server models (#6326)
* fix: type server models

* fix: make ParanoidModel generic

* fix: ApiKey

* fix: Attachment

* fix: AuthenticationProvider

* fix: Backlink

* fix: Collection

* fix: Comment

* fix: Document

* fix: FileOperation

* fix: Group

* fix: GroupPermission

* fix: GroupUser

* fix: Integration

* fix: IntegrationAuthentication

* fix: Notification

* fix: Pin

* fix: Revision

* fix: SearchQuery

* fix: Share

* fix: Star

* fix: Subscription

* fix: TypeError

* fix: Imports

* fix: Team

* fix: TeamDomain

* fix: User

* fix: UserAuthentication

* fix: UserPermission

* fix: View

* fix: WebhookDelivery

* fix: WebhookSubscription

* Remove type duplication

---------

Co-authored-by: Tom Moor <tom.moor@gmail.com>
2024-01-12 22:33:05 +05:30
Ray (Jui-Tse) Hung
78b9322a28 Fix Suspended User Login Error Redirect URL (#6297) 2023-12-16 16:34:55 -08:00
Tom Moor
b08a430131 docs 2023-11-15 20:31:21 -08:00
Nam Vu
68a3d327f6 Fix optional authentication (#6134) 2023-11-15 16:32:01 -08:00
Tom Moor
0964d03a17 More use of isProduction/isDevelopment getters 2023-11-09 19:24:16 -05:00
Tom Moor
a1b52e18dd chore: Centralize environment detection 2023-11-09 19:24:16 -05:00
Tom Moor
b2ad6ca9bc Refactor to middleware, support old routes 2023-11-01 23:52:18 -04:00
Tom Moor
d536fa9939 translation: team -> workspace 2023-10-18 08:32:43 -04:00
Tom Moor
5c7c9ceeb1 JSDoc, closes #5874 2023-09-23 14:31:55 -04:00
Apoorv Mishra
401d1ba871 multipart middleware (#5809)
* fix: multipart middleware

* fix: reviews
2023-09-12 10:21:58 +05:30
Tom Moor
ec0564eb32 chore: Test performance (#5786) 2023-09-06 14:19:21 -07:00
Tom Moor
3eb947e9a5 chore: Improve perf of server tests (#5785) 2023-09-06 04:14:49 -07:00
Tom Moor
74722b80f2 chore: Refactor file storage (#5711) 2023-08-20 07:04:34 -07:00
Tom Moor
b7bfc4bb1a chore: Remove optimize imports to allow vite upgrade (#5691) 2023-08-14 11:44:58 -07:00
Tom Moor
d587360f4b fix: Show desktop sign-in errors within the app 2023-05-21 11:54:38 -04:00
Tom Moor
2ceba5039b Add additional debug logging to InternalOAuthError case 2023-05-01 20:40:23 -04:00
Tom Moor
7d7781d795 Add additional debug logging to no user OIDC case
Related #5241
2023-05-01 20:23:35 -04:00
Apoorv Mishra
af3edd7cb2 fix: coalesce falsy body to {} (#4929) 2023-02-25 11:14:44 -08:00
Tom Moor
da4a0189dc Update rateLimiter.ts 2023-01-22 14:37:52 -08:00
Tom Moor
312e11e7c1 fix: Any error from rate limiter results in 'Rate limit exceeded' screen 2023-01-22 11:31:48 -05:00
Apoorv Mishra
b6141442b7 Validate API request query (#4642)
* fix: refactor to accommodate authentication, transaction and pagination together into ctx.state

* feat: allow passing response type to APIContext

* feat: preliminary work for initial review

* fix: use unknown for base types

* fix: api/attachments

* fix: api/documents

* fix: jsdoc comment for input

* fix: replace at() with index access for compatibility

* fix: validation err message

* fix: error handling

* fix: remove unnecessary extend
2023-01-05 20:24:03 +05:30
Apoorv Mishra
f4461573de Refactor to accommodate authentication, transaction and pagination states together (#4636)
* fix: refactor to accommodate authentication, transaction and pagination together into ctx.state

* feat: allow passing response type to APIContext
2023-01-04 23:51:44 +05:30
Tom Moor
05a4f050bb chore: Improve graceful server shutdown (#4625)
* chore: Improve graceful server shutdown

* Replace node timers with custom promise timeout
2022-12-31 13:56:27 -08:00
Tom Moor
c6fb764631 chore: Move tracing decorators into the codebase (#4623)
* Vendorize tracing, finally fix service name issues

* Upgrade datadaog-metrics, rename decorators -> tracing

* lint
2022-12-31 04:54:51 -08:00
Apoorv Mishra
053d10d893 Enhance server side error handling (#4537)
* fix: server side error handling

* fix: push only unknown 500 errors to sentry

* fix: use in-house onerror in favor of errorHandling middleware

* fix: split error template into dev and prod envs

* fix: check Error instance

* fix: error routes in test env

* fix: review comments

* Remove koa-onerror

Co-authored-by: Tom Moor <tom.moor@gmail.com>
2022-12-09 21:51:42 +05:30
Tom Moor
d6d1eb4485 feat: Prefix api keys 2022-12-03 18:21:33 -05:00
Tom Moor
cc333637dd Desktop support (#4484)
* Remove home link on desktop app

* Spellcheck, installation toasts, background styling, …

* Add email,slack, auth support

* More desktop style tweaks

* Move redirect to client

* cleanup

* Record desktop usage

* docs

* fix: Selection state in search input when double clicking header
2022-11-27 15:07:48 -08:00
Apoorv Mishra
a6125be6f1 Introduce zod for server-side validations (#4397)
* chore(server): use zod for validations

* fix(server): use ctx.input for documents.list

* fix(server): schema for documents.archived

* fix(server): documents.deleted, documents.viewed & documents.drafts

* fix(server): documents.info

* fix(server): documents.export & documents.restore

* fix(server): documents.search_titles & documents.search

* fix(server): documents.templatize

* fix(server): replace nullish() with optional()

* fix(server): documents.update

* fix(server): documents.move

* fix(server): remaining

* fix(server): add validation for snippet min and max words

* fix(server): fix update types

* fix(server): remove DocumentSchema

* fix(server): collate duplicate schemas

* fix: typos

* fix: reviews

* chore: Fixed case of Metrics import

* fix: restructure /api

* fix: loosen validation for id as it can be a slug too

* Add test for query by slug
Simplify import

Co-authored-by: Tom Moor <tom.moor@gmail.com>
2022-11-24 10:11:43 +05:30
Tom Moor
0794450596 chore: Fixed case of Metrics import 2022-11-22 23:08:52 -05:00
Tom Moor
c916d4f594 spike: db transaction as middleware (#4301) 2022-10-26 17:38:37 -07:00
Tom Moor
87e3f18e6d chore: Remove method override middleware (#4315)
* chore: Remove method override middleware

* wip

* CodeQL

* max/min
2022-10-18 16:03:25 -07:00
Tom Moor
1fbc000e03 chore: Reduce test boilerplate (#4300)
* chore: Reduce test boilerplate

* mo
2022-10-15 19:40:21 -07:00
Tom Moor
f8912732b8 chore: Flag users with platform used 2022-09-18 17:53:55 -04:00
Tom Moor
c85f3bd7b4 fix: Remove ability to use GET for RPC API requests by default (#4042)
* fix: Remove ability to use GET for RPC API requests by default

* tsc
2022-09-02 01:05:40 -07:00
Tom Moor
212985e18f feat: Allow viewers to be upgraded to editors on individual collections (#4023)
* Improve types

* More types, fix default permission for viewers added to collection

* fix change of default role for CollectionGroup

* Restore policy

* test

* tests
2022-08-30 23:12:27 -07:00
Tom Moor
85dab03820 docs 2022-08-16 19:43:50 +02:00
Tom Moor
a326e0ee88 chore: Rate limiter audit (#3965)
* chore: Rate limiter audit api/users

* Make requests required

* api/collections

* Remove checkRateLimit on FileOperation (now done at route level through rate limiter)

* auth rate limit

* Add metric logging when rate limit exceeded

* Refactor to shared configs

* test
2022-08-14 08:04:04 -07:00
Apoorv Mishra
0c51bfb899 perf: reduce memory usage upon running server tests (#3949)
* perf: reduce memory usage upon running server tests

* perf: plug leaks in server/routes

* perf: plug leaks in server/scripts

* perf: plug leaks in server/policies

* perf: plug leaks in server/models

* perf: plug leaks in server/middlewares

* perf: plug leaks in server/commands

* fix: missing await on db.flush

* perf: plug leaks in server/queues

* chore: remove unused legacy funcs

* fix: await on db.flush

* perf: await on GC to run in between tests

* fix: remove db refs

* fix: revert embeds

* perf: plug leaks in shared/i18n
2022-08-11 21:39:17 +05:30
Apoorv Mishra
7eaa8eb961 feat: Put request rate limit at application server (#3857)
* feat: Put request rate limit at application server

This PR contains implementation for a blanket rate limiter at
application server level. Currently the allowed throughput is set high
only to be changed later as per the actual data gathered.

* Simplify implementation

1. Remove shutdown handler to purge rate limiter keys
2. Have separate keys for default and custom(route-based) rate limiters
3. Do not kill default rate limiter because it is not needed anymore due
   to (2) above

* Set 60s as default for rate limiting window

* Fix env types
2022-08-11 15:40:30 +05:30
Nan Yu
74d9409cc3 fix: refactor auth flow to explicitly pass in a host (#3909)
* fix: refactor auth flow to explicitly pass in a host

* add new error handler to all SSO providers

* refactor passport error into middleware
2022-08-04 02:00:52 -07:00