mirror of
https://github.com/JamesonHuang/OpenWrt_Luci_Lua.git
synced 2024-11-24 14:20:10 +00:00
232 lines
8.4 KiB
HTML
232 lines
8.4 KiB
HTML
|
<%
|
||
|
local XQVersion = require("xiaoqiang.XQVersion")
|
||
|
local XQSysUtil = require ("xiaoqiang.util.XQSysUtil")
|
||
|
local XQLanWanUtil = require("xiaoqiang.util.XQLanWanUtil")
|
||
|
local ver = XQVersion.webVersion
|
||
|
local monitor = XQLanWanUtil.getWanMonitorStat()
|
||
|
local pcClient = XQVersion.pcClientServer
|
||
|
local macClient = XQVersion.macClientServer
|
||
|
local androidClient = XQVersion.androidClientServer
|
||
|
if monitor.WANLINKSTAT ~= "UP" then
|
||
|
pcClient = XQVersion.pcClientRouter
|
||
|
macClient = XQVersion.macClientRouter
|
||
|
androidClient = XQVersion.androidClientRouter
|
||
|
end
|
||
|
|
||
|
local remote_addr = luci.http.getenv("REMOTE_ADDR")
|
||
|
local mac = luci.sys.net.ip4mac(remote_addr)
|
||
|
|
||
|
-- URL ENV SWTICH
|
||
|
local XQConfigs = require "xiaoqiang.common.XQConfigs"
|
||
|
local pspBaseUrl
|
||
|
local xmServerUrl
|
||
|
if XQConfigs.SERVER_CONFIG == 0 then
|
||
|
pspBaseUrl = XQConfigs.PASSPORT_CONFIG_ONLINE_URL
|
||
|
xmServerUrl = XQConfigs.XQ_SERVER_ONLINE_API_URL
|
||
|
elseif XQConfigs.SERVER_CONFIG == 1 then
|
||
|
pspBaseUrl = XQConfigs.PASSPORT_CONFIG_PREVIEW_URL
|
||
|
xmServerUrl = XQConfigs.XQ_SERVER_STAGING_API_URL
|
||
|
end
|
||
|
%>
|
||
|
<!--[if lt IE 7]>
|
||
|
<script>
|
||
|
try{ document.execCommand("BackgroundImageCache",false,true);} catch(e){}
|
||
|
</script>
|
||
|
<![endif]-->
|
||
|
<link rel="stylesheet" href="<%=resource%>/web/css/dialog.css?v=<%=ver%>">
|
||
|
<div id="panelClientdld" class="panel-client-dld" style="display:none; z-index:101;">
|
||
|
<ul class="clearfix">
|
||
|
<li class="first">
|
||
|
<a href="<%=pcClient%>">
|
||
|
<img src="<%=resource%>/web/img/v2/pic_client_pc.png" alt="">
|
||
|
<span>PC版</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="<%=macClient%>">
|
||
|
<img src="<%=resource%>/web/img/v2/pic_client_mac.png" alt="">
|
||
|
<span>Mac版</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="<%=androidClient%>">
|
||
|
<img src="<%=resource%>/web/img/v2/pic_client_ad.png" alt="">
|
||
|
<span>Android</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<div class="dur"></div>
|
||
|
</div>
|
||
|
<div id="downloadMask" style="display:none; position:absolute; left:0; top:0; z-index:100;"></div>
|
||
|
<script type="tmpl/html" id="xiaomibind">
|
||
|
<div class="mod-panel-bind">
|
||
|
<form action="/" class="form form-horizontal from-xiaomibind" method="post" name="xiaomipsp" id="xiaomipsp">
|
||
|
<div class="item">
|
||
|
<label class="k">小米账号:</label>
|
||
|
<span class="v"><input type="text" name="uuid" id="xmuuid" class="text input-large" placeholder="请输入手机号码/邮箱/小米ID"></span>
|
||
|
<em class="t"></em>
|
||
|
</div>
|
||
|
<div class="item">
|
||
|
<label class="k">密 码:</label>
|
||
|
<span class="v"><input type="password" name="password" id="xmpassword" class="text input-large" placeholder="请输入密码"></span>
|
||
|
<em class="t"></em>
|
||
|
</div>
|
||
|
<div class="item item-control item-rsp-err" style="display:none;"><em class="t"></em></div>
|
||
|
<div class="item item-control">
|
||
|
<button type="submit" id="btnBindXiaomi" class="btn btn-primary l"><span>登录并绑定</span></button>
|
||
|
<a target="_blank" href="https://account.xiaomi.com/pass/forgetPassword" class="r">忘记密码?</a>
|
||
|
</div>
|
||
|
</form>
|
||
|
<div class="reg">
|
||
|
<h3>为什么要绑定小米账号?</h3>
|
||
|
<ul>
|
||
|
<li>可以随时远程查看、管理路由器</li>
|
||
|
<li>不开电脑也能下载电影</li>
|
||
|
<li>支持更多插件的安装</li>
|
||
|
</ul>
|
||
|
<p>没有小米账号?<a href="https://account.xiaomi.com/pass/register" target="_blank">立即创建一个</a></p>
|
||
|
</div>
|
||
|
</div>
|
||
|
</script>
|
||
|
<script>
|
||
|
var global_static_url = '<%=resource%>';
|
||
|
</script>
|
||
|
<script src="<%=resource%>/web/js/common.js?v=<%=ver%>"></script>
|
||
|
<script src="<%=resource%>/web/js/md5.js?v=<%=ver%>"></script>
|
||
|
<script src="<%=resource%>/web/js/base64.js?v=<%=ver%>"></script>
|
||
|
<script src="/js/crypto-js/rollups/sha1.js?v=<%=ver%>"></script>
|
||
|
<script src="/js/crypto-js/rollups/aes.js?v=<%=ver%>"></script>
|
||
|
<script>
|
||
|
//检测ajax登录是否失效
|
||
|
$(global_event).trigger('needLogin');
|
||
|
global_event.pspBaseUrl = '<%=pspBaseUrl%>';
|
||
|
global_event.xmServerUrl = '<%=xmServerUrl%>';
|
||
|
global_event.crypto = {
|
||
|
key: 'a2ffa5c9be07488bbb04a3a47d3c5f6a',
|
||
|
iv: '64175472480004614961023454661220',
|
||
|
nonce: null,
|
||
|
init: function(){
|
||
|
var nonce = this.nonceCreat();
|
||
|
this.nonce = nonce;
|
||
|
},
|
||
|
nonceCreat: function(){
|
||
|
var type = 0;
|
||
|
var deviceId = '<%=mac%>';
|
||
|
var time = Math.floor(new Date().getTime() / 1000);
|
||
|
var random = Math.floor(Math.random() * 10000);
|
||
|
return [type, deviceId, time, random].join('_');
|
||
|
},
|
||
|
oldPwd : function(pwd){
|
||
|
return CryptoJS.SHA1(this.nonce + CryptoJS.SHA1(pwd + this.key).toString()).toString();
|
||
|
},
|
||
|
newPwd: function(pwd, newpwd){
|
||
|
var key = CryptoJS.SHA1(pwd + this.key).toString();
|
||
|
key = CryptoJS.enc.Hex.parse(key).toString();
|
||
|
key = key.substr(0, 32);
|
||
|
key = CryptoJS.enc.Hex.parse(key);
|
||
|
var password = CryptoJS.SHA1(newpwd + this.key).toString();
|
||
|
var iv = CryptoJS.enc.Hex.parse(this.iv);
|
||
|
var aes = CryptoJS.AES.encrypt(
|
||
|
password,
|
||
|
key,
|
||
|
{iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }
|
||
|
).toString();
|
||
|
return aes;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
$(global_event).on('downloadclient', function(evt, data){
|
||
|
|
||
|
var ModelClientDownload = (function(){
|
||
|
var base,
|
||
|
baseWidth,
|
||
|
basePos,
|
||
|
target = $('#panelClientdld'),
|
||
|
targetDur = target.find('.dur'),
|
||
|
targetWidth,
|
||
|
targetDurWidth,
|
||
|
docWidth,
|
||
|
targetLeft,
|
||
|
targetDurLeft,
|
||
|
timer;
|
||
|
if (target.length == 0) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var position = function(){
|
||
|
baseWidth = base.outerWidth();
|
||
|
basePos = base.offset();
|
||
|
targetWidth = target.outerWidth();
|
||
|
targetDurWidth = targetDur.outerWidth();
|
||
|
docWidth = $(window).width();
|
||
|
|
||
|
targetLeft = basePos.left + baseWidth/2 - targetWidth/2;
|
||
|
|
||
|
if (targetLeft + targetWidth > docWidth) {
|
||
|
targetLeft = docWidth - targetWidth - 10;
|
||
|
}
|
||
|
target.css({left: targetLeft});
|
||
|
targetDurLeft = basePos.left + baseWidth/2 - targetDurWidth/2 - targetLeft;
|
||
|
targetDur.css({left: targetDurLeft});
|
||
|
},
|
||
|
init = function(el){
|
||
|
base = el || $('#downloadclient');
|
||
|
position();
|
||
|
$(window).resize(function(){
|
||
|
window.clearTimeout(timer);
|
||
|
timer = window.setTimeout(function(){
|
||
|
position();
|
||
|
}, 400);
|
||
|
});
|
||
|
$('#downloadMask').on('click', function(e){
|
||
|
e.preventDefault();
|
||
|
$(this).hide();
|
||
|
target.hide();
|
||
|
});
|
||
|
},
|
||
|
show = function(){
|
||
|
maskShow();
|
||
|
target.show();
|
||
|
},
|
||
|
maskShow = function(){
|
||
|
$('#downloadMask').css({
|
||
|
width: '100%',
|
||
|
height: $(window).height()
|
||
|
}).show();
|
||
|
},
|
||
|
hide = function(){
|
||
|
target.hide();
|
||
|
window.clearTimeout(timer);
|
||
|
},
|
||
|
isopen = function(){
|
||
|
return target[0].style.display != 'none';
|
||
|
};
|
||
|
|
||
|
return {
|
||
|
init: init,
|
||
|
update: position,
|
||
|
show: show,
|
||
|
hide: hide,
|
||
|
isopen: isopen
|
||
|
}
|
||
|
})();
|
||
|
|
||
|
$('body').delegate('#downloadclient', 'click', function(e){
|
||
|
e.preventDefault();
|
||
|
if (navigator.userAgent.match(/Android/i)) {
|
||
|
location.href = '<%=androidClient%>';
|
||
|
return;
|
||
|
}
|
||
|
var $this = $(this),
|
||
|
panel = ModelClientDownload;
|
||
|
panel.init($this);
|
||
|
if (panel.isopen()) {
|
||
|
panel.hide();
|
||
|
}else{
|
||
|
panel.show();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
$(global_event).trigger('downloadclient');
|
||
|
</script>
|