aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'webAO/client.ts')
-rw-r--r--webAO/client.ts28
1 files changed, 16 insertions, 12 deletions
diff --git a/webAO/client.ts b/webAO/client.ts
index f7b8ebb..3170ec8 100644
--- a/webAO/client.ts
+++ b/webAO/client.ts
@@ -15,11 +15,12 @@ import { onReplayGo } from './dom/onReplayGo'
import { packetHandler } from './packets/packetHandler'
import { loadResources } from './client/loadResources'
import { AO_HOST } from './client/aoHost'
-import { fetchBackgroundList, fetchEvidenceList, fetchCharacterList, fetchManifest } from './client/fetchLists'
-const version = process.env.npm_package_version;
-const { ip: serverIP, mode, theme } = queryParser();
+import { fetchBackgroundList, fetchEvidenceList, fetchCharacterList } from './client/fetchLists'
+
+const { ip: serverIP, mode, theme, serverName } = queryParser();
+
+document.title = serverName;
-const THEME: string = theme || "default";
export let CHATBOX: string;
export const setCHATBOX = (val: string) => {
CHATBOX = val
@@ -38,7 +39,7 @@ export const UPDATE_INTERVAL = 60;
*/
export let oldLoading = false;
export const setOldLoading = (val: boolean) => {
- console.warn("old loading set to "+val)
+ console.warn("old loading set to " + val)
oldLoading = val
}
@@ -69,6 +70,11 @@ fpPromise
.then((result) => {
hdid = result.visitorId;
+ if (!serverIP) {
+ alert("No server IP specified!");
+ return;
+ }
+
client = new Client(serverIP);
client.connect()
isLowMemory();
@@ -146,7 +152,7 @@ class Client extends EventEmitter {
this.musics_time = false;
this.callwords = [];
this.manifest = [];
- this.resources = getResources(AO_HOST, THEME);
+ this.resources = getResources(AO_HOST, theme);
this.selectedEmote = -1;
this.selectedEvidence = 0;
this.checkUpdater = null;
@@ -217,7 +223,7 @@ class Client extends EventEmitter {
console.error(`The connection was closed: ${e.reason} (${e.code})`);
if (extrafeatures.length == 0 && banned === false) {
document.getElementById("client_errortext").textContent =
- "Could not connect to the server";
+ "Could not connect to the server";
}
document.getElementById("client_waiting").style.display = "block";
document.getElementById("client_error").style.display = "flex";
@@ -235,15 +241,14 @@ class Client extends EventEmitter {
console.debug(`S: ${msg}`);
this.handle_server_packet(msg);
-
+
}
/**
* Decode the packet
* @param {MessageEvent} e
*/
- handle_server_packet(p_data: string)
- {
+ handle_server_packet(p_data: string) {
let in_data = p_data;
if (!p_data.endsWith("%")) {
@@ -280,8 +285,7 @@ class Client extends EventEmitter {
}
// Take the first arg as the command
const command = f_contents[0];
- if(command!=="")
- {
+ if (command !== "") {
// The rest is contents of the packet
packetHandler.has(command)
? packetHandler.get(command)(f_contents)