Fix game script download
parent
ed1cc20012
commit
aa69b8722e
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue