From 62ba67d6778a03426bb86528e0c1ecd47377da7e Mon Sep 17 00:00:00 2001 From: adueck Date: Thu, 18 Jan 2024 13:07:08 -0500 Subject: [PATCH] don't use protobuffers for dictionary loading on server --- account/src/lib/dictionary.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/account/src/lib/dictionary.ts b/account/src/lib/dictionary.ts index 675aa11..1d70ca3 100644 --- a/account/src/lib/dictionary.ts +++ b/account/src/lib/dictionary.ts @@ -4,8 +4,6 @@ import { CronJob } from "cron"; const collectionName = "ps-dictionary"; const allWordsCollectionName = "all-words"; import { - readDictionary, - readDictionaryInfo, Types as T, typePredicates as tp, entryOfFull, @@ -27,9 +25,8 @@ const updateJob = new CronJob("* * * * *", updateDictionary, null, false); let version: number = 0; async function fetchDictionary(): Promise { - const res = await fetch(process.env.LINGDOCS_DICTIONARY_URL || ""); - const buffer = await res.arrayBuffer(); - return readDictionary(buffer as Uint8Array); + const res = await fetch(process.env.LINGDOCS_DICTIONARY_URL + ".json" || ""); + return await res.json(); } async function fetchAllWords(): Promise { @@ -42,9 +39,10 @@ async function fetchAllWords(): Promise { } async function fetchDictionaryInfo(): Promise { - const res = await fetch(process.env.LINGDOCS_DICTIONARY_URL + "-info" || ""); - const buffer = await res.arrayBuffer(); - return readDictionaryInfo(buffer as Uint8Array); + const res = await fetch( + process.env.LINGDOCS_DICTIONARY_URL + "-info.json" || "" + ); + return await res.json(); } export async function updateDictionary(): Promise<"no update" | "updated"> {