update
This commit is contained in:
parent
d7d0ac7421
commit
8d925ca6c0
BIN
dist/cs2-demo-downloader-linux
vendored
BIN
dist/cs2-demo-downloader-linux
vendored
Binary file not shown.
BIN
dist/cs2-demo-downloader-macos
vendored
BIN
dist/cs2-demo-downloader-macos
vendored
Binary file not shown.
BIN
dist/cs2-demo-downloader-win.exe
vendored
BIN
dist/cs2-demo-downloader-win.exe
vendored
Binary file not shown.
11
dist/main.js
vendored
11
dist/main.js
vendored
@ -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);
|
||||
|
||||
14
src/main.ts
14
src/main.ts
@ -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' });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user