Skip to content

Commit

Permalink
fix: remove irrelevant proof files
Browse files Browse the repository at this point in the history
  • Loading branch information
p2r3 committed Nov 29, 2024
1 parent 75e4a15 commit b4cc4c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ module.exports = async function (args, request) {
const newPath = `${epochtal.file.demos}/${data.steamid}_${category}.dem`;
fs.renameSync(path, newPath);
await $`xz -zf9e ${newPath}`.quiet();
// Check if a link file already exists for this user and remove it
const oldPath = `${epochtal.file.demos}/${data.steamid}_${category}.link`;
if (fs.existsSync(oldPath)) fs.unlinkSync(oldPath);

// Push the run to the discord
discordUpdate(user.steamid, categoryData.name);
Expand Down Expand Up @@ -266,6 +269,9 @@ module.exports = async function (args, request) {
// Write the link to the demos directory
const newPath = `${epochtal.file.demos}/${data.steamid}_${category}.link`;
await Bun.write(newPath, link);
// Check if a demo file already exists for this user and remove it
const oldPath = `${epochtal.file.demos}/${data.steamid}_${category}.dem.xz`;
if (fs.existsSync(oldPath)) fs.unlinkSync(oldPath);

// Push the run to the discord
discordUpdate(user.steamid, categoryData.name);
Expand Down

0 comments on commit b4cc4c9

Please sign in to comment.