mirror of
https://github.com/thepeacockproject/Peacock
synced 2025-03-14 12:54:28 +01:00
Disable saving (#127)
This commit is contained in:
parent
a297973693
commit
e538854b10
@ -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
|
||||
|
@ -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`,
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user