diff --git a/static/app/config.js b/static/app/config.js
new file mode 100755
index 000000000..4ac68f73d
--- /dev/null
+++ b/static/app/config.js
@@ -0,0 +1,47 @@
+
+
+//设置自动更新
+function SetPanelAutoUpload(){
+ loadT = layer.msg(lan.public.config,{icon:16,time:0});
+ $.post('/config?action=AutoUpdatePanel','',function(rdata){
+ layer.close(loadT);
+ layer.msg(rdata.msg,{icon:rdata.status?1:2});
+ });
+}
+
+
+$(".set-submit").click(function(){
+ var data = $("#set-Config").serialize();
+ layer.msg(lan.config.config_save,{icon:16,time:0,shade: [0.3, '#000']});
+ $.post('/config?action=setPanel',data,function(rdata){
+ layer.closeAll();
+ layer.msg(rdata.msg,{icon:rdata.status?1:2});
+ if(rdata.status){
+ setTimeout(function(){
+ window.location.href = ((window.location.protocol.indexOf('https') != -1)?'https://':'http://') + rdata.host + window.location.pathname;
+ },1500);
+ }
+ });
+
+});
+
+
+function syncDate(){
+ var loadT = layer.msg(lan.config.config_sync,{icon:16,time:0,shade: [0.3, '#000']});
+ $.post('/config?action=syncDate','',function(rdata){
+ layer.close(loadT);
+ layer.msg(rdata.msg,{icon:1});
+ setTimeout(function(){
+ window.location.reload();
+ },1500);
+ });
+}
+
+//PHP守护程序
+function Set502(){
+ var loadT = layer.msg(lan.public.the,{icon:16,time:0,shade: [0.3, '#000']});
+ $.post('/config?action=Set502','',function(rdata){
+ layer.close(loadT);
+ layer.msg(rdata.msg,{icon:rdata.status?1:2});
+ });
+}
\ No newline at end of file
diff --git a/static/config.js b/static/config.js
deleted file mode 100755
index 475d1ac1b..000000000
--- a/static/config.js
+++ /dev/null
@@ -1,372 +0,0 @@
-
-
-//设置自动更新
-function SetPanelAutoUpload(){
- loadT = layer.msg(lan.public.config,{icon:16,time:0});
- $.post('/config?action=AutoUpdatePanel','',function(rdata){
- layer.close(loadT);
- layer.msg(rdata.msg,{icon:rdata.status?1:2});
- });
-}
-
-
-$(".set-submit").click(function(){
- var data = $("#set-Config").serialize();
- layer.msg(lan.config.config_save,{icon:16,time:0,shade: [0.3, '#000']});
- $.post('/config?action=setPanel',data,function(rdata){
- layer.closeAll();
- layer.msg(rdata.msg,{icon:rdata.status?1:2});
- if(rdata.status){
- setTimeout(function(){
- window.location.href = ((window.location.protocol.indexOf('https') != -1)?'https://':'http://') + rdata.host + window.location.pathname;
- },1500);
- }
- });
-
-});
-
-
-function syncDate(){
- var loadT = layer.msg(lan.config.config_sync,{icon:16,time:0,shade: [0.3, '#000']});
- $.post('/config?action=syncDate','',function(rdata){
- layer.close(loadT);
- layer.msg(rdata.msg,{icon:1});
- setTimeout(function(){
- window.location.reload();
- },1500);
- });
-}
-
-//PHP守护程序
-function Set502(){
- var loadT = layer.msg(lan.public.the,{icon:16,time:0,shade: [0.3, '#000']});
- $.post('/config?action=Set502','',function(rdata){
- layer.close(loadT);
- layer.msg(rdata.msg,{icon:rdata.status?1:2});
- });
-}
-
-//绑定修改宝塔账号
-function bindBTName(a,type){
- var titleName = lan.config.config_user_binding;
- if(type == "b"){
- btn = "";
- }
- else{
- titleName = lan.config.config_user_edit;
- btn = "";
- }
- if(a == 1) {
- p1 = $("#p1").val();
- p2 = $("#p2").val();
- var loadT = layer.msg(lan.config.token_get,{icon:16,time:0,shade: [0.3, '#000']});
- $.post(" /ssl?action=GetToken", "username=" + p1 + "&password=" + p2, function(b){
- layer.close(loadT);
- layer.msg(b.msg, {icon: b.status?1:2});
- if(b.status) {
- window.location.reload();
- $("input[name='btusername']").val(p1);
- }
- });
- return
- }
- layer.open({
- type: 1,
- area: "290px",
- title: titleName,
- closeBtn: 2,
- shift: 5,
- shadeClose: false,
- content: "
"
- })
-}
-//解除绑定宝塔账号
-function UnboundBt(){
- var name = $("input[name='btusername']").val();
- layer.confirm(lan.config.binding_un_msg,{closeBtn:2,icon:3,title:lan.config.binding_un},function(){
- $.get("/ssl?action=DelToken",function(b){
- layer.msg(b.msg,{icon:b.status? 1:2})
- $("input[name='btusername']").val('');
- })
- })
-}
-$.get("/ssl?action=GetUserInfo",function(b){
- if(b.status){
- $("input[name='btusername']").val(b.data.username);
- $("input[name='btusername']").next().text(lan.public.edit).attr("onclick","bindBTName(2,'c')").css({"margin-left":"-82px"});
- $("input[name='btusername']").next().after(''+lan.config.binding_un+'');
- }
- else{
- $("input[name='btusername']").next().text(lan.config.binding).attr("onclick","bindBTName(2,'b')").removeAttr("style");
- }
-});
-
-//设置API
-function apiSetup(){
- var loadT = layer.msg(lan.config.token_get,{icon:16,time:0,shade: [0.3, '#000']});
- $.get('/api?action=GetToken',function(rdata){
- layer.close(loadT);
-
- });
-}
-
-
-//设置模板
-function setTemplate(){
- var template = $("select[name='template']").val();
- var loadT = layer.msg(lan.public.the,{icon:16,time:0,shade: [0.3, '#000']});
- $.post('/config?action=SetTemplates','templates='+template,function(rdata){
- layer.close(loadT);
- layer.msg(rdata.msg,{icon:rdata.status?1:5});
- if(rdata.status === true){
- $.get('/system?action=ReWeb',function(){});
- setTimeout(function(){
- window.location.reload();
- },3000);
- }
- });
-}
-
-//设置面板SSL
-function setPanelSSL(){
- var status = $("#sshswitch").prop("checked")==true?1:0;
- var msg = $("#panelSSL").attr('checked')?lan.config.ssl_close_msg:''+lan.config.ssl_open_ps+''+lan.config.ssl_open_ps_1+''+lan.config.ssl_open_ps_2+''+lan.config.ssl_open_ps_3+''+lan.config.ssl_open_ps_5+'
';
- layer.confirm(msg,{title:lan.config.ssl_title,closeBtn:2,icon:3,area:'550px',cancel:function(){
- if(status == 0){
- $("#panelSSL").prop("checked",false);
- }
- else{
- $("#panelSSL").prop("checked",true);
- }
- }},function(){
- if(window.location.protocol.indexOf('https') == -1){
- if(!$("#checkSSL").prop('checked')){
- layer.msg(lan.config.ssl_ps,{icon:2});
- return false;
- }
- }
- var loadT = layer.msg(lan.config.ssl_msg,{icon:16,time:0,shade: [0.3, '#000']});
- $.post('/config?action=SetPanelSSL','',function(rdata){
- layer.close(loadT);
- layer.msg(rdata.msg,{icon:rdata.status?1:5});
- if(rdata.status === true){
- $.get('/system?action=ReWeb',function(){});
- setTimeout(function(){
- window.location.href = ((window.location.protocol.indexOf('https') != -1)?'http://':'https://') + window.location.host + window.location.pathname;
- },1500);
- }
- });
- },function(){
- if(status == 0){
- $("#panelSSL").prop("checked",false);
- }
- else{
- $("#panelSSL").prop("checked",true);
- }
- });
-}
-
-function GetPanelSSL(){
- var loadT = layer.msg('正在获取证书信息...',{icon:16,time:0,shade: [0.3, '#000']});
- $.post('/config?action=GetPanelSSL',{},function(cert){
- layer.close(loadT);
- var certBody = '\
-
\
-
密钥(KEY)
\
- \
-
\
-
证书(PEM格式)
\
- \
-
\
-
\
- \
-
\
-
\
-
\
- - 粘贴您的*.key以及*.pem内容,然后保存即可[帮助]。
\
- - 如果浏览器提示证书链不完整,请检查是否正确拼接PEM证书
- PEM格式证书 = 域名证书.crt + 根证书(root_bundle).crt
\
-
\
-
'
- layer.open({
- type: 1,
- area: "600px",
- title: '自定义面板证书',
- closeBtn: 2,
- shift: 5,
- shadeClose: false,
- content:certBody
- });
- });
-}
-
-function SavePanelSSL(){
- var data = {
- privateKey:$("#key").val(),
- certPem:$("#csr").val()
- }
- var loadT = layer.msg(lan.config.ssl_msg,{icon:16,time:0,shade: [0.3, '#000']});
- $.post('/config?action=SavePanelSSL',data,function(rdata){
- layer.close(loadT);
- if(rdata.status){
- layer.closeAll();
- }
- layer.msg(rdata.msg,{icon:rdata.status?1:2});
- });
-}
-
-if(window.location.protocol.indexOf('https') != -1){
- $("#panelSSL").attr('checked',true);
-}
-
-var weChat = {
- settiming:'',
- relHeight:500,
- relWidth:500,
- userLength:'',
- init:function(){
- var _this = this;
- $('.layui-layer-page').css('display', 'none');
- $('.layui-layer-page').width(_this.relWidth);
- $('.layui-layer-page').height(_this.relHeight);
- $('.bt-w-menu').height((_this.relWidth - 1) - $('.layui-layer-title').height());
- var width = $(document).width();
- var height = $(document).height();
- var boxwidth = (width / 2) - (_this.relWidth / 2);
- var boxheight = (height / 2) - (_this.relHeight / 2);
- $('.layui-layer-page').css({
- 'left':boxwidth +'px',
- 'top':boxheight+'px'
- });
- $('.boxConter,.layui-layer-page').css('display', 'block');
- $('.layui-layer-close').click(function(event) {
- window.clearInterval(_this.settiming);
- });
- this.getUserDetails();
- $('.iconCode').hide();
- $('.personalDetails').show();
- },
- // 获取二维码
- getQRCode:function(){
- var _this = this;
- var qrLoading = layer.msg('正在获取二维码,请稍后...',{time:0,shade: [0.4,'#fff'],icon:16});
- $.get('/wxapp?action=blind_qrcode', function(res) {
- layer.close(qrLoading);
- if (res.status){
- $('#QRcode').empty();
- $('#QRcode').qrcode({
- render: "canvas", //也可以替换为table
- width: 200,
- height: 200,
- text:res.msg
- });
- // $('.QRcode img').attr('src', res.msg);
- _this.settiming = setInterval(function(){
- _this.verifyBdinding();
- },2000);
- }else{
- layer.msg('无法获取二维码,请稍后重试',{icon:2});
- }
- });
- },
- // 获取用户信息
- getUserDetails:function(type){
- var _this = this;
- var conter = '';
- $.get('/wxapp?action=get_user_info',function(res){
- clearInterval(_this.settiming);
- if (!res.status){
- layer.msg(res.msg,{icon:2,time:3000});
- $('.iconCode').hide();
- return false;
- }
- if (JSON.stringify(res.msg) =='{}'){
- if (type){
- layer.msg('当前绑定列表为空,请先绑定然后重试',{icon:2});
- }else{
- _this.getQRCode();
- }
- $('.iconCode').show();
- $('.personalDetails').hide();
- return false;
- }
- $('.iconCode').hide();
- $('.personalDetails').show();
- var datas = res.msg;
- for(var item in datas){
- conter += '\
- \
- 昵称:'+datas[item].nickName+'
\
- \
- '
- }
- conter += '添加绑定账号'
- $('.userList').empty().append(conter);
- });
- },
- // 添加绑定视图
- addweChatView:function(){
- $('.iconCode').show();
- $('.personalDetails').hide();
- this.getQRCode();
- },
- // 取消当前绑定
- cancelBdinding:function(uid){
- var _this = this;
- var bdinding = layer.confirm('您确定要取消当前绑定吗?',{
- btn:['确认','取消'],
- icon:3,
- title:'取消绑定'
- },function(){
- $.get('/wxapp?action=blind_del',{uid:uid}, function(res) {
- layer.msg(res.msg,{icon:res.status?1:2});
- _this.getUserDetails();
- });
- },function(){
- layer.close(bdinding);
- });
- },
- // 监听是否绑定
- verifyBdinding:function(){
- var _this = this;
- $.get('/wxapp?action=blind_result',function(res){
- if(res){
- layer.msg('绑定成功',{icon:1});
- clearInterval(_this.settiming);
- _this.getUserDetails();
- }
- });
- },
- }
-
-function open_wxapp(){
- var rhtml = '\
-
\
-
\
-
\
-
\
-
\
- - 1、打开宝塔面板小程序小程序二维码
\
- - 2、使用宝塔小程序扫描当前二维码,绑定该面板
\
-
\
-
查看绑定列表\
-
\
-
\
-
\
-
\
-
'
-
- layer.open({
- type: 1,
- title: "绑定微信",
- area: '500px',
- closeBtn: 2,
- shadeClose: false,
- content:rhtml
- });
-
- weChat.init();
-}
\ No newline at end of file