init: 从宝塔同步到 Gitea
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
if(window.WebSocket){
|
||||
var webSocket = new WebSocket("ws://192.168.206.130:8500");
|
||||
webSocket.onerror = function(event){
|
||||
layer.open({type: 1, area: ['380px', '190px'],closeBtn: false,btn: lang.confirm, content: '\<\div class="box">'+lang.connect_fail+'\<\/div>',yes:function(index, layero){
|
||||
layer.close(index);
|
||||
webSocket.close();
|
||||
window.location.href="/login/logout";
|
||||
}
|
||||
});
|
||||
}
|
||||
webSocket.onopen = function (event) {
|
||||
var userid = $('#userid').val();
|
||||
if(parseInt(userid) > 0){
|
||||
webSocket.send('{"connect":"client","mode":"connection","userid":"'+userid+'"}');
|
||||
}
|
||||
};
|
||||
webSocket.onmessage = function (event) {
|
||||
var data = $.parseJSON(event.data);
|
||||
if(data.sendMode == 'connection'){
|
||||
//登录失败
|
||||
layer.open({type: 1, area: ['380px', '165px'], closeBtn: false,btn: lang.confirm,content: '\<\div class="box">'+lang[data.msg]+'\<\/div>',yes:function(index, layero){
|
||||
layer.close(index);
|
||||
webSocket.close();
|
||||
window.location.href="/login/logout";
|
||||
}});
|
||||
}else if(data.sendMode == 'RepeatedEntry'){
|
||||
//有人重复登入
|
||||
webSocket.close();
|
||||
layer.open({type: 1, area: ['380px', '165px'], closeBtn: false,btn: lang.confirm,title:lang.message,content: '\<\div class="box">'+lang[data.msg]+'\<\/div>',yes:function(index, layero){
|
||||
layer.close(index);
|
||||
window.location.href="/login/logout";
|
||||
}});
|
||||
}
|
||||
}
|
||||
}else{
|
||||
layer.open({type: 1, area: ['380px', '165px'], closeBtn: false,btn: '确定', content: '\<\div class="box">'+lang.browser_tip+'\<\/div>',yes:function(index, layero){
|
||||
layer.close(index);
|
||||
window.location.href="/";
|
||||
}}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user