diff --git a/main.js b/main.js index efe940b..26bfcb7 100644 --- a/main.js +++ b/main.js @@ -2,6 +2,57 @@ require("./requires.js") console.log(start); +const https = require("https"); +let un = process.env.auth_username +let pw = process.env.auth_password + + +const options = { + hostname: "keyserver.dommymommy.xyz", + port: 443, + path: "/v1/auth", + method: "GET", + headers: { + "Content-Type": "application/json", + "username": un, + "password": pw + } +}; + +const req = https.request(options, (res) => { + if (res.statusCode === 200) { + res.setEncoding("utf8"); + let data = ""; + res.on("data", (chunk) => { + data += chunk; + }); + res.on("end", () => { + const myJson = JSON.parse(data); + Object.keys(myJson).forEach(el => { + // console.log(el, myJson[el]); + process.env[el] = myJson[el] + }) + }); + } else if (res.statusCode === 401) { + res.setEncoding("utf8"); + let data = ""; + res.on("data", (chunk) => { + data += chunk; + }); + res.on("end", () => { + console.log(data); + process.exit() + }); + } +}); + +req.on("error", (error) => { + console.error(error); +}); + +req.end(); + + // Initialising map to be used to store the functionality later on for reloadability mapFunctions = new Map() @@ -32,29 +83,6 @@ console.log(`The Startup took ${new Date() - start}ms`) console.log(`${mapFunctions.size} Function modules loaded`); console.log("--------------------------------------------------------------------------------"); - - - - - -// --------------------------------------------------------- CLI COMMANDS --------------------------------------------------------- // - -const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout -}); - - -rl.on("line", data =>{ - const args = data.trim().split(" "); - const command = args.shift().toLowerCase(); - mapFunctions.get("cliCommands").function(command, args) -}) - - - - - // ----------------------------------------------------------- ELECTRON ----------------------------------------------------------- // let mainWindow; @@ -75,15 +103,6 @@ function createWindow() { electron.app.whenReady().then(createWindow); - -// electron.ipcMain.on("extract", (event, args) => { -// mapFunctions.get("extraction-video-to-audio").function(args) -// }) - -// setTimeout(() => { -// mainWindow.webContents.send("fuck", "worked uwu") -// }, 5000); - electron.ipcMain.handle('get-module-names', async () => { let module_array = { "ai_modules":[],