This commit is contained in:
Linrador 2025-06-15 22:43:01 +02:00
parent d7d0ac7421
commit 8d925ca6c0
5 changed files with 20 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

11
dist/main.js vendored
View File

@ -43,14 +43,21 @@ async function start() {
const { shareCode, steamId } = JSON.parse(body);
console.log(`📦 ShareCode empfangen: ${shareCode}`);
const match = await (0, fetchMatchFromSharecode_1.fetchMatchFromShareCode)(shareCode, session);
const path = await (0, downloadDemoFile_1.downloadDemoFile)(match, steamId, resolvedDemoPath, (percent) => {
const demoFilePath = await (0, downloadDemoFile_1.downloadDemoFile)(match, steamId, resolvedDemoPath, (percent) => {
process.stdout.write(`📶 Fortschritt: ${percent}%\r`);
if (percent === 100) {
console.log('✅ Download abgeschlossen');
}
});
// JSON-Dateipfad erstellen
const jsonFilePath = demoFilePath.replace(/\.dem$/, '.json');
const jsonFileName = path_1.default.basename(jsonFilePath);
// Match-Daten als JSON schreiben
await fs_1.default.promises.writeFile(jsonFilePath, JSON.stringify(match, null, 2), 'utf-8');
console.log(`📝 Match-Daten gespeichert unter: ${jsonFileName}`);
// Antwort an den Client
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ success: true, path }));
res.end(JSON.stringify({ success: true, path: demoFilePath }));
}
catch (err) {
console.error('❌ Fehler:', err);

View File

@ -45,7 +45,7 @@ async function start() {
console.log(`📦 ShareCode empfangen: ${shareCode}`);
const match = await fetchMatchFromShareCode(shareCode, session);
const path = await downloadDemoFile(
const demoFilePath = await downloadDemoFile(
match,
steamId,
resolvedDemoPath,
@ -56,10 +56,18 @@ async function start() {
}
}
);
// JSON-Dateipfad erstellen
const jsonFilePath = demoFilePath.replace(/\.dem$/, '.json');
const jsonFileName = path.basename(jsonFilePath)
// Match-Daten als JSON schreiben
await fs.promises.writeFile(jsonFilePath, JSON.stringify(match, null, 2), 'utf-8');
console.log(`📝 Match-Daten gespeichert unter: ${jsonFileName}`);
// Antwort an den Client
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ success: true, path }));
res.end(JSON.stringify({ success: true, path: demoFilePath }));
} catch (err) {
console.error('❌ Fehler:', err);
res.writeHead(500, { 'Content-Type': 'application/json' });