Two hours for guests and 14 days for users should be more than reasonable.
});
{/if}
- {if $__sessionKeepAlive|isset}
- new WCF.System.KeepAlive({@$__sessionKeepAlive});
-
- {if ENABLE_POLLING && $__wcf->user->userID}
- require(['WoltLabSuite/Core/Notification/Handler'], function(NotificationHandler) {
- NotificationHandler.setup({
- enableNotifications: {if $__wcf->useDesktopNotifications()}true{else}false{/if},
- icon: '{$__wcf->getStyleHandler()->getStyle()->getFaviconAppleTouchIcon()}',
- sessionKeepAlive: {@$__sessionKeepAlive}
- });
+ {if ENABLE_POLLING && $__wcf->user->userID}
+ require(['WoltLabSuite/Core/Notification/Handler'], function(NotificationHandler) {
+ NotificationHandler.setup({
+ enableNotifications: {if $__wcf->useDesktopNotifications()}true{else}false{/if},
+ icon: '{$__wcf->getStyleHandler()->getStyle()->getFaviconAppleTouchIcon()}',
});
- {/if}
+ });
{/if}
});
</script>
}
};
-/**
- * Sends periodical requests to protect the session from expiring. By default
- * it will send a request 1 minute before it would expire.
- *
- * @param integer seconds
- */
-WCF.System.KeepAlive = Class.extend({
- /**
- * Initializes the WCF.System.KeepAlive class.
- *
- * @param integer seconds
- */
- init: function(seconds) {
- new WCF.PeriodicalExecuter(function(pe) {
- new WCF.Action.Proxy({
- autoSend: true,
- data: {
- actionName: 'keepAlive',
- className: 'wcf\\data\\session\\SessionAction'
- },
- failure: function() { pe.stop(); },
- showLoadingOverlay: false,
- success: function(data) {
- WCF.System.PushNotification.executeCallbacks(data);
- },
- suppressErrors: true
- });
- }, (seconds * 1000));
- }
-});
-
/**
* System-wide handler for push notifications.
*/
//noinspection JSUnresolvedVariable
var _lastRequestTimestamp = window.TIME_NOW;
var _requestTimer = null;
- var _sessionKeepAlive = 0;
/**
* @exports WoltLabSuite/Core/Notification/Handler
options = Core.extend({
enableNotifications: false,
icon: '',
- sessionKeepAlive: 0
}, options);
_icon = options.icon;
- _sessionKeepAlive = options.sessionKeepAlive * 60;
this._prepareNextRequest();
_prepareNextRequest: function() {
this._resetTimer();
- var delay = Math.min(this._getNextDelay(), _sessionKeepAlive);
- _requestTimer = window.setTimeout(this._dispatchRequest.bind(this), delay * 60000);
+ _requestTimer = window.setTimeout(this._dispatchRequest.bind(this), this._getNextDelay() * 60000);
},
/**
$application->__run();
}
- // TODO: Check this
- self::getTPL()->assign('__sessionKeepAlive', 60 * 50);
+ /** @deprecated The below variable is deprecated. */
+ self::getTPL()->assign('__sessionKeepAlive', 59 * 60);
}
}