fix: do not leak data in easy mode

This commit is contained in:
uku 2024-10-26 12:44:11 +02:00
parent 111b9c4ff0
commit a221e6bacc
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o

View file

@ -37,6 +37,10 @@ export const load: PageServerLoad = async ({ fetch, url, platform }) => {
} }
}); });
const strippedStops = crossingStops.map((f) => {
return { ...f, properties: {} };
});
const randomStop = crossingStops[Math.floor(Math.random() * crossingStops.length)]; const randomStop = crossingStops[Math.floor(Math.random() * crossingStops.length)];
if (!randomStop) { if (!randomStop) {
@ -46,7 +50,7 @@ export const load: PageServerLoad = async ({ fetch, url, platform }) => {
const gameId = await createGame(randomStop, kv); const gameId = await createGame(randomStop, kv);
const gameData: GameData = { const gameData: GameData = {
lines: options.mode === "easy" || options.mode === "hard" ? lineColors : [], lines: options.mode === "easy" || options.mode === "hard" ? lineColors : [],
stops: options.mode === "easy" ? crossingStops : [], stops: options.mode === "easy" ? strippedStops : [],
stopName: randomStop.properties!.nom, stopName: randomStop.properties!.nom,
gameId, gameId,
}; };