From 3162071cb27510954dde918af629ed5d75deb583 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 08:39:19 +0200 Subject: get list of extensions to try from host --- webAO/client/fetchLists.ts | 14 +++++++++++--- webAO/client/handleCharacterInfo.ts | 6 +++--- webAO/client/setEmote.ts | 3 +-- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'webAO/client') diff --git a/webAO/client/fetchLists.ts b/webAO/client/fetchLists.ts index 2489c97..2aff60a 100644 --- a/webAO/client/fetchLists.ts +++ b/webAO/client/fetchLists.ts @@ -50,8 +50,6 @@ export const fetchEvidenceList = async () => { try { const evidata = await request(`${AO_HOST}evidence.json`); const evi_array = JSON.parse(evidata); - // the try catch will fail before here when there is no file - evi_array.forEach((evi: string) => { evi_select.add(new Option(evi)); }); @@ -64,8 +62,18 @@ export const fetchManifest = async () => { try { const manifestdata = await request(`${AO_HOST}manifest.txt`); client.manifest = manifestdata.split(/\r\n|\n\r|\n|\r/); - // the try catch will fail before here when there is no file } catch (err) { console.warn("there was no manifest.txt file"); } }; + +export const fetchExtensions = async () => { + try { + const extensiondata = await request(`${AO_HOST}extensions.json`); + const allextensions = JSON.parse(extensiondata); + client.charicon_extensions = allextensions.charicon_extensions|| [".png", ".webp"]; + client.emote_extensions = allextensions.emote_extensions || [".gif", ".png", ".apng", ".webp", ".webp.static"]; + } catch (err) { + console.warn("there was no extensions.json file"); + } +}; diff --git a/webAO/client/handleCharacterInfo.ts b/webAO/client/handleCharacterInfo.ts index 3f81e57..a364b5e 100644 --- a/webAO/client/handleCharacterInfo.ts +++ b/webAO/client/handleCharacterInfo.ts @@ -6,13 +6,13 @@ import fileExists from "../utils/fileExists"; import { AO_HOST } from "./aoHost"; export const getCharIcon = async (img: HTMLImageElement, charname: string) => { - const extensions = [".png", ".webp"]; + const charicon_extensions = [".png", ".webp"]; img.alt = charname; const charIconBaseUrl = `${AO_HOST}characters/${encodeURI( charname.toLowerCase(), )}/char_icon`; - for (let i = 0; i < extensions.length; i++) { - const fileUrl = charIconBaseUrl + extensions[i]; + for (let i = 0; i < charicon_extensions.length; i++) { + const fileUrl = charIconBaseUrl + charicon_extensions[i]; const exists = await fileExists(fileUrl); if (exists) { img.alt = charname; diff --git a/webAO/client/setEmote.ts b/webAO/client/setEmote.ts index 70f23ac..4c05afc 100644 --- a/webAO/client/setEmote.ts +++ b/webAO/client/setEmote.ts @@ -23,9 +23,8 @@ const setEmote = async ( const emoteSelector = document.getElementById( `client_${position}${pairID}_img`, ) as HTMLImageElement; - const extensionsMap = [".gif", ".png", ".apng", ".webp", ".webp.static"]; - for (const extension of extensionsMap) { + for (const extension of client.emote_extensions) { // Hides all sprites before creating a new sprite if ( -- cgit From 14b569e05ab43baf76fd6404ca50a2b05a843134 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 10:13:13 +0200 Subject: logging --- webAO/client/fetchLists.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'webAO/client') diff --git a/webAO/client/fetchLists.ts b/webAO/client/fetchLists.ts index 2aff60a..68b1a43 100644 --- a/webAO/client/fetchLists.ts +++ b/webAO/client/fetchLists.ts @@ -71,8 +71,10 @@ export const fetchExtensions = async () => { try { const extensiondata = await request(`${AO_HOST}extensions.json`); const allextensions = JSON.parse(extensiondata); - client.charicon_extensions = allextensions.charicon_extensions|| [".png", ".webp"]; + client.charicon_extensions = allextensions.charicon_extensions || [".png", ".webp"]; client.emote_extensions = allextensions.emote_extensions || [".gif", ".png", ".apng", ".webp", ".webp.static"]; + console.log("charicons "+client.charicon_extensions) + console.log("emotes "+client.emote_extensions) } catch (err) { console.warn("there was no extensions.json file"); } -- cgit From e58dcb7186bb3c80ba87279a6643fcb4b8b3b2be Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 10:27:49 +0200 Subject: emotions --- webAO/client/fetchLists.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'webAO/client') diff --git a/webAO/client/fetchLists.ts b/webAO/client/fetchLists.ts index 68b1a43..7940eea 100644 --- a/webAO/client/fetchLists.ts +++ b/webAO/client/fetchLists.ts @@ -73,8 +73,10 @@ export const fetchExtensions = async () => { const allextensions = JSON.parse(extensiondata); client.charicon_extensions = allextensions.charicon_extensions || [".png", ".webp"]; client.emote_extensions = allextensions.emote_extensions || [".gif", ".png", ".apng", ".webp", ".webp.static"]; + client.emotions_extensions = allextensions.emotions_extensions || [".png", ".webp"]; console.log("charicons "+client.charicon_extensions) console.log("emotes "+client.emote_extensions) + console.log("emotions "+client.emotions_extensions) } catch (err) { console.warn("there was no extensions.json file"); } -- cgit From d8d2fbc8b7bf91dbedc7042daa1081ebd0d1330f Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 11:04:17 +0200 Subject: also get backgrounds --- webAO/client/fetchLists.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'webAO/client') diff --git a/webAO/client/fetchLists.ts b/webAO/client/fetchLists.ts index 7940eea..3d590b9 100644 --- a/webAO/client/fetchLists.ts +++ b/webAO/client/fetchLists.ts @@ -74,6 +74,7 @@ export const fetchExtensions = async () => { client.charicon_extensions = allextensions.charicon_extensions || [".png", ".webp"]; client.emote_extensions = allextensions.emote_extensions || [".gif", ".png", ".apng", ".webp", ".webp.static"]; client.emotions_extensions = allextensions.emotions_extensions || [".png", ".webp"]; + client.background_extensions = allextensions.background_extensions || [".png", ".gif", ".webp", ".apng"]; console.log("charicons "+client.charicon_extensions) console.log("emotes "+client.emote_extensions) console.log("emotions "+client.emotions_extensions) -- cgit From 183fd0fdddbcf194eec08f8e79e6a1709e18d3a9 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 12:20:42 +0200 Subject: also do bgs --- webAO/client/fetchLists.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'webAO/client') diff --git a/webAO/client/fetchLists.ts b/webAO/client/fetchLists.ts index 3d590b9..d391fac 100644 --- a/webAO/client/fetchLists.ts +++ b/webAO/client/fetchLists.ts @@ -78,6 +78,7 @@ export const fetchExtensions = async () => { console.log("charicons "+client.charicon_extensions) console.log("emotes "+client.emote_extensions) console.log("emotions "+client.emotions_extensions) + console.log("backgrounds "+client.background_extensions) } catch (err) { console.warn("there was no extensions.json file"); } -- cgit From 035951baf3819f56093f7156b345689aa5093f28 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 14:20:28 +0200 Subject: remove failed manifesto --- webAO/client/fetchLists.ts | 9 --------- 1 file changed, 9 deletions(-) (limited to 'webAO/client') diff --git a/webAO/client/fetchLists.ts b/webAO/client/fetchLists.ts index d391fac..2f2fd59 100644 --- a/webAO/client/fetchLists.ts +++ b/webAO/client/fetchLists.ts @@ -58,15 +58,6 @@ export const fetchEvidenceList = async () => { } }; -export const fetchManifest = async () => { - try { - const manifestdata = await request(`${AO_HOST}manifest.txt`); - client.manifest = manifestdata.split(/\r\n|\n\r|\n|\r/); - } catch (err) { - console.warn("there was no manifest.txt file"); - } -}; - export const fetchExtensions = async () => { try { const extensiondata = await request(`${AO_HOST}extensions.json`); -- cgit