1
0
mirror of https://github.com/TheGreyDiamond/Enlight.git synced 2025-07-18 04:33:50 +02:00

Basic session joining

This commit is contained in:
TheGreyDiamond
2020-11-29 00:07:59 +01:00
parent 2edc4deb94
commit f379d1c12d

View File

@ -209,6 +209,19 @@ function init() {
restApp.get('/api/v1/session/info', (req, res) => {
res.json({state:"Succes", name: mySession.name, joinAble: mySession.joinable, passwordProtected: mySession.passwordProtected});
})
restApp.get('/api/v1/session/join', (req, res) => {
if(mySession.joinable){
if(mySession.passwordProtected == false){
res.json({state: "Succes"})
}else{
res.json({state: "Failed", message: "Passwords are not yet implemented", code: -1})
}
}else{
res.json({state: "Failed", message: "Session is not joinable.", code: 1})
}
//name: mySession.name, joinAble: mySession.joinable, passwordProtected: mySession.passwordProtected});
})
}, 20);
// Handling sessioning
@ -221,7 +234,7 @@ function init() {
setTimeout(doneLoading, 2000);
ipcMain.on("asynchronous-message", (event, arg) => {
console.log(arg); // prints "ping"
console.log(arg);
if (arg == "hasBattery") {
event.reply("asynchronous-reply", sysInf.battery().hasbattery);
}