mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-03 04:19:06 +08:00
Merge branch 'master' of https://github.com/Miodec/monkeytype
This commit is contained in:
commit
ad250d7f5c
5 changed files with 25 additions and 3 deletions
6
.github/workflows/pr-check.yml
vendored
6
.github/workflows/pr-check.yml
vendored
|
@ -35,9 +35,15 @@ jobs:
|
|||
ts:
|
||||
- 'frontend/**/*.js'
|
||||
- 'frontend/**/*.ts'
|
||||
anti-cheat:
|
||||
- 'backend/**/anticheat/**'
|
||||
|
||||
- run: echo ${{ steps.filter.outputs.changes }}
|
||||
|
||||
- name: Check Anti-cheat
|
||||
if: steps.filter.outputs.anti-cheat == 'true'
|
||||
run: exit 1
|
||||
|
||||
- name: Cache node modules
|
||||
if: steps.filter.outputs.changes != '[]'
|
||||
uses: actions/cache@v2
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import ResultController from "../controllers/result";
|
||||
import resultSchema from "../schemas/result-schema";
|
||||
import { asyncHandler, validateRequest } from "../../middlewares/api-utils";
|
||||
import {
|
||||
asyncHandler,
|
||||
validateRequest,
|
||||
validateConfiguration,
|
||||
} from "../../middlewares/api-utils";
|
||||
import * as RateLimit from "../../middlewares/rate-limit";
|
||||
import { Router } from "express";
|
||||
import { authenticateRequest } from "../../middlewares/auth";
|
||||
|
@ -17,6 +21,12 @@ router.get(
|
|||
|
||||
router.post(
|
||||
"/",
|
||||
validateConfiguration({
|
||||
criteria: (configuration) => {
|
||||
return configuration.enableSavingResults.enabled;
|
||||
},
|
||||
invalidMessage: "Results are not being saved at this time.",
|
||||
}),
|
||||
RateLimit.resultsAdd,
|
||||
authenticateRequest(),
|
||||
validateRequest({
|
||||
|
|
|
@ -19,6 +19,9 @@ const BASE_CONFIGURATION: MonkeyTypes.Configuration = {
|
|||
monkeyTokens: {
|
||||
enabled: false,
|
||||
},
|
||||
enableSavingResults: {
|
||||
enabled: false,
|
||||
},
|
||||
};
|
||||
|
||||
export default Object.freeze(BASE_CONFIGURATION);
|
||||
|
|
|
@ -2,7 +2,7 @@ import "dotenv/config";
|
|||
import admin, { ServiceAccount } from "firebase-admin";
|
||||
import serviceAccount from "./credentials/serviceAccountKey.json";
|
||||
import db from "./init/db.js";
|
||||
import jobs from "./jobs/index.js";
|
||||
import jobs from "./jobs";
|
||||
import ConfigurationDAO from "./dao/configuration.js";
|
||||
import app from "./app";
|
||||
|
||||
|
@ -16,7 +16,7 @@ async function bootServer(port) {
|
|||
admin.initializeApp({
|
||||
credential: admin.credential.cert(
|
||||
serviceAccount as unknown as ServiceAccount
|
||||
)
|
||||
),
|
||||
});
|
||||
console.log("Firebase app initialized");
|
||||
|
||||
|
|
3
backend/types/types.d.ts
vendored
3
backend/types/types.d.ts
vendored
|
@ -17,6 +17,9 @@ declare namespace MonkeyTypes {
|
|||
monkeyTokens: {
|
||||
enabled: boolean;
|
||||
};
|
||||
enableSavingResults: {
|
||||
enabled: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface Context {
|
||||
|
|
Loading…
Reference in a new issue