Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/assets/js/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ class HttpUtil {
Vue.prototype.$message.success(msg.msg);
} else {
Vue.prototype.$message.error(msg.msg);
if (msg.msg == '登录时效已过,请重新登录') {
setTimeout(()=> {
Vue.prototype.$message.warning("即将开始重新登录!")
setTimeout(()=> {window.location.reload()},3000)
},2000)
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion web/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net"
"net/http"
"strings"
"time"
"x-ui/config"
"x-ui/logger"
"x-ui/web/entity"
Expand Down Expand Up @@ -82,7 +83,8 @@ func html(c *gin.Context, name string, title string, data gin.H) {

func getContext(h gin.H) gin.H {
a := gin.H{
"cur_ver": config.GetVersion(),
"cur_ver": config.GetVersion(),
"timeStamp": time.Now().Unix(),
}
if h != nil {
for key, value := range h {
Expand Down
13 changes: 7 additions & 6 deletions web/html/common/js.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
<script src="{{ .base_path }}assets/qrcode/qrious.min.js"></script>
<script src="{{ .base_path }}assets/clipboard/clipboard.min.js"></script>
<script src="{{ .base_path }}assets/uri/URI.min.js"></script>
<script src="{{ .base_path }}assets/js/axios-init.js?{{ .cur_ver }}"></script>
<script src="{{ .base_path }}assets/js/util/common.js?{{ .cur_ver }}"></script>
<script src="{{ .base_path }}assets/js/util/date-util.js?{{ .cur_ver }}"></script>
<script src="{{ .base_path }}assets/js/util/utils.js?{{ .cur_ver }}"></script>
<script src="{{ .base_path }}assets/js/model/xray.js?{{ .cur_ver }}"></script>
<script src="{{ .base_path }}assets/js/model/models.js?{{ .cur_ver }}"></script>
<!-- 这里通过插入时间戳,避免因为浏览器缓存原因无法读取到js文件修改的变化 -->
<script src="{{ .base_path }}assets/js/axios-init.js?{{ .timeStamp }}"></script>
<script src="{{ .base_path }}assets/js/util/common.js?{{ .timeStamp }}"></script>
<script src="{{ .base_path }}assets/js/util/date-util.js?{{ .timeStamp }}"></script>
<script src="{{ .base_path }}assets/js/util/utils.js?{{ .timeStamp }}"></script>
<script src="{{ .base_path }}assets/js/model/xray.js?{{ .timeStamp }}"></script>
<script src="{{ .base_path }}assets/js/model/models.js?{{ .timeStamp }}"></script>
<script>
const basePath = '{{ .base_path }}';
axios.defaults.baseURL = basePath;
Expand Down
2 changes: 1 addition & 1 deletion web/html/xui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ <h2>请谨慎选择,旧版本可能配置不兼容</h2>
} catch (e) {
console.error(e);
}
await PromiseUtil.sleep(2000);
await PromiseUtil.sleep(15000);
}
},
});
Expand Down