MISC: Standardize behavior of connect CLI and Singularity API (#1933)

This commit is contained in:
catloversg
2025-02-01 02:20:17 +07:00
committed by GitHub
parent 686bfe5aef
commit a4217b448a
5 changed files with 120 additions and 54 deletions
+10 -8
View File
@@ -586,19 +586,21 @@ export class Terminal {
printOutput(root);
}
connectToServer(server: string): void {
const serv = GetServer(server);
if (serv == null) {
connectToServer(hostname: string, singularity = false): void {
const server = GetServer(hostname);
if (server === null) {
this.error("Invalid server. Connection failed.");
return;
}
Player.getCurrentServer().isConnectedTo = false;
Player.currentServer = serv.hostname;
Player.getCurrentServer().isConnectedTo = true;
this.print("Connected to " + serv.hostname);
Player.currentServer = hostname;
server.isConnectedTo = true;
this.setcwd(root);
if (Player.getCurrentServer().hostname == "darkweb") {
checkIfConnectedToDarkweb(); // Posts a 'help' message if connecting to dark web
if (!singularity) {
this.print("Connected to " + server.hostname);
if (Player.getCurrentServer().hostname == "darkweb") {
checkIfConnectedToDarkweb(); // Posts a 'help' message if connecting to dark web
}
}
}