From 72f03e9f130d787614c924fcd0f54c675025db64 Mon Sep 17 00:00:00 2001 From: zeus Date: Mon, 23 Nov 2020 13:11:02 +0200 Subject: [PATCH] global --- swarmlab-app/src/run/app.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index edaa2ba..ae6764f 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -93,7 +93,7 @@ async function checkToken(token) { instance.defaults.timeout = 30000; const res = await instance.post('/istokenvalidsso',params,options); if(res.status == 200){ - console.log("check " +JSON.stringify(res.data)) + //console.log("check " +JSON.stringify(res.data)) return res.data }else{ console.log("noerror: " + res) @@ -298,6 +298,7 @@ cors(corsOptions), (req, res, next) => { var reslog = new Object(); reslog.log = obj + reslog.test = usersession.SOCKET.user //var n = {} //n.year = now.getFullYear(); //n.month = now.getMonth(); @@ -346,9 +347,9 @@ io.on('connection', s => { // ------------------------------ // --- set // ------------------------------ - var global = new Object(); - global.SOCKET = {}; - global.SOCKET.error = {}; + var usersession = new Object(); + usersession.SOCKET = {}; + usersession.SOCKET.error = {}; console.error('socket ...'); s.auth = false; @@ -362,9 +363,9 @@ io.on('connection', s => { var isvalid = await checkToken(token); if(isvalid.action == 'ok'){ console.log("Authserver ok ", s.id + ' - ' + token); - global.SOCKET.user = isvalid.user - global.SOCKET.scope = isvalid.scope // space delimeter - global.SOCKET.token = isvalid.token + usersession.SOCKET.user = isvalid.user + usersession.SOCKET.scope = isvalid.scope // space delimeter + usersession.SOCKET.token = isvalid.token s.auth = true; }else{ console.log("Authserver no ", s.id + ' - ' + token);