From df2a9e7f016223fb480e4cf485cfbf501cb6462d Mon Sep 17 00:00:00 2001 From: smunky <105208736+devkennyy@users.noreply.github.com> Date: Mon, 20 Jun 2022 21:45:20 +1000 Subject: [PATCH 1/4] fixed typos (#3160) devkennyy * fixed punctuation * fixed last updated date * replaced un-permitted with prohibited * fixed last updated date --- frontend/static/privacy-policy.html | 4 ++-- frontend/static/terms-of-service.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/static/privacy-policy.html b/frontend/static/privacy-policy.html index a9d514b2c..8f23c3a0b 100644 --- a/frontend/static/privacy-policy.html +++ b/frontend/static/privacy-policy.html @@ -270,7 +270,7 @@ Cookies are text files placed on your computer to collect standard Internet log information and visitor behavior information. When you visit our websites, we may collect information from you automatically - through cookies or similar technology + through cookies or similar technology.

For further information, visit @@ -320,7 +320,7 @@ Monkeytype keeps its privacy policy under regular review and places any updates on this web page. The Monkeytype privacy policy may be subject to change at any given time without notice. This privacy - policy was last updated on 21 February 2022. + policy was last updated on 19 June 2022.

diff --git a/frontend/static/terms-of-service.html b/frontend/static/terms-of-service.html index 8c9b47eb6..8877b6bc1 100644 --- a/frontend/static/terms-of-service.html +++ b/frontend/static/terms-of-service.html @@ -110,7 +110,7 @@
-

These terms of service were last updated on September 11, 2021.

+

These terms of service were last updated on June 19, 2022.

Agreement

By accessing this Website, accessible from monkeytype.com, you are @@ -235,8 +235,8 @@ contact' requests from us or Users.

Limitations on Automated Use

- You shouldn't use bots or access our Services in malicious or - un-permitted ways. While accessing or using the Services, you may not: + You shouldn't use bots or access our Services in malicious or prohibited + ways. While accessing or using the Services, you may not:
  1. use bots, hacks, or cheats while using our site;
  2. create manual requests to Monkeytype servers;
  3. From 6668575ceaafc7637b4574198cb797ab22de7a48 Mon Sep 17 00:00:00 2001 From: Bruce Berrios <58147810+Bruception@users.noreply.github.com> Date: Mon, 20 Jun 2022 09:06:22 -0400 Subject: [PATCH 2/4] Refactor webpack configs (#3170) * Refactor webpack configs * Remove unused import --- frontend/webpack/config.base.js | 15 +++++++++++++++ frontend/webpack/config.dev.js | 19 ------------------- frontend/webpack/config.prod.js | 16 ---------------- 3 files changed, 15 insertions(+), 35 deletions(-) diff --git a/frontend/webpack/config.base.js b/frontend/webpack/config.base.js index 4e028f9c0..9110d05eb 100644 --- a/frontend/webpack/config.base.js +++ b/frontend/webpack/config.base.js @@ -8,6 +8,20 @@ const ExtraWatchWebpackPlugin = require("extra-watch-webpack-plugin"); let circularImports = 0; +const htmlWebpackPlugins = [ + "terms-of-service", + "security-policy", + "privacy-policy", + "email-handler", + "das", +].map((name) => { + return new HtmlWebpackPlugin({ + filename: `${name}.html`, + template: resolve(__dirname, `../static/${name}.html`), + inject: false, + }); +}); + /** @type { import('webpack').Configuration } */ const BASE_CONFIG = { entry: { @@ -96,6 +110,7 @@ const BASE_CONFIG = { template: resolve(__dirname, "../static/main.html"), inject: "body", }), + ...htmlWebpackPlugins, new MiniCssExtractPlugin({ filename: "./css/style.[chunkhash:8].css", }), diff --git a/frontend/webpack/config.dev.js b/frontend/webpack/config.dev.js index 94a272ccd..804be9bdd 100644 --- a/frontend/webpack/config.dev.js +++ b/frontend/webpack/config.dev.js @@ -1,22 +1,5 @@ -const { resolve } = require("path"); const { merge } = require("webpack-merge"); const BASE_CONFIG = require("./config.base"); -const HtmlWebpackPlugin = require("html-webpack-plugin"); - -const htmlWebpackPlugins = [ - "terms-of-service", - "security-policy", - "privacy-policy", - "email-handler", - "das", -].map((name) => { - return new HtmlWebpackPlugin({ - filename: `${name}.html`, - template: resolve(__dirname, `../static/${name}.html`), - inject: "body", - cache: false, - }); -}); /** @type { import('webpack').Configuration } */ const DEV_CONFIG = { @@ -33,8 +16,6 @@ const DEV_CONFIG = { overlay: false, }, }, - - plugins: htmlWebpackPlugins, }; module.exports = merge(BASE_CONFIG, DEV_CONFIG); diff --git a/frontend/webpack/config.prod.js b/frontend/webpack/config.prod.js index 6795dfbaa..8649e4469 100644 --- a/frontend/webpack/config.prod.js +++ b/frontend/webpack/config.prod.js @@ -3,24 +3,9 @@ const { merge } = require("webpack-merge"); const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin"); const JsonMinimizerPlugin = require("json-minimizer-webpack-plugin"); -const HtmlWebpackPlugin = require("html-webpack-plugin"); const BASE_CONFIG = require("./config.base"); -const htmlWebpackPlugins = [ - "terms-of-service", - "security-policy", - "privacy-policy", - "email-handler", - "das", -].map((name) => { - return new HtmlWebpackPlugin({ - filename: `${name}.html`, - template: resolve(__dirname, `../static/${name}.html`), - inject: false, - }); -}); - function pad(numbers, maxLength, fillString) { return numbers.map((number) => number.toString().padStart(maxLength, fillString) @@ -79,7 +64,6 @@ const PRODUCTION_CONFIG = { new CssMinimizerPlugin(), ], }, - plugins: htmlWebpackPlugins, }; module.exports = merge(BASE_CONFIG, PRODUCTION_CONFIG); From ae300bfa94684a44c9bddb747d2424cadda22d90 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 20 Jun 2022 15:06:35 +0200 Subject: [PATCH 3/4] Disabled time typing requirement on dev (#3169) * checking if mode is dev when adding to daily lb * disabled time typing check on dev when recalculating leaderboards * not replacing footer on localhost * using ternary * modified logic --- backend/src/api/controllers/result.ts | 2 +- backend/src/dal/leaderboards.ts | 4 +++- frontend/src/ts/elements/leaderboards.ts | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/api/controllers/result.ts b/backend/src/api/controllers/result.ts index b6fc4bf4d..5f32af2c0 100644 --- a/backend/src/api/controllers/result.ts +++ b/backend/src/api/controllers/result.ts @@ -327,7 +327,7 @@ export async function addResult( (funbox === "none" || funbox === "plus_one" || funbox === "plus_two") && !bailedOut && !user.banned && - (user.timeTyping ?? 0) > 7200; + (process.env.MODE === "dev" || (user.timeTyping ?? 0) > 7200); if (dailyLeaderboard && validResultCriteria) { incrementDailyLeaderboard(result.mode, result.mode2, result.language); diff --git a/backend/src/dal/leaderboards.ts b/backend/src/dal/leaderboards.ts index 95eddf6a3..45d011c87 100644 --- a/backend/src/dal/leaderboards.ts +++ b/backend/src/dal/leaderboards.ts @@ -78,7 +78,9 @@ export async function update( $exists: true, }, banned: { $exists: false }, - timeTyping: { $gt: 7200 }, + timeTyping: { + $gt: process.env.MODE === "dev" ? 0 : 7200, + }, }, }, { diff --git a/frontend/src/ts/elements/leaderboards.ts b/frontend/src/ts/elements/leaderboards.ts index 948ccdf07..4d3e903bf 100644 --- a/frontend/src/ts/elements/leaderboards.ts +++ b/frontend/src/ts/elements/leaderboards.ts @@ -133,7 +133,10 @@ function updateFooter(lb: LbKey): void { return; } - if ((DB.getSnapshot().globalStats?.time ?? 0) < 7200) { + if ( + window.location.hostname !== "localhost" && + (DB.getSnapshot().globalStats?.time ?? 0) < 7200 + ) { $(`#leaderboardsWrapper table.${side} tfoot`).html(` Your account must have 2 hours typed to be placed on the leaderboard. From 6a3f01f6a97a1a699c146a67a56616f9741f4f17 Mon Sep 17 00:00:00 2001 From: Bruce Berrios <58147810+Bruception@users.noreply.github.com> Date: Mon, 20 Jun 2022 10:10:43 -0400 Subject: [PATCH 4/4] Fix logic to not delete user if DB goes down (#3171) --- backend/src/api/controllers/user.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/backend/src/api/controllers/user.ts b/backend/src/api/controllers/user.ts index 84de019f2..fbeafc7dc 100644 --- a/backend/src/api/controllers/user.ts +++ b/backend/src/api/controllers/user.ts @@ -103,13 +103,17 @@ export async function getUser( try { userInfo = await UserDAL.getUser(uid, "get user"); } catch (e) { - await admin.auth().deleteUser(uid); - throw new MonkeyError( - 404, - "User not found. Please try to sign up again.", - "get user", - uid - ); + if (e.status === 404) { + await admin.auth().deleteUser(uid); + throw new MonkeyError( + 404, + "User not found. Please try to sign up again.", + "get user", + uid + ); + } + + throw e; } const agentLog = buildAgentLog(req);