mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-12 22:00:02 -04:00
add logic to prevent user directly running server binary
This commit is contained in:
parent
08a4137071
commit
55dece7bc3
2 changed files with 12 additions and 3 deletions
|
@ -27,7 +27,7 @@ https.get(
|
||||||
function start() {
|
function start() {
|
||||||
console.log(chalk.blue(`Starting adrift...`));
|
console.log(chalk.blue(`Starting adrift...`));
|
||||||
|
|
||||||
let child = spawn(`${dir}/${appname}`, [], { stdio: ["inherit", "inherit", "pipe"] });
|
let child = spawn(`${dir}/${appname}`, ["--start"], { stdio: ["inherit", "inherit", "pipe"] });
|
||||||
|
|
||||||
let errbuf = "";
|
let errbuf = "";
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import fs from "fs";
|
||||||
import { exit } from "process";
|
import { exit } from "process";
|
||||||
import { datadir } from "./lib";
|
import { datadir } from "./lib";
|
||||||
|
|
||||||
|
|
||||||
async function config() {
|
async function config() {
|
||||||
let dir = datadir();
|
let dir = datadir();
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ async function login(credentials: any) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(async () => {
|
async function start() {
|
||||||
let dir = datadir();
|
let dir = datadir();
|
||||||
|
|
||||||
let conf;
|
let conf;
|
||||||
|
@ -152,4 +153,12 @@ async function login(credentials: any) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (process.argv[2] != "--start") {
|
||||||
|
console.error(chalk.red.bold("DO NOT LAUNCH THIS DIRECTLY, YOU SHOULD HAVE DOWNLOADED THE 'autoupdater' BINARY"))
|
||||||
|
setTimeout(() => process.exit(1), 5000);
|
||||||
|
} else {
|
||||||
|
start();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue