zoukankan      html  css  js  c++  java
  • OpenWrt超时检测

    参考http://www.right.com.cn/forum/thread-261702-1-1.html

    vim /home/ihid/chaos_calmer/feeds/luci/modules/luci-base/root/etc/config/luci
    

    修改sessiontime为自定义数值:

    config internal sauth
    	option sessionpath "/tmp/luci-sessions"
    	option sessiontime 3600
    

    修改/home/ihid/chaos_calmer/feeds/luci/themes/luci-theme-violet/luasrc/view/themes/violet/header.htm文件(取决于你用的是哪个主题),在里面添加一个js函数解决问题 :

    <script>
            var lastTime = new Date().getTime();
            var currentTime = new Date().getTime();
            var timeOut = 20 * 60 * 1000;
    
            window.onload=function (){
                    window.document.onmousemove=function(){
                            lastTime = new Date().getTime();
                    }
            };
            function testTime(){
                    currentTime = new Date().getTime(); 
                    if(currentTime - lastTime > timeOut){
                            console.log("TimeOut");
                            var tmp = 0;
                            document.onmousedown=function(event){ 
                                    if (tmp == 0){
                                            alert("操作超时,请重新登录!");
                                            window.location.href="/cgi-bin/luci";
                                            tmp = 1;
                                    }
                            }
                            document.onkeydown=function(event){
                                    if (tmp == 0){
                                            alert("操作超时,请重新登录!");
                                            window.location.href="/cgi-bin/luci";
                                            tmp = 1;
                                    }
                            }
                    }
            }
    
            window.setInterval(testTime, 1000);
    </script>
    
  • 相关阅读:
    2171 棋盘覆盖
    [网络流24题] 骑士共存
    COGS28 [NOI2006] 最大获利[最大权闭合子图]
    1066: [SCOI2007]蜥蜴
    1877: [SDOI2009]晨跑
    POJ 2125 Destroying the Graph 二分图最小点权覆盖
    LA 3231
    3028: 食物
    PYOJ 44. 【HNSDFZ2016 #6】可持久化线段树
    1597: [Usaco2008 Mar]土地购买
  • 原文地址:https://www.cnblogs.com/ihid/p/9458541.html
Copyright © 2011-2022 走看看