1
mirror of https://github.com/thepeacockproject/Peacock synced 2025-03-14 12:54:28 +01:00

Disable saving (#127)

This commit is contained in:
moonysolari 2023-02-13 12:24:34 -05:00 committed by GitHub
parent a297973693
commit e538854b10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View File

@ -17,7 +17,13 @@
*/
import { Router } from "express"
import { fastClone, nilUuid, ServerVer, uuidRegex } from "../utils"
import {
contractTypes,
fastClone,
nilUuid,
ServerVer,
uuidRegex,
} from "../utils"
import { json as jsonMiddleware } from "body-parser"
import {
enqueueEvent,
@ -94,6 +100,11 @@ contractRoutingRouter.post(
},
}
// Edit usercreated contract data HERE
if (contractTypes.includes(contractData.Metadata.Type)) {
contractData.Data.EnableSaving = false
}
const contractSesh = {
Contract: contractData,
ContractSessionId: `${process.hrtime

View File

@ -31,7 +31,7 @@ import {
Seconds,
ServerToClientEvent,
} from "./types/types"
import { extractToken, ServerVer } from "./utils"
import { contractTypes, extractToken, ServerVer } from "./utils"
import { json as jsonMiddleware } from "body-parser"
import { log, LogLevel } from "./loggingInterop"
import { getUserData, writeUserData } from "./databaseHandler"
@ -236,11 +236,7 @@ export function newSession(
throw new Error("no ct")
}
if (
difficulty === 0 &&
(contract.Metadata.Type === "creation" ||
contract.Metadata.Type === "usercreated")
) {
if (difficulty === 0 && contractTypes.includes(contract.Metadata.Type)) {
log(
LogLevel.DEBUG,
`Difficulty not set for user created contract ${contractId}, setting to 2`,

View File

@ -49,6 +49,8 @@ export const PEACOCKVERSTRING = HUMAN_VERSION
export const uuidRegex =
/^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$/
export const contractTypes = ["featured", "usercreated", "creation"]
export async function checkForUpdates(): Promise<void> {
if (getFlag("updateChecking") === false) {
return