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:
15
index.js
15
index.js
@ -209,6 +209,19 @@ function init() {
|
|||||||
restApp.get('/api/v1/session/info', (req, res) => {
|
restApp.get('/api/v1/session/info', (req, res) => {
|
||||||
res.json({state:"Succes", name: mySession.name, joinAble: mySession.joinable, passwordProtected: mySession.passwordProtected});
|
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);
|
}, 20);
|
||||||
|
|
||||||
// Handling sessioning
|
// Handling sessioning
|
||||||
@ -221,7 +234,7 @@ function init() {
|
|||||||
|
|
||||||
setTimeout(doneLoading, 2000);
|
setTimeout(doneLoading, 2000);
|
||||||
ipcMain.on("asynchronous-message", (event, arg) => {
|
ipcMain.on("asynchronous-message", (event, arg) => {
|
||||||
console.log(arg); // prints "ping"
|
console.log(arg);
|
||||||
if (arg == "hasBattery") {
|
if (arg == "hasBattery") {
|
||||||
event.reply("asynchronous-reply", sysInf.battery().hasbattery);
|
event.reply("asynchronous-reply", sysInf.battery().hasbattery);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user