Fix game script download

pull/22/head
peshomir 2026-06-23 08:13:20 +03:00 committed by GitHub
parent ed1cc20012
commit aa69b8722e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ const request = https.get("https://territorial.io", function (response) {
// https://stackoverflow.com/a/14867897
const scriptContent = data.substring(
data.indexOf("<script>") + "<script>".length,
data.lastIndexOf("</script>")
data.indexOf("</script>")
);
// Write the script to ./game/latest.js without any line breaks
fs.writeFileSync("./game/latest.js", scriptContent.replace(/\r?\n|\r/g, ""));
@ -32,4 +32,4 @@ const request = https.get("https://territorial.io", function (response) {
});
});
});
export default downloadGame;
export default downloadGame;