Deploy
This commit is contained in:
@@ -24,7 +24,7 @@ export async function GET(request: NextRequest) {
|
||||
);
|
||||
}
|
||||
|
||||
const saveDir = join(process.cwd(), SAVE_CONFIG.SAVE_DIRECTORY);
|
||||
const saveDir = SAVE_CONFIG.SAVE_DIRECTORY;
|
||||
const filename = `${name}.rhai`;
|
||||
const filepath = join(saveDir, filename);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { SAVE_CONFIG } from "@/lib/saveConfig";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const saveDir = join(process.cwd(), SAVE_CONFIG.SAVE_DIRECTORY);
|
||||
const saveDir = SAVE_CONFIG.SAVE_DIRECTORY;
|
||||
|
||||
// If save directory doesn't exist, return empty array
|
||||
if (!existsSync(saveDir)) {
|
||||
|
||||
@@ -52,7 +52,7 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
// Ensure save directory exists
|
||||
const saveDir = join(process.cwd(), SAVE_CONFIG.SAVE_DIRECTORY);
|
||||
const saveDir = SAVE_CONFIG.SAVE_DIRECTORY;
|
||||
if (!existsSync(saveDir)) {
|
||||
await mkdir(saveDir, { recursive: true });
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
export const SAVE_CONFIG = {
|
||||
ENABLE_SAVE: true,
|
||||
SAVE_SECRET: "save",
|
||||
ENABLE_SAVE: process.env.ENABLE_SAVE === 'true' || true,
|
||||
SAVE_SECRET: process.env.SAVE_SECRET || "save",
|
||||
|
||||
SAVE_DIRECTORY: "./data/scripts",
|
||||
MAX_FILENAME_LENGTH: 32,
|
||||
SAVE_DIRECTORY: process.env.SAVE_DIRECTORY || "./data/scripts",
|
||||
MAX_FILENAME_LENGTH: parseInt(process.env.MAX_FILENAME_LENGTH || "32"),
|
||||
FILENAME_REGEX: /^[a-zA-Z0-9_\s-]+$/,
|
||||
} as const;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import init, { GameState, GameStateHuman } from "../wasm/runner";
|
||||
import init, { MinMaxGameHuman } from "../wasm/runner";
|
||||
|
||||
let wasmReady = false;
|
||||
let wasmInitPromise: Promise<void> | null = null;
|
||||
let currentGame: GameStateHuman | null = null;
|
||||
let currentGame: MinMaxGameHuman | null = null;
|
||||
|
||||
async function initWasm(): Promise<void> {
|
||||
if (wasmReady) return;
|
||||
@@ -53,7 +53,7 @@ self.onmessage = async (event) => {
|
||||
self.postMessage({ type: "terminal", line });
|
||||
};
|
||||
|
||||
currentGame = new GameStateHuman(
|
||||
currentGame = new MinMaxGameHuman(
|
||||
event_data.script,
|
||||
appendOutput,
|
||||
appendOutput,
|
||||
|
||||
Reference in New Issue
Block a user