Commit Graph

27 Commits

Author SHA1 Message Date
Kristaps Fabians Geikins f27f289dc6 chore(server): core IoC #78 - getServerInfoFactory 2024-10-17 12:37:43 +03:00
Kristaps Fabians Geikins 573970fc6c chore(server): core IoC #55 - createUserFactory 2024-10-15 12:55:33 +03:00
Kristaps Fabians Geikins 1cb27e6fdd chore(server): core IoC #51 - getUser(s)Factory 2024-10-14 17:24:11 +03:00
Kristaps Fabians Geikins 30331c6f8e chore(server): core IoC #48 - markCommitStreamUpdatedFactory 2024-10-14 16:01:53 +03:00
Alessandro Magionami d489975037 Activitystream IoC 4 addCommitCreatedActivity (#3239)
* chore(activitystream): addStreamUpdatedActivity refactor multi region

* chore(activitystream): addStreamAccessRequestedActivity refactor multiregion

* chore(activitystream): addStreamAccessRequestDeclinedActivity refactor multiregion

* chore(activitystream): onUserCreated refactor multiregion

* chore(activitystream): addCommitCreatedActivity refactor multiregion

* chore(activitystream): fix types
2024-10-11 15:49:38 +02:00
Kristaps Fabians Geikins 6cb5022ac4 chore(server): IoC 35 - updateStreamRoleAndNotify 2024-10-09 16:31:20 +03:00
Kristaps Fabians Geikins a3252f88f3 chore(server): IoC 34 - updateStreamAndNotifyFactory 2024-10-09 12:54:10 +03:00
Kristaps Fabians Geikins aa4f319277 chore(server): IoC 32 - createStreamFactory (#3204) 2024-10-09 11:10:20 +03:00
Kristaps Fabians Geikins 84130ccfa1 chore(server): core IoC 27 - getObjectFactory 2024-10-07 18:55:33 +03:00
Fabis 857210be10 chore(server): core IoC 17 - createCommitByBranchIdFactory 2024-10-01 14:45:12 +01:00
Kristaps Fabians Geikins ba2198657d minor adjustment 2024-09-23 15:07:49 +03:00
Kristaps Fabians Geikins c92938eff3 chore(server): apollo server v3 -> v4 (#2880)
* main changes seem to be done?

* lint fix

* minor cleanup

* dataloader clear
2024-09-05 12:27:13 +03:00
Iain Sproat 60251e45cb Revert "fix(server): revert 55cad9662a (#2633)" (#2650)
This reverts commit f2c5677b4a.
2024-08-13 11:48:20 +01:00
Iain Sproat f2c5677b4a fix(server): revert 55cad9662a (#2633)
* Revert "refactor(server/upload): convert js to ts (#2618)"

This reverts commit e9f7286f67.

* Revert "feat(logging): pass request logger to core/services/objects (#2599)"

This reverts commit ee3e9af78d.

* Revert "feat(server): configurable maximum objects POST size and improved logging (#2594)"

This reverts commit 55cad9662a.
2024-08-12 10:26:53 +01:00
Iain Sproat ee3e9af78d feat(logging): pass request logger to core/services/objects (#2599)
* chore(logging): include additional detail on object upload logs

* allow max file size to be configurable

* feat(logging): add logger to core/services/objects

* fix log line

* fix tests

* typo

* fix variable name

* convert values to megabytes

* calculating memory was causing the system to freeze

* calculating memory was causing the system to freeze

* DRY the logging metadata

* all required variables should be passed to calculateLogMetadata

* fix many things with the logging
2024-08-09 10:15:37 +02:00
Kristaps Fabians Geikins b02a07e2b6 feat: Frontend 2.0 MVP 2023-05-08 10:47:01 +03:00
Iain Sproat a537d34dcc Rate limit all endpoints (#1213)
* Demonstration of bug to test when middleware added
- Adding middleware, even no-op, causes test to fail

* Make middleware async, but introduce delay.
Revert test back to original.

* Revert tests

* Add a 1ms sleep to the test to reduce likelihood of flakiness

* Rate limiting on all express endpoints using middleware

* Adds all configuration for existing rate limited endpoints

* It is helpful to add the package to yarn first

* Implements respectsLimits using Redis rate limiter

* Fix for test `Should rate-limit user creation`
- if rate limit error, post to `/auth/local/register` will return a 429 status code

* All rate limiting provided by new ratelimiter.ts

* Consolidate typescript interfaces

* Amend signature of function to require source to be passed in, and not try to guess it from the request

* Rename respectsLimits to isWithinRateLimits

* Throw within catch of Promise

* Replace rejectsRequestWithRatelimitStatusIfNeeded throughout code

* Sending rate limit response should deal with other types of error
- Sentry notified of the error

* Express middleware rate limits by a 3 second burst or a daily rate
- Provide action when generating 429 response

* Prevent DOS of Redis

* Add 'Retry-After' for all cases when responding with 429 status code
- default of 1 day, but dynamic based on available information

* Generate rate limiters once, on init
- Improved and consistent handling of exit from functions
- fixed environment variable names

* WIP Refactor rate limiting setup

Co-authored-by: Iain Sproat <iainsproat@users.noreply.github.com>

* WIP: fixed references, now runs but tests fail

* Use getSourceFromRequest where possible

* WIP: unit tests for rate limiter

* Unit tests for ratelimiter

* feat(IFC): WIP IFC parser improvements

* Revert "feat(IFC): WIP IFC parser improvements"

This reverts commit 093089a2c4.

* refactor authz, rate limiting middleware to global

Co-authored-by: Kristaps Fabians Geikins <fabis94@users.noreply.github.com>
Co-authored-by: Iain Sproat <iainsproat@users.noreply.github.com>

* invites tests fix

* fix(server ratelimiter): export public interfaces

* Unit test for rate limiter use in memory rate limiter
- in memory rate limiter is configured with zero limit by default

* Fixed #1219 (#1221)

* WIP: improve auth test for rate limiting user creation

* ci(circleci config): publishing was broken when main branch was tagged (i.e. for releases) (#1224)

* Gitignore CPU profiles

* All tests are  now passing locally

* Fixed an issue in the frontend which was causing the views not to work. Fixed an issue with object selection camera animation where the dolly lerp factor was much too high for smooth animation (#1225)

* feat(structured logging): implements structured logging for backend (#1217)

* each log line is a json object
* structured logging allows logs to be ingested by machines and the logs to be indexed and queried addresses #1105
* structured logging allows arbitrary properties to be appended to each log line, and ingestion of logs to remain robust
* Structured logging provided by `pino` library
* Add `express-pino-logger` dependency
* Remove `debug`, `morgan`, and `morgan-debug` and replace with structured logging
* `console.log` & `console.error` replaced with structured logging in backend
* Remove `DEBUG` environment variable and replace with `LOG_LEVEL`
- Note that there is a test which reads from a logged line on `stdout`. This is not robust, it would be better to use the childProcess.pid to look up the port number.
* Log errors at points we explicitly send error to Sentry
* Amend indentation of a couple of log messages to align indentation with others

* Revert "feat(structured logging): implements structured logging for backend (#1217)" (#1227)

This reverts commit 84cb74e8b3.

* Move error to core/errors
- augmented typescript types moved to type-augmentations

* Added a missing wait in the screenshot generation loop (#1228)

* refactor(server rest api): remove duplicate rate limit requests

* feat(server rate limits): increase rate limits for the upload endpoints

* chore(server rate limits): final cleanup

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
Co-authored-by: Iain Sproat <iainsproat@users.noreply.github.com>
Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
Co-authored-by: Kristaps Fabians Geikins <fabis94@users.noreply.github.com>
Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
Co-authored-by: Alexandru Popovici <alexandrupopoviciioan@gmail.com>
2022-11-29 17:06:11 +01:00
Kristaps Fabians Geikins 8e59ee7243 refactor: moving away from 'user' query (#1046)
* refactor: moving away from 'user' query + various fixes

* fix: linting issue in stream tests

* fix(server): some tests broken after rebase onto main
2022-10-06 12:08:08 +03:00
Kristaps Fabians Geikins db6a3e9367 refactor(server): apollo server v2 -> v3 migration (#1071) 2022-10-06 11:12:16 +03:00
Gergő Jedlicska d1d5984e30 gergo/summaryEmails (#979)
* refactor(server emails): email transports module refactor to TypeScript

* refactor(docker-compose deps): move local email server to common dev compose file

* chore(server launch.json): add ts-node script running example

* chore(server deps): add nodemailer types package

* refactor(server activitystream): add strongly typed activity definitions

* feat(server activitystream): add activity repository

* feat(server info): add canonical url on the service level

* feat(server): add static file serving route to server core

* feat(server): add dependencies for periodical email digests

* feat(server activity stream): call the initialization step from the activity stream module

* feat(server activity digest): add WIP weekly email digest implementation

* feat(server digest email): smul upgrades and fixes to the email template and its contents

* just for Fabs to test

* chore(root package.json): remove deleted docker-compose references

* feat(frontend profile): add notification preferences panel

* feat(server digest emails): set prod ready cron tab and timespan

* refactor(server email digest): move templates into the email module

* refactor(server activity digests): refactor to use notifications infrastructure

* test(server activities): add tests and some refactor to activities and notification preferences

* refactor(notification preferences): fix minor issues

* test(server notification preferences test): fix describe nesting

* fix(server activities): add missing action types

* fix(server activities): fix errors after merging main

* test(server activity notifications): add test coverage for activity notifications service

* refactor(server activities): fixing tests and some cleanup

* feat(server cli): add summary notification command to cli

* chore(dev env db versions): upgrade local dev env versions

* chore(server deps): upgrade local dev db to pg 14

* fix(docker-compose): bind maildev to localhost

* process-scoped notifications test queues

* test(activity tests): add  sleep to fix flaky CI

* feat(activity digests): add demo date for digest trigger

* feat(activity digest): add UK timezone trigger date

Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
Co-authored-by: Fabians <fabis94@live.com>
2022-09-09 12:46:57 +02:00
Kristaps Fabians Geikins 651dee0977 feat(server): stream discoverability flag & queries (#948) 2022-08-24 13:46:24 +03:00
Fabians a10c49e731 feat: stream comment attachments 2022-06-28 15:26:38 +03:00
Fabians 1b963ee44d feat: smart text editor & integration into stream comments 2022-06-10 16:46:57 +03:00
Gergő Jedlicska 67cb97a262 gergo/testCommentsGQL (#775)
* yarn first go

* fix frontend build cache loader

* yarn workspaces built server Docker

* build(yarn): add workspaces plugin config

* chore(package defs): clean package*.json -s

* chore(gitignore): ignore yarn error log

* build(yarn): update yarn lock

* build(preview-service webpack): add extra resolved path to preview service webpack config

because of yarn package hoisting, there are no package level node_modules folder anymore.

* build(docker): update dockerignore with yarn specific configs

* build(docker): update Dockerfiles for yarn workspaces utilization

* ci(circleci): update server test job to yarn

* ci(circle): disable cache restore

* ci(circleci): trying the node orb yarn-run

* ci(circleci): yarn-run again

* ci(circleci): disable node orb

* ci(circleci): change base node image for tests

* ci(circleci): add yarn cache

* ci(circleci): remove node install step

* ci(circleci): add server specific cache archives

* ci(circleci): test build and publish

* ci(circleci): change npm auth method to suit yarn

* ci(circleci): trying new builder image

* ci(circleci): another base image, maybe this works

* ci(circleci): force a specific docker engine version

* ci(circleci): add yarn version plugin and its changes

* ci(circleci): cleanup and remove temp branch config

* chore(package defs): moving from npm run to yarn

* explicitly specifying webpack4 as a frontend dep

* chore(package defs): replace npm with yarn everywhere

* docs(root readme): update with some yarn specific docs

* test(server comments gql): add wip server comments gql tests

* test(server comments graphql): add missing test operations and generate a bunch of testcases

* test(server comments graphql api): fix all authz test cases for comments

* test(server comments service): fix comments service failing test

* fix(tests): do not look inside

Co-authored-by: Fabians <fabis94@live.com>
Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
2022-06-02 11:15:27 +02:00
Fabians abe6d5e086 chore: re-formatted everything with prettier 2022-03-30 12:54:24 +03:00
Gergő Jedlicska b8040eebb5 test(server comments): add archival tests 2022-03-17 17:58:09 +01:00
Gergő Jedlicska f1276b03fe feat(server): add screenshot to comments 2022-03-09 12:36:10 +01:00