mirror of
https://github.com/a-sync/game-server-watcher.git
synced 2026-08-01 01:49:14 -04:00
fix JSONEditor config format
* remove css workaround
This commit is contained in:
2
TODO
2
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
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "game-server-watcher",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"type": {
|
||||
"title": "GameDig type",
|
||||
"description": "For more info check the <a href=\"https://github.com/gamedig/node-gamedig/blob/master/GAMES_LIST.md\">GameDig games list</a>.",
|
||||
"description": "Check the <a href=\"https://github.com/gamedig/node-gamedig/blob/master/GAMES_LIST.md\">GameDig games list</a> for requirements.",
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"options": {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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'};
|
||||
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;
|
||||
|
||||
import 'dotenv/config';
|
||||
|
||||
import { GameServerConfig, main, readConfig, updateConfig } from './watcher';
|
||||
|
||||
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<string,{pretty: string}> = 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 = {};
|
||||
|
||||
Reference in New Issue
Block a user