From 2fda71ffa3b1dc1b82f5ab8c02a81a5b8a80fcf9 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 1 Jan 2026 16:09:35 +0100 Subject: constant --- webAO/viewport/constants/defaultChatMsg.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'webAO/viewport') diff --git a/webAO/viewport/constants/defaultChatMsg.ts b/webAO/viewport/constants/defaultChatMsg.ts index fa25b33..67c60b8 100644 --- a/webAO/viewport/constants/defaultChatMsg.ts +++ b/webAO/viewport/constants/defaultChatMsg.ts @@ -1,6 +1,8 @@ -import { UPDATE_INTERVAL } from "../../client"; import { ChatMsg } from "../interfaces/ChatMsg"; +// Define UPDATE_INTERVAL locally to avoid circular dependency +const UPDATE_INTERVAL = 60; + export const defaultChatMsg = { content: "", objection: 0, -- cgit 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') 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