1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Cookie session is now auto-refreshed.

This commit is contained in:
Ylian Saint-Hilaire 2020-06-12 12:00:58 -07:00
parent 070bcde280
commit dfdaac0549
3 changed files with 30 additions and 1 deletions

View file

@ -739,6 +739,7 @@
var debugLevel = parseInt('{{{debuglevel}}}');
var features = parseInt('{{{features}}}');
var sessionTime = parseInt('{{{sessiontime}}}');
var sessionRefreshTimer = null;
var domain = '{{{domain}}}';
var domainUrl = '{{{domainurl}}}';
var authCookie = '{{{authCookie}}}';
@ -799,6 +800,17 @@
attemptWebRTC = 0; // For now, default WebRTC off unless we set it in the URL.
if (args.webrtc != null) { attemptWebRTC = (args.webrtc == 1); }
// Session Refresh Timer
sessionRefreshTimer = setInterval(function () {
var xdr = null;
try { xdr = new XDomainRequest(); } catch (e) { }
if (!xdr) xdr = new XMLHttpRequest();
xdr.open('GET', window.location.origin + domainUrl + 'refresh.ashx');
xdr.timeout = 15000;
xdr.onload = xdr.onerror = xdr.ontimeout = function () { };
xdr.send();
}, Math.round((sessionTime * 60000) * 0.8))
}
function onStateChanged(server, state, prevState, errorCode) {

View file

@ -1219,6 +1219,7 @@
var debugLevel = parseInt('{{{debuglevel}}}');
var features = parseInt('{{{features}}}');
var sessionTime = parseInt('{{{sessiontime}}}');
var sessionRefreshTimer = null;
var domain = '{{{domain}}}';
var domainUrl = '{{{domainurl}}}';
var authCookie = '{{{authCookie}}}';
@ -1419,6 +1420,17 @@
QH('devCustomUIBar', x);
}
}
// Session Refresh Timer
sessionRefreshTimer = setInterval(function () {
var xdr = null;
try { xdr = new XDomainRequest(); } catch (e) { }
if (!xdr) xdr = new XMLHttpRequest();
xdr.open('GET', window.location.origin + domainUrl + 'refresh.ashx');
xdr.timeout = 15000;
xdr.onload = xdr.onerror = xdr.ontimeout = function () { };
xdr.send();
}, Math.round((sessionTime * 60000) * 0.8))
}
// Generic handling of custom actions
@ -5025,7 +5037,7 @@
//for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
}
// Make a http get call- Replace this with AJAX get if jquery is used
// Make a http get call
function getSearchLocation() {
try {
var searchdata = Q('mapSearchLocation').value.trim();