Merge branch 'mongo' of https://github.com/Miodec/monkeytype into mongo

This commit is contained in:
Miodec 2021-08-09 11:04:32 +01:00
commit 26d698c366
6 changed files with 9 additions and 15 deletions

View file

@ -62,7 +62,7 @@ Git is optional but we _highly_ recommend you use it. Monkeytype uses the Git so
- In your Firebase console, go to Project Settings > Service Accounts
- Click "Generate New Private Key"
- Save as `serviceAccountKey.json` in the `functions/` directory
- Save as `serviceAccountKey.json` inside the `backend/credentials/` directory. You will have to create the credentials folder.
1. Enable Firebase Authentication
@ -70,10 +70,12 @@ Git is optional but we _highly_ recommend you use it. Monkeytype uses the Git so
- Click on `Email/Password`, enable it, and save
- Click on `Google`, add a support email and save
## Prerequisite - Mongo Setup
#### Mongo Setup
1. Install [Mongodb Community Edition](https://docs.mongodb.com/manual/administration/install-community/) and ensure that it is running
1. Inside the backend folder, copy `example.env` to `.env` in the same directory.
1. Optional - Install [Mongodb-compass](https://www.mongodb.com/try/download/compass?tck=docs_compass). This tool can be used to see and manipulate your data visually.
1. To connect, type `mongodb://localhost:27017` in the connection string box and press connect. The monkeytype database will be created and shown` after the server is started.

View file

@ -22,7 +22,7 @@ app.get("/getBananas/:discordId", botAuth, (req, res) => {
app.get("/getUserDiscordData/:uid", botAuth, (req, res) => {
//for announceDailyLbResult
User.findOne({ uid: req.body.uid }, (err, user) => {
User.findOne({ uid: req.params.uid }, (err, user) => {
res.send({ name: user.name, discordId: user.discordId });
});
});

2
backend/example.env Normal file
View file

@ -0,0 +1,2 @@
DB_URI=mongodb://localhost:27017
DB_NAME=monkeytype

View file

@ -1,9 +0,0 @@
# Secrets can be generated at https://www.grc.com/passwords.htm
ACCESS_TOKEN_SECRET=6JlduNw96JONRtmg7Ru6tCW0UN42LQyzlHE0e03p2HO4m5Gm7PrYjRCinHCfeMM
REFRESH_TOKEN_SECRET=bnTfeI0J84XucqTWkHRPBCrewoJGIQySdHnL2bDrZp212tDyMG0fs5nf9aUXT9N
#Gmail login for email verification
#App password can be generated on account page under security, sigining in to Google
#Must enable 2 step verification before generating app password
MAIL_ADDRESS=youremail@gmail.com
MAIL_PASSWORD=cqvpgasbggytzfjq

View file

@ -672,7 +672,6 @@ export function update() {
totalWpm += result.wpm;
});
filteredResults.reverse();
loadMoreLines();
////////

View file

@ -1728,7 +1728,7 @@ export function finish(difficultyFailed = false) {
DB.getSnapshot() !== null &&
DB.getSnapshot().results !== undefined
) {
DB.getSnapshot().results.push(completedEvent);
DB.getSnapshot().results.unshift(completedEvent);
if (DB.getSnapshot().globalStats.time == undefined) {
DB.getSnapshot().globalStats.time =
testtime +
@ -1965,7 +1965,7 @@ export function finish(difficultyFailed = false) {
font-size: 2rem;
padding: 2rem 0;
">Test completed</div>
`);
$("#middle #result .stats").remove();
$("#middle #result .chart").remove();