diff --git a/TODO b/TODO
index c0059f5..8a1c1e0 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-// list game id's from gamedig module and replace type text field with a dropdown
-
// move loop inside watcher instance
// flush game server specific (d/t) data
// response normalization: https://github.com/GameServerManagers/LinuxGSM/blob/master/lgsm/functions/query_gamedig.sh
diff --git a/package-lock.json b/package-lock.json
index 3157bf0..067fc3b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "game-server-watcher",
- "version": "2.4.0",
+ "version": "2.5.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
diff --git a/public/game-server-config.schema.json b/public/game-server-config.schema.json
index 537ec23..1175713 100644
--- a/public/game-server-config.schema.json
+++ b/public/game-server-config.schema.json
@@ -18,7 +18,7 @@
},
"type": {
"title": "GameDig type",
- "description": "For more info check the GameDig games list.",
+ "description": "Check the GameDig games list for requirements.",
"type": "string",
"minLength": 1,
"options": {
diff --git a/public/main.css b/public/main.css
index c52a6f3..e3db6e5 100644
--- a/public/main.css
+++ b/public/main.css
@@ -135,12 +135,6 @@ body>nav {
padding-left: 5px !important;
}
-/* fixes no_additional_properties not hiding inputs */
-#config-form .property-selector-input,
-#config-form .property-selector-input + button {
- display: none;
-}
-
#config-form td[data-schematype="boolean"] > div.form-group > input[type="checkbox"] {
transform: scale(2.5);
margin: 10px 0 0 10px;
diff --git a/public/main.js b/public/main.js
index 43bbd93..49bde94 100644
--- a/public/main.js
+++ b/public/main.js
@@ -33,27 +33,27 @@ $(async () => {
"iconlib": "fontawesome5",
"object_layout": "normal",
"template": "mustache",
- "compact": 0,
+ "compact": false,
"show_errors": "always",
- "required_by_default": 0,
+ "required_by_default": false,
"no_additional_properties": true,
- "display_required_only": 1,
- "show_opt_in": 0,
- "remove_empty_properties": 0,
- "use_default_values": 1,
- "ajax": 1,
- "ajaxCredentials": 0,
- "disable_edit_json": 0,
- "disable_collapse": 1,
- "disable_properties": 0,
- "disable_array_add": 0,
- "disable_array_delete": 0,
- "disable_array_reorder": 1,
- "enable_array_copy": 1,
- "array_controls_top": 0,
- "disable_array_delete_all_rows": 1,
- "disable_array_delete_last_row": 1,
- "prompt_before_delete": 1,
+ "display_required_only": true,
+ "show_opt_in": false,
+ "remove_empty_properties": false,
+ "use_default_values": true,
+ "ajax": true,
+ "ajaxCredentials": false,
+ "disable_edit_json": false,
+ "disable_collapse": true,
+ "disable_properties": false,
+ "disable_array_add": false,
+ "disable_array_delete": false,
+ "disable_array_reorder": true,
+ "enable_array_copy": true,
+ "array_controls_top": false,
+ "disable_array_delete_all_rows": true,
+ "disable_array_delete_last_row": true,
+ "prompt_before_delete": true,
"schema": {
"title": "Configuration",
"type": "array",
diff --git a/src/server.ts b/src/server.ts
index b5cc431..ae8eeb0 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -4,14 +4,12 @@ import crypto from 'node:crypto';
import { createServer } from 'node:http';
import { URL } from 'node:url';
import { getInstance } from 'gamedig';
-//import gamedigPjson from '../node_modules/gamedig/package.json' assert {type: 'json'};
-const gamedigPjson = fs.readFileSync(path.resolve(__dirname, '../node_modules/gamedig/package.json'), 'utf-8');
-const gamedigVersion = JSON.parse(gamedigPjson).version || 0;
-
import 'dotenv/config';
-
import { GameServerConfig, main, readConfig, updateConfig } from './watcher';
+const gamedigPjson = fs.readFileSync(path.resolve(__dirname, '../node_modules/gamedig/package.json'), 'utf-8');
+const gamedigVersion = JSON.parse(gamedigPjson).version || 0;
+
const HOST = process.env.HOST || '0.0.0.0';
const PORT = parseInt(process.env.PORT || '8080', 10);
const SECRET = process.env.SECRET || 'secret';
@@ -74,22 +72,21 @@ createServer(async (req, res) => {
if (DBG) console.log('ping');
res.end('pong');
} else if (p === 'gamedig-games') {
- //re.version = gamedigPjson.version;
const gd = getInstance();
// @ts-ignore
const games: Map = gd.queryRunner.gameResolver.gamesByKey || new Map();
- let status = 200;
- let re: SelectOptionsResponse = {
+
+ res.writeHead(200, {
+ 'Content-Type': 'application/json',
+ 'Cache-Control': 'max-age=0'
+ });
+
+ res.end(JSON.stringify({
enum: Array.from(games.keys()),
options: {
enum_titles: Array.from(games.values()).map(g=>g.pretty)
}
- };
- res.writeHead(status, {
- 'Content-Type': 'application/json',
- 'Cache-Control': 'max-age=0'
- });
- res.end(JSON.stringify(re, null, DBG ? 2 : 0));
+ } as SelectOptionsResponse, null, DBG ? 2 : 0));
} else if (SECRET !== '' && req.headers['x-btoken']) {
let status = 200;
let re: ApiResponse = {};