Commit graph

27 commits

Author SHA1 Message Date
Jack 59b252389e
fix: backend/package.json & backend/package-lock.json to reduce vulnerabilities (#3945)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-SIMPLEGIT-3177391

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2023-01-25 23:21:53 +01:00
Miodec 7c34fa2591 upgraded swagger stats 2022-12-28 15:42:12 +01:00
Snyk bot 6813c707a0
fix: backend/package.json & backend/package-lock.json to reduce vulnerabilities (#3860)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-JSONWEBTOKEN-3180020
- https://snyk.io/vuln/SNYK-JS-JSONWEBTOKEN-3180022
- https://snyk.io/vuln/SNYK-JS-JSONWEBTOKEN-3180024
- https://snyk.io/vuln/SNYK-JS-JSONWEBTOKEN-3180026
2022-12-28 15:37:37 +01:00
Snyk bot 829a68b3e7
fix: backend/package.json & backend/package-lock.json to reduce vulnerabilities (#3814)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-GOT-2932019
- https://snyk.io/vuln/SNYK-JS-QS-3153490
2022-12-07 15:52:48 +01:00
Miodec 17d9733bba upgraded packages
cors
firebase-admin
simple-git
2022-11-15 12:44:24 +01:00
Bruce Berrios 9da5e441be
Add new rate limiting flow (#3230) Bruception
* Add new rate limiting flow

* Oops

* Fix nit

* Fix some bugs

* Split key generation functions

* Remove 429

* Change message for root limiter

* Flag 429 and add config

* Add status code config

* Check enabled flag

* Add custom status for ape keys

* Bump coverage

* swapped conditions around
whats the point of checking if the status code is in the array if the whole thing is turned off anyway

Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-06-28 13:45:57 +02:00
Bruce Berrios 0ef52ed9da
Add daily leaderboards (#3023) bruception
* Setup daily leaderboards backend (#2987) bruception

* Setup daily leaderboards backend

* Add enabled checks

* Consistent naming

* Add initial unit tests

* Use more flexible daily leaderboard rule logic

* Fix seed rule

* Add LRU Cache + Rank Calculation

* Use native functions

* Optional daily leaderboard rank

* Proper status code for invalid lb mode

* Add result criteria check

* Make daily leaderboard cache size configurable

* Add Ape endpoint for daily leaderboard (#2997)

* support for switching to viewing daily lbs

* test

* buttons

* only checking daily if user has more than 2 hours typed

* updated structure

* setting rank if its undefined

* only when daily

* storing uid

* fixed media queries

* Daily leaderboards pagination (#3006)

* Pagination

* Remove with scores

* Add daily leaderboard rank (#3014) Bruception

* Add daily leaderboard rank

* Remove unused import

* Use object instead

* Add client logic

* Add limit checks

* Announce top daily leaderboard results (#3017)

* Add rank in daily leaderboard results (#3022)

* not showing lb memory and top % on daily

* Fix rank pagination

* Actual fix

* showing new rank

Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-05-26 16:30:11 +02:00
Sondre Kjempekjenn afd288a717
Testing - mock setup for redis (#2944) 2022-05-05 14:05:31 -04:00
Sondre Kjempekjenn 88a587c5c2
Feature/backend test (#2937) sondrekje
* Switch to ts-node-dev for development

* Minimal setup for backend testing

* Basic controller test

* __tests__ directory

* Delete old DB client

* Improve tests, ensure DB cleanup only runs for inMemory DB
2022-05-05 15:19:31 +02:00
Rizwan Mustafa 020ac5cb24
Add logging support from Winston with colored output (#2774)
* Converted initial outputs to color outputs

* Some more coloring

* Colored all error outputs

* Completed coloring of outputs

* Created basic logger instance

* Moved over to Winston for logging

* Remove unnnecessary stuff

* Added max file size

* Renamed log to logToDb

* minor refactor and added tab separation with timestamps

* Some changes. Thanks Bruception

* Created wrapper for logger

* Tiny refactor

* Some fixes

* Some fixes

* Update example env

* Remove general

* using default yellow, making colors bold

* removed square brackets

* removed square brackets

* using logger instead of console log

* updated timestamp format

* moved comment up

* Fixed typo

Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-03-27 11:29:11 -04:00
Bruce Berrios ad8c433e45
Save exact (#2769) 2022-03-25 16:01:45 +01:00
Rizwan Mustafa 47c7fd42c7
Improve webpack - Reduced filesize by 18% by converting from node-object-hash to object-hash (#2768) rizwanmustafa
* Refreshed the PR

* not sending stringified result anymore

* removed length check

Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-03-25 15:36:04 +01:00
Evan cbca2a8957
Remove JavaScript Compilation from the Frontend (#2764) Ferotiq
* remove javascript compilation from frontend

* add dat back

* I'm going risky

* regen and put the type back
2022-03-25 13:19:21 +01:00
Bruce Berrios 4999fd4bf5
Add Redis client and george task queue (#2765) bruception
* Add Redis client and george task queue

* Add queue configuration

* Change dual write
2022-03-25 13:13:54 +01:00
Bruce Berrios 2dba957adc
Add public api docs (#2656) by bruce
* Add public documentation

* typo

* added hard limit on the leaderboards

* ignoring worker when compiling

* added leaderboard routes

* leaderboards accept apekeys

* Fix docs

* Fix

* Specify parse base

* Add ape rate limiter

* added documentation link

* updated message

Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-03-09 13:02:37 +01:00
Bruce Berrios 5aa6fd7621
Remove mongo types (#2637) 2022-03-04 19:20:40 -06:00
Bruce Berrios 0429c560ee
Migrate users controller (#2618)
* Migrate users controller + other things

* Undo import rename

* Fix return type

* Change status code

* Fix spacing
2022-03-03 14:50:06 -05:00
Bruce Berrios 2f70d1ab8a
Add ApeKeys CRUD (#2606)
* Add ApeKeys CRUD

* Fix

* Omit ape key data

* Encode id + key
2022-03-01 11:11:01 -05:00
Bruce Berrios 999e8636e1
Remove pii (#2602)
* Remove JWT tokens and ip addresses from records

* Use save exact

* Fix

* Fix

* Rename

* Downgrade status code

* Check if dev

* Make server stats still accessible in maintenance

Co-authored-by: Jack <jack@monkeytype.com>
2022-02-28 15:13:59 +01:00
Bruce Berrios 182d0b6b22
Add ape keys routing and configuration (#2599)
* Add ape keys routing and configuration

* Fix

* Add 404 route
2022-02-28 12:37:05 +01:00
Miodec b0c2e3e024 added prom client 2022-02-28 00:39:44 +01:00
Miodec c3b517cf10 added stats package 2022-02-28 00:06:12 +01:00
Bruce Berrios 8c5b88ef5d
Migrate files to ts (#2581) 2022-02-23 22:17:17 -06:00
Bruce Berrios 8dbf0966d1
Upgrade mongo library to 4.x.x (#2576) 2022-02-23 14:23:54 -05:00
Bruce Berrios f9d6f52c15
Api overhaul (#2555) by Bruception
* Feat:Update response structure (#2427)

* Fix:response and error structure

* update:response message

* update:response class

* update

* Update response message

Co-authored-by: Mustafiz Kaifee Mumtaz <mustafiz.mumtaz@freecharge.com>

* Add MonkeyToken foundation (#2487) by Bruception

* Api changes (#2492)

* API changes

* Remove unused import

* Add Ape client (#2513)

* Add all endpoints (#2514)

* Merged backend typescript into api overhaul (#2515)

* Install typescript and add backend tsconfig

Cannot yet build due to a number of compilation errors in JS code

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Fix typescript compilation errors

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Migrated backend to ES modules

Switched to import export syntax

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Add typescript declaration for anticheat

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Rename top level files to .ts

Fix service account json file typing

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Add dev build scripts for backend typescript

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Removed empty lines and switched to using db

Cleaned up imports by removing needless empty lines and migrated to the new db.js instead of mongodb.js.

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Fixed backend commonjs syntax to ES module syntax

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Add build to backend start script

Signed-off-by: Brian Evans <ebrian101@gmail.com>

* Migrate some endpoints to Ape

* Strict equals

* Remove artifact

* ape -> Ape

* Ape migration p2 (#2522)

* Migrate leaderboard endpoints to ape

* Fixed comment

* Init backend types

* Fail

* Return

* Migrate Quotes to Ape (#2528)

* Migrate quotes to Ape

* Fix backend response

* Fix issue

* Fix rate limit (#2533)

* fix rate limit

* Fix import

* Fix issues

* Ape migration p4 (#2547)

* Migrate results endpoints to ape

* Remove unused import

* Remove unused import

* Fix loaders

* Make function async

* Hide try saving results

* Migrate some users endpoints to Ape (#2548)

* Complete Ape Migration (#2553)

* Complete ape migration

* Fix preset

* Return preset data

* Add typings

* Move captcha reset

* Read from params

* Fix result tags endpoint

* Fix stuck loader

* fixed lb memory not saving

* fixed quote rating popup not showing up for new users

Co-authored-by: Mustafiz Kaifee <49086821+Mustafiz04@users.noreply.github.com>
Co-authored-by: Mustafiz Kaifee Mumtaz <mustafiz.mumtaz@freecharge.com>
Co-authored-by: Brian Evans <53117772+mrbrianevans@users.noreply.github.com>
Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-02-22 20:55:48 +01:00
Bruce Berrios ccafcee72d
Oops (#2446)
* fix

* Install all dependencies
2022-02-08 21:41:59 +01:00
Bruce Berrios 345740db5f
Separate backend and frontend dependencies (#2441) by Bruception
* Add request validation to user endpoints

* Remove tag id log

* Remove verbs from endpoints

* Remove old code

* Remove uid

* Fix

* Remove name from URI

* Rename utils

* Fix

* Move prettier

* Update gulp file

* Add additional scripts

* Update package-lock

* Update contributing.md

Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-02-08 20:33:41 +01:00