mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-15 09:46:06 +01:00
Keepalive in admin. Fires a 'keepAlive' task 5s before the end of the admin session
This commit is contained in:
@@ -20,6 +20,10 @@ var bytesToSize = function(bytes) {
|
||||
|
||||
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
|
||||
var keepAlive = function keepAlive() {
|
||||
$.post(GravAdmin.config.base_url_relative + '/task' + GravAdmin.config.param_sep + 'keepAlive');
|
||||
};
|
||||
|
||||
$(function () {
|
||||
jQuery.substitute = function(str, sub) {
|
||||
return str.replace(/\{(.+?)\}/g, function($0, $1) {
|
||||
@@ -513,4 +517,10 @@ $(function () {
|
||||
remodal.find('strong').text(name);
|
||||
remodal.find('.button.continue').attr('href', $(e.target).attr('href'));
|
||||
});
|
||||
|
||||
// Keep-alive
|
||||
setInterval(function() {
|
||||
keepAlive();
|
||||
}, GravAdmin.config.admin_timeout*1000 - 5*1000); //Call keepAlive() 5s before the admin session timeout
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user