refacto: Replaced useless DB queries by websocket calls + patching WS auth-token leak
This commit is contained in:
26
server/realtimeSnapshot.js
Normal file
26
server/realtimeSnapshot.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
getEconScores,
|
||||
getElementBonus,
|
||||
getMilitaryDeductions,
|
||||
getActivePlayerCounts,
|
||||
getVictoryPoints,
|
||||
} from "./db/gameDb.js";
|
||||
|
||||
export async function buildRealtimeSnapshot(worldSeed) {
|
||||
const [scores, elementBonus, militaryDeductions, activePlayers, victoryPoints] = await Promise.all([
|
||||
getEconScores(worldSeed),
|
||||
getElementBonus(worldSeed),
|
||||
getMilitaryDeductions(worldSeed),
|
||||
getActivePlayerCounts(worldSeed),
|
||||
getVictoryPoints(),
|
||||
]);
|
||||
|
||||
return {
|
||||
worldSeed,
|
||||
scores,
|
||||
elementBonus,
|
||||
militaryDeductions,
|
||||
activePlayers,
|
||||
victoryPoints,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user