diff options
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/client/aoHost.ts | 3 | ||||
| -rw-r--r-- | webAO/packets/handlers/handleASS.ts | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/webAO/client/aoHost.ts b/webAO/client/aoHost.ts index 003e237..0d7cb0f 100644 --- a/webAO/client/aoHost.ts +++ b/webAO/client/aoHost.ts @@ -2,7 +2,7 @@ import queryParser from "../utils/queryParser"; const { asset } = queryParser(); export let AO_HOST = asset; -export const setAOhost = (val: string) => { +export const setAOhost = (val: string): string => { const currentProtocol = window.location.protocol; const assetProtocol = val.split(":")[0] + ":"; @@ -19,4 +19,5 @@ export const setAOhost = (val: string) => { AO_HOST = val; } console.log("Asset URL ist now " + AO_HOST); + return AO_HOST; }; diff --git a/webAO/packets/handlers/handleASS.ts b/webAO/packets/handlers/handleASS.ts index 1ecfd04..092e4f9 100644 --- a/webAO/packets/handlers/handleASS.ts +++ b/webAO/packets/handlers/handleASS.ts @@ -1,4 +1,4 @@ -import { setAOhost, AO_HOST } from "../../client/aoHost"; +import { setAOhost } from "../../client/aoHost"; import { client } from "../../client"; /** @@ -6,7 +6,7 @@ import { client } from "../../client"; * @param {Array} args packet arguments */ export const handleASS = (args: string[]) => { - if (args[1] !== "None") setAOhost(args[1]); + const host = args[1] !== "None" ? setAOhost(args[1]) : args[1]; // Re-apply playerlist icon srcs that were set before AO_HOST was known const iconExt = client.charicon_extensions[0] || ".png"; @@ -18,7 +18,7 @@ export const handleASS = (args: string[]) => { `#client_playerlist_entry${playerID} img` ); if (img) { - img.src = `${AO_HOST}characters/${encodeURI(char.name.toLowerCase())}/char_icon${iconExt}`; + img.src = `${host}characters/${encodeURI(char.name.toLowerCase())}/char_icon${iconExt}`; } } } |
