compress the mf (#1267)
This commit is contained in:
@@ -27,7 +27,7 @@ const TSS_BATTLES_DB_PATH = path.join(STORAGE_ROOT, 'tss_battles.db');
|
||||
fs.mkdirSync(REPLAYS_PATH, { recursive: true });
|
||||
|
||||
function replayDataPath(sessionId) {
|
||||
return path.join(REPLAYS_PATH, String(sessionId).toLowerCase(), 'replay_data.json');
|
||||
return path.join(REPLAYS_PATH, String(sessionId).toLowerCase(), 'replay_data.json.gz');
|
||||
}
|
||||
|
||||
const app = express();
|
||||
@@ -1443,7 +1443,7 @@ function readReplayJson(sessionId) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(replayPath, 'utf-8'));
|
||||
return JSON.parse(zlib.gunzipSync(fs.readFileSync(replayPath)));
|
||||
} catch (err) {
|
||||
log.warn('Failed to read replay JSON', { sessionId, error: err.message });
|
||||
return null;
|
||||
@@ -2753,7 +2753,7 @@ app.get('/api/match/:sessionId/replay', (req, res) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const data = JSON.parse(fs.readFileSync(replayPath, 'utf-8'));
|
||||
const data = JSON.parse(zlib.gunzipSync(fs.readFileSync(replayPath)));
|
||||
res.json({
|
||||
available: true,
|
||||
session_id: sessionId,
|
||||
|
||||
Reference in New Issue
Block a user