mirror of
https://github.com/webxoss/webxoss-client.git
synced 2024-11-20 05:49:55 +01:00
splite backend
This commit is contained in:
parent
5bd921d1ee
commit
4b1c84b47a
2 changed files with 22 additions and 4 deletions
|
@ -86,7 +86,15 @@ if (location.search === '?local=true') {
|
|||
console.log = function () {
|
||||
window._lastLog = arguments;
|
||||
};
|
||||
var url = getProxy() || location.host;
|
||||
var host = getProxy();
|
||||
if (!host) {
|
||||
if (/:\d*$/.test(location.host)) {
|
||||
host = location.host.replace(/:\d*$/, ':2015');
|
||||
} else {
|
||||
host = location.host + ':2015'
|
||||
}
|
||||
}
|
||||
var url = location.protocol + '//' + host
|
||||
socket = io(url,{
|
||||
reconnection: false,
|
||||
reconnectionDelay: 3000,
|
||||
|
@ -101,6 +109,17 @@ var chatManager = new ChatManager(socket);
|
|||
|
||||
/* 代理 */
|
||||
function getProxy () {
|
||||
var proxy = localStorage.getItem('proxy');
|
||||
// 兼容旧版
|
||||
var updateMap = {
|
||||
'cloudflare.webxoss.com': 'cloudflare.webxoss.com:2015',
|
||||
'incapsula.webxoss.com': 'incapsula.webxoss.com:2015',
|
||||
'shanghai.webxoss.com:10086': '',
|
||||
};
|
||||
if (proxy in updateMap) {
|
||||
proxy = updateMap[proxy];
|
||||
localStorage.setItem('proxy', proxy)
|
||||
}
|
||||
return localStorage.getItem('proxy') || '';
|
||||
}
|
||||
$('span-set-proxy').onclick = function () {
|
||||
|
|
|
@ -189,9 +189,8 @@
|
|||
<select id="select-proxy">
|
||||
<option id="proxy-noproxy" value="">不使用代理</option>
|
||||
<option id="proxy-hongkong" value="hongkong.webxoss.com:8080">HongKong</option>
|
||||
<option id="proxy-cloudflare" value="cloudflare.webxoss.com">CloudFlare</option>
|
||||
<option id="proxy-incapsula" value="incapsula.webxoss.com">Incapsula</option>
|
||||
<option id="proxy-shanghai" value="shanghai.webxoss.com:10086">ShangHai</option>
|
||||
<option id="proxy-cloudflare" value="cloudflare.webxoss.com:2015">CloudFlare</option>
|
||||
<option id="proxy-incapsula" value="incapsula.webxoss.com:2015">Incapsula</option>
|
||||
<option id="proxy-provide" value="provide">提供代理服务器...</option>
|
||||
</select>
|
||||
<button id="proxy-button-ok">确定</button>
|
||||
|
|
Loading…
Reference in a new issue