From 0cbd14018e6df9dc3db1e4f6e7587535964c1acc Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Mon, 1 Nov 2021 18:12:46 +0100 Subject: [PATCH] Small refactor... --- libs/database/init.js | 8 ++++---- libs/ddnss/handler.js | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/database/init.js b/libs/database/init.js index 7aa1573..4498804 100644 --- a/libs/database/init.js +++ b/libs/database/init.js @@ -5,14 +5,14 @@ import initLog from '../utils/log.js' export let sqlite = undefined export let skinDB = undefined -const log = initLog("DB Init") +const log = initLog("Database") /** * This initalizes the ddnet.sqlite and skindata.sqlite DB... * @module db/dbInit */ export function dbInit() { - console.log("Starting up databases...") + log("Starting up databases...") /* load in db using better-sqlite3 */ sqlite = new Database('ddnet.sqlite', { verbose: console.log }); @@ -24,6 +24,6 @@ export function dbInit() { /* Unsafe mode */ sqlite.unsafeMode() - log("Loaded in ddnet.sqlite...") - log("Loaded in skindata.sqlite...") + log("Loaded in 'ddnet.sqlite'!") + log("Loaded in 'skindata.sqlite'!") } diff --git a/libs/ddnss/handler.js b/libs/ddnss/handler.js index 5e215aa..d18f1af 100644 --- a/libs/ddnss/handler.js +++ b/libs/ddnss/handler.js @@ -9,6 +9,8 @@ export async function ddnssStart() { const getServers = await fetch('https://ddnet.tw/status/index.json'); const servers = await getServers.json(); + log(`Found ${servers.length} online servers!`) + for (const server of servers) { const connection = `${server.ip}:${server.port}` @@ -25,11 +27,13 @@ export async function ddnssStart() { await scrapeServer(`${connection}`) } + // PLEASE!! exec(`pkill -9 -f ddnss`) } function scrapeServer(server) { - + // TODO: Maybe fix the paths to be dynamic? Or have some sort of buildscript... + // -- BurnyLlama const command = `./ddnss/build/DDNet "ui_server_address ${server}" -f ddnss/build/config.conf` return new Promise((resolve, reject) => {