From 9a19b74c6d64d0742d556674fa069897d4048d80 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 11 May 2021 18:51:59 +0200 Subject: add asset url changing --- webAO/client.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'webAO/client.js') 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(); @@ -1506,6 +1506,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 -- cgit