mirror of
https://github.com/a-sync/game-server-watcher.git
synced 2026-07-22 05:41:43 -04:00
return games list from gamedig v4.4 WIP
This commit is contained in:
@@ -3,10 +3,10 @@ import path from 'node:path';
|
||||
import crypto from 'node:crypto';
|
||||
import { createServer } from 'node:http';
|
||||
import { URL } from 'node:url';
|
||||
import { games } from 'gamedig';
|
||||
import { getInstance } from 'gamedig';
|
||||
//import gamedigPjson from '../node_modules/node-gamedig/package.json' assert {type: 'json'};
|
||||
const gamedigPjson = fs.readFileSync('../node_modules/node-gamedig/package.json');
|
||||
const gamedigVerson = JSON.parse(gamedigPjson).version || 0;
|
||||
const gamedigPjson = fs.readFileSync('../node_modules/node-gamedig/package.json', 'utf-8');
|
||||
const gamedigVersion = JSON.parse(gamedigPjson).version || 0;
|
||||
|
||||
import 'dotenv/config';
|
||||
|
||||
@@ -29,7 +29,9 @@ interface ApiResponse {
|
||||
discord: boolean;
|
||||
telegram: boolean;
|
||||
slack: boolean;
|
||||
}
|
||||
};
|
||||
version?: string;
|
||||
games?: any[];//debug
|
||||
}
|
||||
|
||||
const EXT_MIME: Record<string, string> = {
|
||||
@@ -101,6 +103,9 @@ createServer(async (req, res) => {
|
||||
re.message = '🗑️ ' + reqPath[1].slice(0, 1).toUpperCase() + reqPath[1].slice(1) + ' data flushed.';
|
||||
} else if (reqPath[0] === 'gamedig-games') {
|
||||
//re.version = gamedigPjson.version;
|
||||
const gd = getInstance();
|
||||
// @ts-ignore
|
||||
const games = gd.queryRunner.gameResolver.games || [];
|
||||
re.version = gamedigVersion;
|
||||
re.games = games;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user