Remove legacy session keepAlive from template
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 5 Oct 2020 10:22:54 +0000 (12:22 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 15 Oct 2020 14:13:53 +0000 (16:13 +0200)
Two hours for guests and 14 days for users should be more than reasonable.

com.woltlab.wcf/templates/headIncludeJavaScript.tpl
wcfsetup/install/files/js/WCF.js
wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js
wcfsetup/install/files/lib/system/WCF.class.php

index 634055da280f990758c676cb48ead72409abbfab..9975e837f1c407f77c4d650cf5f8813322da5d54 100644 (file)
@@ -233,18 +233,13 @@ window.addEventListener('pageshow', function(event) {
                        });
                {/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>
index 4cb1254d5a2a0d976447dd4ac6fab31f060a6a27..e456da4f62ccad2d5df1998859682e79c9cd81a7 100755 (executable)
@@ -5202,37 +5202,6 @@ WCF.System.PageNavigation = {
        }
 };
 
-/**
- * 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.
  */
index 2dfe96eade836d7a6d7759b7c9f091c8bc2d182b..0fbb09a5de12b8718aa9a2b92a243d789e6ca326 100644 (file)
@@ -23,7 +23,6 @@ define(['Ajax', 'Core', 'EventHandler', 'StringUtil'], function(Ajax, Core, Even
        //noinspection JSUnresolvedVariable
        var _lastRequestTimestamp = window.TIME_NOW;
        var _requestTimer = null;
-       var _sessionKeepAlive = 0;
        
        /**
         * @exports     WoltLabSuite/Core/Notification/Handler
@@ -38,11 +37,9 @@ define(['Ajax', 'Core', 'EventHandler', 'StringUtil'], function(Ajax, Core, Even
                        options = Core.extend({
                                enableNotifications: false,
                                icon: '',
-                               sessionKeepAlive: 0
                        }, options);
                        
                        _icon = options.icon;
-                       _sessionKeepAlive = options.sessionKeepAlive * 60;
                        
                        this._prepareNextRequest();
                        
@@ -127,8 +124,7 @@ define(['Ajax', 'Core', 'EventHandler', 'StringUtil'], function(Ajax, Core, Even
                _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);
                },
                
                /**
index 6c04c86fea3f136aed209e26fea75074a706a902..51f75f1f07c91688a945a11546090da10d3033e2 100644 (file)
@@ -593,8 +593,8 @@ class WCF {
                                $application->__run();
                        }
                        
-                       // TODO: Check this
-                       self::getTPL()->assign('__sessionKeepAlive', 60 * 50);
+                       /** @deprecated The below variable is deprecated. */
+                       self::getTPL()->assign('__sessionKeepAlive', 59 * 60);
                }
        }