aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2021-05-11 18:51:59 +0200
committerstonedDiscord <Tukz@gmx.de>2021-05-11 18:51:59 +0200
commit9a19b74c6d64d0742d556674fa069897d4048d80 (patch)
treeacf88c1b8be63275b4086aa75ede5b1b2033b9c7
parentd977d4d3cadd333629d93e8eb16ee02c1b5c1788 (diff)
add asset url changing
-rw-r--r--webAO/client.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/webAO/client.js b/webAO/client.js
index b5e4706..6d4a13d 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -36,9 +36,8 @@ let mode = queryDict.mode;
// Unless there is an asset URL specified, use the wasabi one
const DEFAULT_HOST = "http://attorneyoffline.de/base/";
-const AO_HOST = queryDict.asset || DEFAULT_HOST;
+let AO_HOST = queryDict.asset || DEFAULT_HOST;
const THEME = queryDict.theme || "default";
-const MUSIC_HOST = AO_HOST + "sounds/music/";
const UPDATE_INTERVAL = 60;
@@ -214,6 +213,7 @@ class Client extends EventEmitter {
this.on("RD", this.handleRD.bind(this));
this.on("CharsCheck", this.handleCharsCheck.bind(this));
this.on("PV", this.handlePV.bind(this));
+ this.on("ASS", this.handleASS.bind(this));
this.on("CHECK", () => { });
this.on("CH", () => { });
@@ -775,7 +775,7 @@ class Client extends EventEmitter {
if(track.startsWith("http")) {
music.src = track;
} else {
- music.src = MUSIC_HOST + encodeURI(track.toLowerCase());
+ music.src = AO_HOST + "/sounds/music/" + encodeURI(track.toLowerCase());
}
music.loop = looping;
music.play();
@@ -1507,6 +1507,14 @@ class Client extends EventEmitter {
}
/**
+ * new asset url!!
+ * @param {Array} args packet arguments
+ */
+ handleASS(args) {
+ AO_HOST = args[1];
+ }
+
+ /**
* we are asking ourselves what characters there are
* @param {Array} args packet arguments
*/