This commit is contained in:
Miodec 2022-06-20 16:32:05 +02:00
commit bca69b6f09
9 changed files with 39 additions and 50 deletions

View file

@ -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);

View file

@ -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);

View file

@ -78,7 +78,9 @@ export async function update(
$exists: true,
},
banned: { $exists: false },
timeTyping: { $gt: 7200 },
timeTyping: {
$gt: process.env.MODE === "dev" ? 0 : 7200,
},
},
},
{

View file

@ -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(`
<tr>
<td colspan="6" style="text-align:center;">Your account must have 2 hours typed to be placed on the leaderboard.</>

View file

@ -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.
</p>
<p>
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.
</p>
<!-- TODO: add way to view when file was last committed to using the GitHub api-->

View file

@ -110,7 +110,7 @@
</div>
<div id="middle">
<!-- make sure to update this date every time the tos is changed -->
<p>These terms of service were last updated on September 11, 2021.</p>
<p>These terms of service were last updated on June 19, 2022.</p>
<h1>Agreement</h1>
<p>
By accessing this Website, accessible from monkeytype.com, you are
@ -235,8 +235,8 @@
contact' requests from us or Users.
<h1>Limitations on Automated Use</h1>
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:
<ol>
<li>use bots, hacks, or cheats while using our site;</li>
<li>create manual requests to Monkeytype servers;</li>

View file

@ -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",
}),

View file

@ -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);

View file

@ -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);