diff options
| author | stonedDiscord <Tukz@gmx.de> | 2026-01-01 16:56:17 +0100 |
|---|---|---|
| committer | stonedDiscord <Tukz@gmx.de> | 2026-01-01 16:56:17 +0100 |
| commit | 01ecb948edb015613e05bc2b6da4021137957745 (patch) | |
| tree | e6c080d7e8e6f56652c2269a380eff40b899a065 /webAO/utils | |
| parent | 26ae98b3d92f98754d5fb896713b524e5aca0483 (diff) | |
deal with this properly
Diffstat (limited to 'webAO/utils')
| -rw-r--r-- | webAO/utils/aoml.ts | 22 |
1 files changed, 9 insertions, 13 deletions
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<string, Aoml>(); - 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<string>(); - 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 |
