summaryrefslogtreecommitdiff
path: root/src/renderer/gameserver/onlineCount.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer/gameserver/onlineCount.ts')
-rw-r--r--src/renderer/gameserver/onlineCount.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/renderer/gameserver/onlineCount.ts b/src/renderer/gameserver/onlineCount.ts
index d78fa96..cfde7e5 100644
--- a/src/renderer/gameserver/onlineCount.ts
+++ b/src/renderer/gameserver/onlineCount.ts
@@ -56,6 +56,7 @@ export enum OnlineListParser {
TMW,
TMW2API,
EXAMPLE_DATA,
+ JSON_ARRAY
};
async function fetchOnlineList(server:GameServer):Promise<string[]>{
@@ -74,6 +75,8 @@ async function fetchOnlineList(server:GameServer):Promise<string[]>{
];
case OnlineListParser.TMW:
return tmwParser(await request(server.OnlineList.url));
+ case OnlineListParser.JSON_ARRAY:
+ return jsonArrayParser(await request(server.OnlineList.url));
default:
throw new Error("Online List Parser is unknown");
}
@@ -92,6 +95,9 @@ function tmwParser(rawData:string):string[]{
return stringArray;
}
+function jsonArrayParser(rawData:string):string[]{
+ return JSON.parse(rawData);
+}
function request(url:string):Promise<string>{
return new Promise((res, rej)=>{