From 01ecb948edb015613e05bc2b6da4021137957745 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 1 Jan 2026 16:56:17 +0100 Subject: deal with this properly --- webAO/viewport/utils/handleICSpeaking.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'webAO/viewport/utils') diff --git a/webAO/viewport/utils/handleICSpeaking.ts b/webAO/viewport/utils/handleICSpeaking.ts index b037e69..c0a9ae1 100644 --- a/webAO/viewport/utils/handleICSpeaking.ts +++ b/webAO/viewport/utils/handleICSpeaking.ts @@ -11,8 +11,17 @@ import { resizeChatbox } from "../../dom/resizeChatbox"; import transparentPng from "../../constants/transparentPng"; import { COLORS } from "../constants/colors"; import mlConfig from "../../utils/aoml"; +import request from "../../services/request"; -const attorneyMarkdown = mlConfig(AO_HOST); +let attorneyMarkdown: ReturnType | null = null; + +const initAttorneyMarkdown = async () => { + if (!attorneyMarkdown) { + const iniContent = await request(`${AO_HOST}themes/default/chat_config.ini`); + attorneyMarkdown = mlConfig(iniContent); + } + return attorneyMarkdown; +}; export let startFirstTickCheck: boolean; export const setStartFirstTickCheck = (val: boolean) => { @@ -337,9 +346,9 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { } try { - client.viewport.getChatmsg().parsed = await attorneyMarkdown.applyMarkdown( + const markdown = await initAttorneyMarkdown(); + client.viewport.getChatmsg().parsed = markdown.applyMarkdown( client.viewport.getChatmsg().content, - COLORS[client.viewport.getChatmsg().color], ); } catch (error) { -- cgit