mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
implemented initial version of the authentication system
Also removed some code that as it turns out, is useless, as electron is a shit software which completely takes over stdin, so there is no way to actually write anything on the CLI
This commit is contained in:
@@ -2,6 +2,57 @@
|
|||||||
require("./requires.js")
|
require("./requires.js")
|
||||||
console.log(start);
|
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
|
// Initialising map to be used to store the functionality later on for reloadability
|
||||||
mapFunctions = new Map()
|
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(`${mapFunctions.size} Function modules loaded`);
|
||||||
console.log("--------------------------------------------------------------------------------");
|
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 ----------------------------------------------------------- //
|
// ----------------------------------------------------------- ELECTRON ----------------------------------------------------------- //
|
||||||
|
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
@@ -75,15 +103,6 @@ function createWindow() {
|
|||||||
|
|
||||||
electron.app.whenReady().then(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 () => {
|
electron.ipcMain.handle('get-module-names', async () => {
|
||||||
let module_array = {
|
let module_array = {
|
||||||
"ai_modules":[],
|
"ai_modules":[],
|
||||||
|
|||||||
Reference in New Issue
Block a user