Major updates to core

This commit is contained in:
Logan Cusano
2024-02-10 15:10:35 -05:00
parent d563021866
commit 9c46792959
22 changed files with 977 additions and 156 deletions

View File

@@ -1,7 +1,7 @@
import { generateUniqueID } from './modules/baseUtils.mjs';
import { updateId } from './modules/updateConfig.mjs';
import { ClientNodeConfig } from './modules/clientObjectDefinitions.mjs';
import { initSocketConnection, initSocketListeners, sendNodeUpdate } from './modules/socketClient.mjs';
import { initSocketConnection } from './modules/socketClient.mjs';
import dotenv from 'dotenv';
dotenv.config()
@@ -9,7 +9,7 @@ dotenv.config()
var localNodeConfig = new ClientNodeConfig({})
async function boot() {
if (localNodeConfig.node.id === undefined || localNodeConfig.node.id === '' || localNodeConfig.node.id === 0) {
if (localNodeConfig.node.nuid === undefined || localNodeConfig.node.nuid === '' || localNodeConfig.node.nuid === 0) {
// Run the first time boot sequence
await firstTimeBoot();
}
@@ -25,10 +25,10 @@ async function boot() {
async function firstTimeBoot() {
// Generate a new ID for the node
localNodeConfig.node.id = generateUniqueID();
console.log(`Generated a new unique ID for this node: '${localNodeConfig.node.id}'`);
console.log(`Generated a new unique ID for this node: '${localNodeConfig.node.nuid}'`);
// Update the config with the new ID
updateId(localNodeConfig.node.id);
updateId(localNodeConfig.node.nuid);
console.log("Updated the config with the new node ID");
// TODO - Create the config file with the ID given and replace the update above
// TODO - Check if the system is linux or windows and set the 'type' param in DAB
@@ -41,7 +41,5 @@ async function firstTimeBoot() {
// Boot the client application
boot().then((openSocket) => {
initSocketListeners(openSocket, localNodeConfig);
//console.log(openSocket, "Open socket");
setTimeout(() => {sendNodeUpdate(openSocket);}, 2500);
console.log(openSocket, "Booted Sucessfully");
})