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/utils/aoml.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'webAO/utils/aoml.ts') diff --git a/webAO/utils/aoml.ts b/webAO/utils/aoml.ts index f4a6da5..7611399 100644 --- a/webAO/utils/aoml.ts +++ b/webAO/utils/aoml.ts @@ -1,4 +1,3 @@ -import request from "../services/request"; interface Aoml { [key: string]: string | number; @@ -33,15 +32,12 @@ const aomlParser = (text: string) => { return parsed; }; -const mlConfig = (AO_HOST: string) => { - const defaultUrl = `${AO_HOST}themes/default/chat_config.ini`; - const aomlParsed: Promise<{ [key: string]: Aoml }> = request(defaultUrl).then( - (data) => aomlParser(data), - ); +const mlConfig = (iniContent: string) => { + const aomlParsed: { [key: string]: Aoml } = aomlParser(iniContent); - const createIdentifiers = async () => { + const createIdentifiers = () => { const identifiers = new Map(); - for (const [ruleName, value] of Object.entries(await aomlParsed)) { + for (const [ruleName, value] of Object.entries(aomlParsed)) { if (value.start && value.end) { identifiers.set(value.start, value); identifiers.set(value.end, value); @@ -49,18 +45,18 @@ const mlConfig = (AO_HOST: string) => { } return identifiers; }; - const createStartIdentifiers = async () => { + const createStartIdentifiers = () => { const startingIdentifiers = new Set(); - for (const [ruleName, value] of Object.entries(await aomlParsed)) { + for (const [ruleName, value] of Object.entries(aomlParsed)) { if (value?.start && value?.end) { startingIdentifiers.add(value.start); } } return startingIdentifiers; }; - const applyMarkdown = async (text: string, defaultColor: string) => { - const identifiers = await createIdentifiers(); - const startIdentifiers = await createStartIdentifiers(); + const applyMarkdown = (text: string, defaultColor: string) => { + const identifiers = createIdentifiers(); + const startIdentifiers = createStartIdentifiers(); const closingStack = []; const colorStack = []; // each value in output will be an html element -- cgit