update
This commit is contained in:
parent
0b6f6612a5
commit
08e3a57e38
|
|
@ -1,114 +0,0 @@
|
|||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import shutil
|
||||
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
||||
from flask import Flask, session
|
||||
from datetime import timedelta
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import db
|
||||
import public
|
||||
|
||||
|
||||
class middleWare:
|
||||
|
||||
def __init__(self, wsgi_app):
|
||||
self.wsgi_app = wsgi_app
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.wsgi_app(*args, **kwargs)
|
||||
|
||||
|
||||
class config:
|
||||
__version = '0.0.1'
|
||||
__app = None
|
||||
__modules = None
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def makeApp(self, name):
|
||||
app = Flask(name)
|
||||
self.__app = app
|
||||
|
||||
app.config.version = self.__version
|
||||
app.config['SECRET_KEY'] = os.urandom(24)
|
||||
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
|
||||
|
||||
self.initDB()
|
||||
self.initInitD()
|
||||
self.initRoute()
|
||||
# self.startDebug()
|
||||
app.wsgi_app = middleWare(app.wsgi_app)
|
||||
return app
|
||||
|
||||
def startDebug(self):
|
||||
self.__app.debug = True
|
||||
self.__app.config.version = self.__version + str(time.time())
|
||||
|
||||
def initDB(self):
|
||||
try:
|
||||
sql = db.Sql().dbfile('default')
|
||||
csql = public.readFile('data/sql/default.sql')
|
||||
csql_list = csql.split(';')
|
||||
for index in range(len(csql_list)):
|
||||
sql.execute(csql_list[index], ())
|
||||
except Exception, ex:
|
||||
print str(ex)
|
||||
|
||||
def initUser(self):
|
||||
pass
|
||||
|
||||
def initInitD(self):
|
||||
script = public.getRunDir() + '/scripts/init.d/mw.tpl'
|
||||
script_bin = public.getRunDir() + '/scripts/init.d/mw'
|
||||
if os.path.exists(script_bin):
|
||||
return
|
||||
|
||||
content = public.readFile(script)
|
||||
content = content.replace("{$SERVER_PATH}", public.getRunDir())
|
||||
|
||||
public.writeFile(script_bin, content)
|
||||
public.execShell('chmod +x ' + script_bin)
|
||||
|
||||
if public.getOs() != 'darwin':
|
||||
initd_bin = '/etc/init.d/mw'
|
||||
if not os.path.exists(initd_bin):
|
||||
shutil.copyfile(script_bin, initd_bin)
|
||||
public.execShell('chmod +x ' + initd_bin)
|
||||
|
||||
def getVersion(self):
|
||||
return self.__version
|
||||
|
||||
def getApp(self):
|
||||
return self.__app
|
||||
|
||||
def initRoute(self):
|
||||
import route
|
||||
DEFAULT_MODULES = (
|
||||
(route.dashboard, "/"),
|
||||
(route.site, "/site"),
|
||||
(route.files, "/files"),
|
||||
(route.soft, "/soft"),
|
||||
(route.config, "/config"),
|
||||
(route.plugins, "/plugins"),
|
||||
(route.task, "/task"),
|
||||
(route.system, "/system"),
|
||||
(route.database, "/database"),
|
||||
(route.crontab, "/crontab"),
|
||||
(route.firewall, "/firewall"),
|
||||
(route.control, "/control")
|
||||
)
|
||||
self.modules = DEFAULT_MODULES
|
||||
self.settingModules(self.__app, DEFAULT_MODULES)
|
||||
|
||||
def settingModules(self, app, modules):
|
||||
for module, url_prefix in modules:
|
||||
app.register_blueprint(module, url_prefix=url_prefix)
|
||||
|
|
@ -9,6 +9,9 @@ import re
|
|||
import json
|
||||
import pwd
|
||||
|
||||
from flask import session
|
||||
from flask import request
|
||||
|
||||
|
||||
class config_api:
|
||||
|
||||
|
|
@ -16,14 +19,50 @@ class config_api:
|
|||
pass
|
||||
|
||||
##### ----- start ----- ###
|
||||
def syncDateApi(self):
|
||||
if public.isAppleSystem():
|
||||
return public.returnJson(True, '开发系统不必同步时间!')
|
||||
|
||||
data = public.execShell('ntpdate -s time.nist.gov')
|
||||
if data[0] == '':
|
||||
return public.returnJson(True, '同步成功!')
|
||||
return public.returnJson(False, '同步失败:' + data[0])
|
||||
|
||||
def setPasswordApi(self):
|
||||
password1 = request.form.get('password1', '')
|
||||
password2 = request.form.get('password2', '')
|
||||
if password1 != password2:
|
||||
return public.returnJson(False, '两次输入的密码不一致,请重新输入!')
|
||||
if len(password1) < 5:
|
||||
return public.returnJson(False, '用户密码不能小于5位!')
|
||||
public.M('users').where("username=?", (session['username'],)).setField(
|
||||
'password', public.md5(password1.strip()))
|
||||
return public.returnJson(True, '密码修改成功!')
|
||||
|
||||
def setNameApi(self):
|
||||
name1 = request.form.get('name1', '')
|
||||
name2 = request.form.get('name2', '')
|
||||
if name1 != name2:
|
||||
return public.returnJson(False, '两次输入的用户名不一致,请重新输入!')
|
||||
if len(name1) < 3:
|
||||
return public.returnJson(False, '用户名长度不能少于3位')
|
||||
|
||||
public.M('users').where("username=?", (session['username'],)).setField(
|
||||
'username', name1.strip())
|
||||
|
||||
session['username'] = name1
|
||||
return public.returnJson(True, '用户修改成功!')
|
||||
|
||||
##### ----- end ----- ###
|
||||
|
||||
def get(self):
|
||||
|
||||
data = {}
|
||||
|
||||
data['site_path'] = public.getWwwDir()
|
||||
data['backup_path'] = public.getBackupDir()
|
||||
data['systemdate'] = public.execShell(
|
||||
'date +"%Y-%m-%d %H:%M:%S %Z %z"')[0].strip()
|
||||
sformat = 'date +"%Y-%m-%d %H:%M:%S %Z %z"'
|
||||
data['systemdate'] = public.execShell(sformat)[0].strip()
|
||||
|
||||
if os.path.exists('data/port.pl'):
|
||||
data['port'] = public.readFile('data/port.pl').strip()
|
||||
|
|
@ -35,5 +74,7 @@ class config_api:
|
|||
else:
|
||||
data['ip'] = '127.0.0.1'
|
||||
|
||||
data['username'] = public.M('users').where(
|
||||
"id=?", (1,)).getField('username')
|
||||
|
||||
return data
|
||||
##### ----- end ----- ###
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"title":"GAE",
|
||||
"tip":"soft",
|
||||
"name":"gae",
|
||||
"ps":"GAE 英文全称为Google App Engine。它是Google管理的数据中心中用于WEB应用程序的开发和托管的平台",
|
||||
"ps":"GAE(Google App Engine)。它是Google管理的数据中心中用于WEB应用程序的开发和托管的平台",
|
||||
"versions": "0.1",
|
||||
"shell":"install.sh",
|
||||
"checks":"server/gae",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import time
|
|||
import shutil
|
||||
import uuid
|
||||
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from flask import Flask
|
||||
|
|
@ -28,8 +31,8 @@ import public
|
|||
app = Flask(__name__, template_folder='templates/default')
|
||||
app.config.version = '0.0.1'
|
||||
# app.config['SECRET_KEY'] = os.urandom(24)
|
||||
app.config['SECRET_KEY'] = uuid.UUID(int=uuid.getnode()).hex[-12:]
|
||||
# app.secret_key = uuid.UUID(int=uuid.getnode()).hex[-12:]
|
||||
app.config['SECRET_KEY'] = uuid.UUID(int=uuid.getnode()).hex[-12:]
|
||||
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
|
||||
try:
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
|
||||
$(".set-submit").click(function(){
|
||||
var data = $("#set-Config").serialize();
|
||||
layer.msg(lan.config.config_save,{icon:16,time:0,shade: [0.3, '#000']});
|
||||
var data = $("#set_config").serialize();
|
||||
console.log(data);
|
||||
layer.msg('正在保存配置...',{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});
|
||||
|
|
@ -15,31 +16,145 @@ $(".set-submit").click(function(){
|
|||
});
|
||||
|
||||
//设置自动更新
|
||||
function SetPanelAutoUpload(){
|
||||
function setPanelAutoUpload(){
|
||||
loadT = layer.msg(lan.public.config,{icon:16,time:0});
|
||||
$.post('/config?action=AutoUpdatePanel','',function(rdata){
|
||||
$.post('/config?action=AutoUpdatePanel', '', function(rdata){
|
||||
layer.close(loadT);
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
});
|
||||
}
|
||||
|
||||
function setPassword(a) {
|
||||
if(a == 1) {
|
||||
p1 = $("#p1").val();
|
||||
p2 = $("#p2").val();
|
||||
if(p1 == "" || p1.length < 8) {
|
||||
layer.msg('面板密码不能少于8位!', {icon: 2});
|
||||
return
|
||||
}
|
||||
|
||||
//准备弱口令匹配元素
|
||||
var checks = ['admin888','123123123','12345678','45678910','87654321','asdfghjkl','password','qwerqwer'];
|
||||
pchecks = 'abcdefghijklmnopqrstuvwxyz1234567890';
|
||||
for(var i=0;i<pchecks.length;i++){
|
||||
checks.push(pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]);
|
||||
}
|
||||
|
||||
//检查弱口令
|
||||
cps = p1.toLowerCase();
|
||||
var isError = "";
|
||||
for(var i=0;i<checks.length;i++){
|
||||
if(cps == checks[i]){
|
||||
isError += '['+checks[i]+'] ';
|
||||
}
|
||||
}
|
||||
|
||||
if(isError != ""){
|
||||
layer.msg('面板密码不能为弱口令'+isError,{icon:5});
|
||||
return;
|
||||
}
|
||||
|
||||
if(p1 != p2) {
|
||||
layer.msg('两次输入的密码不一致', {icon: 2});
|
||||
return;
|
||||
}
|
||||
$.post("/config/set_password", "password1=" + encodeURIComponent(p1) + "&password2=" + encodeURIComponent(p2), function(b) {
|
||||
if(b.status) {
|
||||
layer.closeAll();
|
||||
layer.msg(b.msg, {icon: 1});
|
||||
} else {
|
||||
layer.msg(b.msg, {icon: 2});
|
||||
}
|
||||
},'json');
|
||||
return;
|
||||
}
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: "290px",
|
||||
title: '修改密码',
|
||||
closeBtn: 2,
|
||||
shift: 5,
|
||||
shadeClose: false,
|
||||
content: "<div class='bt-form pd20 pb70'>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='password1' id='p1' value='' placeholder='新的密码' style='width:100%'/></div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>重复</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='password2' id='p2' value='' placeholder='再输一次' style='width:100%' /></div>\
|
||||
</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<span style='float: left;' title='随机密码' class='btn btn-default btn-sm' onclick='randPwd(10)'>随机</span>\
|
||||
<button type='button' class='btn btn-danger btn-sm' onclick=\"layer.closeAll()\">关闭</button>\
|
||||
<button type='button' class='btn btn-success btn-sm' onclick=\"setPassword(1)\">修改</button>\
|
||||
</div>\
|
||||
</div>"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function randPwd(){
|
||||
var pwd = randomStrPwd(12);
|
||||
$("#p1").val(pwd);
|
||||
$("#p2").val(pwd);
|
||||
layer.msg(lan.bt.pass_rep_ps,{time:2000})
|
||||
}
|
||||
|
||||
function setUserName(a) {
|
||||
if(a == 1) {
|
||||
p1 = $("#p1").val();
|
||||
p2 = $("#p2").val();
|
||||
if(p1 == "" || p1.length < 3) {
|
||||
layer.msg('用户名长度不能少于3位', {icon: 2});
|
||||
return;
|
||||
}
|
||||
if(p1 != p2) {
|
||||
layer.msg('两次输入的用户名不一致', {icon: 2});
|
||||
return;
|
||||
}
|
||||
$.post("/config/set_name", "name1=" + encodeURIComponent(p1) + "&name2=" + encodeURIComponent(p2), function(b) {
|
||||
if(b.status) {
|
||||
layer.closeAll();
|
||||
layer.msg(b.msg, {icon: 1});
|
||||
$("input[name='username_']").val(p1)
|
||||
} else {
|
||||
layer.msg(b.msg, {icon: 2});
|
||||
}
|
||||
},'json');
|
||||
return
|
||||
}
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: "290px",
|
||||
title: '修改面板用户名',
|
||||
closeBtn: 2,
|
||||
shift: 5,
|
||||
shadeClose: false,
|
||||
content: "<div class='bt-form pd20 pb70'>\
|
||||
<div class='line'><span class='tname'>用户名</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='password1' id='p1' value='' placeholder='新的用户名' style='width:100%'/></div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>重复</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='password2' id='p2' value='' placeholder='再输一次' style='width:100%'/></div>\
|
||||
</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button type='button' class='btn btn-danger btn-sm' onclick=\"layer.closeAll()\">关闭</button>\
|
||||
<button type='button' class='btn btn-success btn-sm' onclick=\"setUserName(1)\">修改</button>\
|
||||
</div>\
|
||||
</div>"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
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){
|
||||
var loadT = layer.msg('正在同步时间...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/config/sync_date','',function(rdata){
|
||||
layer.close(loadT);
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
});
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
},1500);
|
||||
},'json');
|
||||
}
|
||||
|
|
@ -119,13 +119,11 @@ function GetToday(){
|
|||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//取监控状态
|
||||
function getStatus(){
|
||||
loadT = layer.msg(lan.public.read,{icon:16,time:0})
|
||||
$.post('/system/set_control','type=-1',function(rdata){
|
||||
console.log(rdata);
|
||||
// console.log(rdata);
|
||||
layer.close(loadT);
|
||||
if(rdata.status){
|
||||
$("#openJK").html("<input class='btswitch btswitch-ios' id='ctswitch' type='checkbox' checked><label class='btswitch-btn' for='ctswitch' onclick='setControl()'></label>")
|
||||
|
|
@ -136,8 +134,7 @@ function getStatus(){
|
|||
$("#saveDay").val(rdata.day)
|
||||
},'json');
|
||||
}
|
||||
|
||||
getStatus()
|
||||
getStatus();
|
||||
|
||||
//设置监控状态
|
||||
function setControl(act){
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ setTimeout(function(){
|
|||
$(function(){
|
||||
// start
|
||||
$.post('/firewall/get_www_path',function(data){
|
||||
var html ='<span>Web日志:</span><a href="javascript:openPath(\''+data['path']+'\');">点击进入日志目录</a>\
|
||||
var html ='<a href="javascript:openPath(\''+data['path']+'\');">日志目录</a>\
|
||||
<em id="logSize">0KB</em>\
|
||||
<button class="btn btn-default btn-sm" onclick="closeLogs();">清空</button>';
|
||||
$('#firewall_weblog').html(html);
|
||||
|
|
|
|||
|
|
@ -87,8 +87,6 @@ function repeatPwd(a) {
|
|||
$("#MyPassword").val(randomStrPwd(a))
|
||||
}
|
||||
|
||||
|
||||
|
||||
function GetBakPost(b) {
|
||||
$(".baktext").hide().prev().show();
|
||||
var c = $(".baktext").attr("data-id");
|
||||
|
|
@ -679,119 +677,7 @@ $("#dologin").click(function() {
|
|||
return false
|
||||
});
|
||||
|
||||
function setPassword(a) {
|
||||
if(a == 1) {
|
||||
p1 = $("#p1").val();
|
||||
p2 = $("#p2").val();
|
||||
if(p1 == "" || p1.length < 8) {
|
||||
layer.msg(lan.bt.pass_err_len, {
|
||||
icon: 2
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
//准备弱口令匹配元素
|
||||
var checks = ['admin888','123123123','12345678','45678910','87654321','asdfghjkl','password','qwerqwer'];
|
||||
pchecks = 'abcdefghijklmnopqrstuvwxyz1234567890';
|
||||
for(var i=0;i<pchecks.length;i++){
|
||||
checks.push(pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]+pchecks[i]);
|
||||
}
|
||||
|
||||
//检查弱口令
|
||||
cps = p1.toLowerCase();
|
||||
var isError = "";
|
||||
for(var i=0;i<checks.length;i++){
|
||||
if(cps == checks[i]){
|
||||
isError += '['+checks[i]+'] ';
|
||||
}
|
||||
}
|
||||
|
||||
if(isError != ""){
|
||||
layer.msg(lan.bt.pass_err+isError,{icon:5});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(p1 != p2) {
|
||||
layer.msg(lan.bt.pass_err_re, {
|
||||
icon: 2
|
||||
});
|
||||
return
|
||||
}
|
||||
$.post("/config?action=setPassword", "password1=" + encodeURIComponent(p1) + "&password2=" + encodeURIComponent(p2), function(b) {
|
||||
if(b.status) {
|
||||
layer.closeAll();
|
||||
layer.msg(b.msg, {
|
||||
icon: 1
|
||||
})
|
||||
} else {
|
||||
layer.msg(b.msg, {
|
||||
icon: 2
|
||||
})
|
||||
}
|
||||
});
|
||||
return
|
||||
}
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: "290px",
|
||||
title: lan.bt.pass_title,
|
||||
closeBtn: 2,
|
||||
shift: 5,
|
||||
shadeClose: false,
|
||||
content: "<div class='bt-form pd20 pb70'><div class='line'><span class='tname'>"+lan.public.pass+"</span><div class='info-r'><input class='bt-input-text' type='text' name='password1' id='p1' value='' placeholder='"+lan.bt.pass_new_title+"' style='width:100%'/></div></div><div class='line'><span class='tname'>"+lan.bt.pass_re+"</span><div class='info-r'><input class='bt-input-text' type='text' name='password2' id='p2' value='' placeholder='"+lan.bt.pass_re_title+"' style='width:100%' /></div></div><div class='bt-form-submit-btn'><span style='float: left;' title='"+lan.bt.pass_rep+"' class='btn btn-default btn-sm' onclick='randPwd(10)'>"+lan.bt.pass_rep_btn+"</span><button type='button' class='btn btn-danger btn-sm' onclick=\"layer.closeAll()\">"+lan.public.close+"</button> <button type='button' class='btn btn-success btn-sm' onclick=\"setPassword(1)\">"+lan.public.edit+"</button></div></div>"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function randPwd(){
|
||||
var pwd = RandomStrPwd(12);
|
||||
$("#p1").val(pwd);
|
||||
$("#p2").val(pwd);
|
||||
layer.msg(lan.bt.pass_rep_ps,{time:2000})
|
||||
}
|
||||
|
||||
function setUserName(a) {
|
||||
if(a == 1) {
|
||||
p1 = $("#p1").val();
|
||||
p2 = $("#p2").val();
|
||||
if(p1 == "" || p1.length < 3) {
|
||||
layer.msg(lan.bt.user_len, {
|
||||
icon: 2
|
||||
});
|
||||
return
|
||||
}
|
||||
if(p1 != p2) {
|
||||
layer.msg(lan.bt.user_err_re, {
|
||||
icon: 2
|
||||
});
|
||||
return
|
||||
}
|
||||
$.post("/config?action=setUsername", "username1=" + encodeURIComponent(p1) + "&username2=" + encodeURIComponent(p2), function(b) {
|
||||
if(b.status) {
|
||||
layer.closeAll();
|
||||
layer.msg(b.msg, {
|
||||
icon: 1
|
||||
});
|
||||
$("input[name='username_']").val(p1)
|
||||
} else {
|
||||
layer.msg(b.msg, {
|
||||
icon: 2
|
||||
})
|
||||
}
|
||||
});
|
||||
return
|
||||
}
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: "290px",
|
||||
title: lan.bt.user_title,
|
||||
closeBtn: 2,
|
||||
shift: 5,
|
||||
shadeClose: false,
|
||||
content: "<div class='bt-form pd20 pb70'><div class='line'><span class='tname'>"+lan.bt.user+"</span><div class='info-r'><input class='bt-input-text' type='text' name='password1' id='p1' value='' placeholder='"+lan.bt.user_new+"' style='width:100%'/></div></div><div class='line'><span class='tname'>"+lan.bt.pass_re+"</span><div class='info-r'><input class='bt-input-text' type='text' name='password2' id='p2' value='' placeholder='"+lan.bt.pass_re_title+"' style='width:100%'/></div></div><div class='bt-form-submit-btn'><button type='button' class='btn btn-danger btn-sm' onclick=\"layer.closeAll()\">"+lan.public.close+"</button> <button type='button' class='btn btn-success btn-sm' onclick=\"setUserName(1)\">"+lan.public.edit+"</button></div></div>"
|
||||
})
|
||||
}
|
||||
var openWindow = null;
|
||||
var downLoad = null;
|
||||
var speed = null;
|
||||
|
|
@ -877,208 +763,6 @@ function setSelectChecked(c, d) {
|
|||
}
|
||||
}
|
||||
getTaskCount();
|
||||
function RecInstall() {
|
||||
$.post("/ajax?action=GetSoftList", "", function(l){
|
||||
var c = "";
|
||||
var g = "";
|
||||
var e = "";
|
||||
for(var h = 0; h < l.length; h++) {
|
||||
if(l[h].name == "Tomcat") {
|
||||
continue
|
||||
}
|
||||
var o = "";
|
||||
var m = "<input id='data_" + l[h].name + "' data-info='" + l[h].name + " " + l[h].versions[0].version + "' type='checkbox' checked>";
|
||||
for(var b = 0; b < l[h].versions.length; b++) {
|
||||
var d = "";
|
||||
if((l[h].name == "PHP" && (l[h].versions[b].version == "5.4" || l[h].versions[b].version == "54")) || (l[h].name == "MySQL" && l[h].versions[b].version == "5.5") || (l[h].name == "phpMyAdmin" && l[h].versions[b].version == "4.4")) {
|
||||
d = "selected";
|
||||
m = "<input id='data_" + l[h].name + "' data-info='" + l[h].name + " " + l[h].versions[b].version + "' type='checkbox' checked>"
|
||||
}
|
||||
o += "<option value='" + l[h].versions[b].version + "' " + d + ">" + l[h].name + " " + l[h].versions[b].version + "</option>"
|
||||
}
|
||||
var f = "<li><span class='ico'><img src='/static/img/" + l[h].name.toLowerCase() + ".png'></span><span class='name'><select id='select_" + l[h].name + "' class='sl-s-info'>" + o + "</select></span><span class='pull-right'>" + m + "</span></li>";
|
||||
if(l[h].name == "Nginx") {
|
||||
c = f
|
||||
} else {
|
||||
if(l[h].name == "Apache") {
|
||||
g = f
|
||||
} else {
|
||||
e += f
|
||||
}
|
||||
}
|
||||
}
|
||||
c += e;
|
||||
g += e;
|
||||
g = g.replace(new RegExp(/(data_)/g), "apache_").replace(new RegExp(/(select_)/g), "apache_select_");
|
||||
var k = layer.open({
|
||||
type: 1,
|
||||
title: lan.bt.install_title,
|
||||
area: ["658px", "423px"],
|
||||
closeBtn: 2,
|
||||
shadeClose: false,
|
||||
content: "<div class='rec-install'><div class='important-title'><p><span class='glyphicon glyphicon-alert' style='color: #f39c12; margin-right: 10px;'></span>"+lan.bt.install_ps+" <a href='javascript:jump()' style='color:#20a53a'>"+lan.bt.install_s+"</a> "+lan.bt.install_s1+"</p></div><div class='rec-box'><h3>"+lan.bt.install_lnmp+"</h3><div class='rec-box-con'><ul class='rec-list'>" + c + "</ul><p class='fangshi'>"+lan.bt.install_type+":<label data-title='"+lan.bt.install_rpm_title+"' style='margin-right:0'>"+lan.bt.install_rpm+"<input type='checkbox' checked></label><label data-title='"+lan.bt.install_src_title+"'>"+lan.bt.install_src+"<input type='checkbox'></label></p><div class='onekey'>"+lan.bt.install_key+"</div></div></div><div class='rec-box' style='margin-left:16px'><h3>LAMP</h3><div class='rec-box-con'><ul class='rec-list'>" + g + "</ul><p class='fangshi'>"+lan.bt.install_type+":<label data-title='"+lan.bt.install_rpm_title+"' style='margin-right:0'>"+lan.bt.install_rpm+"<input type='checkbox' checked></label><label data-title='"+lan.bt.install_src_title+"'>"+lan.bt.install_src+"<input type='checkbox'></label></p><div class='onekey'>一键安装</div></div></div></div>"
|
||||
});
|
||||
$(".fangshi input").click(function() {
|
||||
$(this).attr("checked", "checked").parent().siblings().find("input").removeAttr("checked")
|
||||
});
|
||||
$(".sl-s-info").change(function() {
|
||||
var p = $(this).find("option:selected").text();
|
||||
var n = $(this).attr("id");
|
||||
p = p.toLowerCase();
|
||||
$(this).parents("li").find("input").attr("data-info", p)
|
||||
});
|
||||
$("#apache_select_PHP").change(function() {
|
||||
var n = $(this).val();
|
||||
j(n, "apache_select_", "apache_")
|
||||
});
|
||||
$("#select_PHP").change(function() {
|
||||
var n = $(this).val();
|
||||
j(n, "select_", "data_")
|
||||
});
|
||||
|
||||
function j(p, r, q) {
|
||||
var n = "4.4";
|
||||
switch(p) {
|
||||
case "5.2":
|
||||
n = "4.0";
|
||||
break;
|
||||
case "5.3":
|
||||
n = "4.0";
|
||||
break;
|
||||
case "5.4":
|
||||
n = "4.4";
|
||||
break;
|
||||
case "5.5":
|
||||
n = "4.4";
|
||||
break;
|
||||
default:
|
||||
n = "4.7"
|
||||
}
|
||||
$("#" + r + "phpMyAdmin option[value='" + n + "']").attr("selected", "selected").siblings().removeAttr("selected");
|
||||
$("#" + r + "_phpMyAdmin").attr("data-info", "phpmyadmin " + n)
|
||||
}
|
||||
$("#select_MySQL,#apache_select_MySQL").change(function() {
|
||||
var n = $(this).val();
|
||||
a(n)
|
||||
});
|
||||
|
||||
$("#apache_select_Apache").change(function(){
|
||||
var apacheVersion = $(this).val();
|
||||
if(apacheVersion == '2.2'){
|
||||
layer.msg(lan.bt.install_apache22);
|
||||
}else{
|
||||
layer.msg(lan.bt.install_apache24);
|
||||
}
|
||||
});
|
||||
|
||||
$("#apache_select_PHP").change(function(){
|
||||
var apacheVersion = $("#apache_select_Apache").val();
|
||||
var phpVersion = $(this).val();
|
||||
if(apacheVersion == '2.2'){
|
||||
if(phpVersion != '5.2' && phpVersion != '5.3' && phpVersion != '5.4'){
|
||||
layer.msg(lan.bt.insatll_s22+'PHP-' + phpVersion,{icon:5});
|
||||
$(this).val("5.4");
|
||||
$("#apache_PHP").attr('data-info','php 5.4');
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
if(phpVersion == '5.2'){
|
||||
layer.msg(lan.bt.insatll_s24+'PHP-' + phpVersion,{icon:5});
|
||||
$(this).val("5.4");
|
||||
$("#apache_PHP").attr('data-info','php 5.4');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function a(n) {
|
||||
memSize = getCookie("memSize");
|
||||
max = 64;
|
||||
msg = "64M";
|
||||
switch(n) {
|
||||
case "5.1":
|
||||
max = 256;
|
||||
msg = "256M";
|
||||
break;
|
||||
case "5.7":
|
||||
max = 1500;
|
||||
msg = "2GB";
|
||||
break;
|
||||
case "5.6":
|
||||
max = 800;
|
||||
msg = "1GB";
|
||||
break;
|
||||
case "AliSQL":
|
||||
max = 800;
|
||||
msg = "1GB";
|
||||
break;
|
||||
case "mariadb_10.0":
|
||||
max = 800;
|
||||
msg = "1GB";
|
||||
break;
|
||||
case "mariadb_10.1":
|
||||
max = 1500;
|
||||
msg = "2GB";
|
||||
break
|
||||
}
|
||||
if(memSize < max) {
|
||||
layer.msg( lan.bt.insatll_mem.replace("{1}",msg).replace("{2}",n), {
|
||||
icon: 5
|
||||
})
|
||||
}
|
||||
}
|
||||
var de = null;
|
||||
$(".onekey").click(function() {
|
||||
if(de) return;
|
||||
var v = $(this).prev().find("input").eq(0).prop("checked") ? "1" : "0";
|
||||
var r = $(this).parents(".rec-box-con").find(".rec-list li").length;
|
||||
var n = "";
|
||||
var q = "";
|
||||
var p = "";
|
||||
var x = "";
|
||||
var s = "";
|
||||
de = true;
|
||||
for(var t = 0; t < r; t++) {
|
||||
var w = $(this).parents(".rec-box-con").find("ul li").eq(t);
|
||||
var u = w.find("input");
|
||||
if(u.prop("checked")) {
|
||||
n += u.attr("data-info") + ","
|
||||
}
|
||||
}
|
||||
q = n.split(",");
|
||||
loadT = layer.msg(lan.bt.install_to, {
|
||||
icon: 16,
|
||||
time: 0,
|
||||
shade: [0.3, "#000"]
|
||||
});
|
||||
for(var t = 0; t < q.length - 1; t++) {
|
||||
p = q[t].split(" ")[0].toLowerCase();
|
||||
x = q[t].split(" ")[1];
|
||||
s = "name=" + p + "&version=" + x + "&type=" + v + "&id=" + (t + 1);
|
||||
$.ajax({
|
||||
url: "/files?action=InstallSoft",
|
||||
data: s,
|
||||
type: "POST",
|
||||
async: false,
|
||||
success: function(y) {}
|
||||
});
|
||||
}
|
||||
layer.close(loadT);
|
||||
layer.close(k);
|
||||
setTimeout(function() {
|
||||
getTaskCount()
|
||||
}, 2000);
|
||||
layer.msg(lan.bt.install_ok, {
|
||||
icon: 1
|
||||
});
|
||||
setTimeout(function() {
|
||||
task()
|
||||
}, 1000)
|
||||
});
|
||||
InstallTips();
|
||||
fly("onekey")
|
||||
})
|
||||
}
|
||||
|
||||
function jump() {
|
||||
layer.closeAll();
|
||||
|
|
@ -1358,7 +1042,7 @@ function remind(a){
|
|||
}
|
||||
|
||||
|
||||
function GetReloads() {
|
||||
function getReloads() {
|
||||
var a = 0;
|
||||
var mm = $(".bt-w-menu .bgw").html()
|
||||
if(mm == undefined || mm.indexOf(lan.bt.task_list) == -1) {
|
||||
|
|
@ -1477,8 +1161,6 @@ function check_login(){
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//登陆跳转
|
||||
function to_login(){
|
||||
layer.confirm('您的登陆状态已过期,请重新登陆!',{title:'会话已过期',icon:2,closeBtn: 1,shift: 5},function(){
|
||||
|
|
@ -1502,7 +1184,6 @@ $(function(){
|
|||
},60000);
|
||||
});
|
||||
|
||||
|
||||
function asyncLoadImage(obj, url){
|
||||
|
||||
if (typeof(url) == 'undefined'){
|
||||
|
|
|
|||
|
|
@ -22,27 +22,38 @@
|
|||
<div class="setbox bgw mtb15">
|
||||
<div class="title c6 plr15">
|
||||
<h3 class="f16">设置</h3>
|
||||
|
||||
</div>
|
||||
<div class="info-title-tips" style="margin: 20px 30px 0px;">
|
||||
<p><span class="glyphicon glyphicon-alert" style="color: #f39c12; margin-right: 10px;"></span>为了提高安全,请修改别名、默认端口、面板用户和密码!</p>
|
||||
<p>
|
||||
<span class="glyphicon glyphicon-alert" style="color: #f39c12; margin-right: 10px;">
|
||||
</span>为了提高安全,请修改别名、默认端口、面板用户和密码!</p>
|
||||
</div>
|
||||
<div class="setting-con pd15">
|
||||
<form id="set-Config">
|
||||
<form id="set_config">
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="别名">别名</span>
|
||||
<span class="set-tit text-right">别名</span>
|
||||
<input id="webname" name="webname" class="inputtxt bt-input-text" type="text" value="MDWEB面板" ><span class="set-info c7">MDWEB面板</span>
|
||||
</p>
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="面板端口">面板端口</span>
|
||||
<input id="banport" name="port" class="inputtxt bt-input-text" type="numner" value="{{data['port']}}" maxlength="5"><span class="set-info c7">建议端口范围8888 - 65535</span>
|
||||
<span class="set-tit text-right">面板端口</span>
|
||||
<input id="banport" name="port" class="inputtxt bt-input-text" type="numner" value="{{data['port']}}" maxlength="5"><span class="set-info c7">建议端口范围7200 - 65535</span>
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right">安全入口</span>
|
||||
<input id="admin_path" name="admin_path" class="inputtxt bt-input-text disable" type="text" value="/"><span class="modify btn btn-xs btn-success" onclick="">修改</span>
|
||||
<span class="set-info c7">面板管理入口,设置后只能通过指定安全入口登录面板,如: /abc</span>
|
||||
</p>
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="域名">域名</span>
|
||||
<span class="set-tit text-right">域名</span>
|
||||
<input name="domain" class="inputtxt bt-input-text" type="text" value="">
|
||||
<span class="set-info c7">为面板绑定一个访问域名;注意:一旦绑定域名,只能通过域名访问面板!</span>
|
||||
</p>
|
||||
<p class="mtb15"><span class="set-tit text-right" title="授权IP">授权IP</span><input name="limitip" class="inputtxt bt-input-text" type="text" value=""><span class="set-info c7">设置访问授权IP,多个请使用逗号(,)隔开;注意:一旦设置授权IP,只有指定IP的电脑能访问面板!</span></p>
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="授权IP">授权IP</span>
|
||||
<input name="limitip" class="inputtxt bt-input-text" type="text" value="">
|
||||
<span class="set-info c7">设置访问授权IP,多个请使用逗号(,)隔开;注意:一旦设置授权IP,只有指定IP的电脑能访问面板!</span>
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="默认建站目录">默认建站目录</span>
|
||||
|
|
@ -61,14 +72,14 @@
|
|||
<input name="backup_path" class="inputtxt bt-input-text" type="text" value="{{data['ip']}}">
|
||||
<span class="set-info c7">默认为外网IP,若您在本地虚拟机测试,请填写虚拟机内网IP!</span>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="服务器时间">服务器时间</span>
|
||||
<input id="systemdate" name="systemdate" class="inputtxt bt-input-text disable" type="text" value="{{data['systemdate']}}"><span class="modify btn btn-xs btn-success" onclick="syncDate()">同步</span>
|
||||
</p>
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="面板用户">面板用户</span>
|
||||
<input name="username_" class="inputtxt bt-input-text disable" type="text" value="" disabled><span class="modify btn btn-xs btn-success" onclick="setUserName()">修改</span>
|
||||
<input name="username_" class="inputtxt bt-input-text disable" type="text" value="{{data['username']}}" disabled><span class="modify btn btn-xs btn-success" onclick="setUserName()">修改</span>
|
||||
</p>
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="面板密码">面板密码</span>
|
||||
|
|
@ -81,126 +92,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.boxConter{
|
||||
height: 458px;
|
||||
position: relative;
|
||||
overflow:auto;
|
||||
}
|
||||
.iconCode{
|
||||
padding: 50px 60px;
|
||||
}
|
||||
.box-conter{
|
||||
width: 100%;
|
||||
}
|
||||
#QRcode{
|
||||
margin-bottom: 25px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.iconCode #QRcode,
|
||||
.iconCode .codeTip{
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
}
|
||||
.iconCode .weChatSamll img{
|
||||
width: 100%;
|
||||
}
|
||||
.iconCode .weChatSamll{
|
||||
display: none;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
position: absolute;
|
||||
border: 1px solid #ececec;
|
||||
border-radius: 5px;
|
||||
bottom: 150px;
|
||||
right: 50px;
|
||||
padding: 20px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.iconCode .weChatSamll:after{
|
||||
content: '';
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background: #ffffff;
|
||||
border-bottom: 1px solid #ececec;
|
||||
border-right: 1px solid #ececec;
|
||||
transform: rotate(45deg);
|
||||
position: absolute;
|
||||
border-radius: 4px;
|
||||
left: 90px;
|
||||
bottom: -8px;
|
||||
}
|
||||
|
||||
.iconCode .weChat{
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.iconCode .weChat:hover .weChatSamll{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.iconCode .QRcode{
|
||||
margin-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.codeTip ul li{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.personalDetails .head_img{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
float: left;
|
||||
margin-right: 30px;
|
||||
}
|
||||
.personalDetails .head_img img{
|
||||
height: 100%;
|
||||
border-radius:50%;
|
||||
}
|
||||
.personalDetails .nick_name{
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
width: 148px;
|
||||
float: left;
|
||||
font-size: 15px;
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
.personalDetails .userList{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.personalDetails .userList .addweChat{
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
color: #20a53a;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.personalDetails .userList .addweChat:hover{
|
||||
|
||||
}
|
||||
|
||||
.personalDetails .userList .item{
|
||||
height: 70px;
|
||||
padding: 10px 15px;
|
||||
border: 1px solid #ececec;
|
||||
margin: 15px 65px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.personalDetails .userList .cancelBind{
|
||||
height: 50px;
|
||||
width: 60px;
|
||||
float: right;
|
||||
line-height: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<script src="/static/app/config.js?v={{config.version}}"></script>
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@
|
|||
<h3 class="f16">防火墙</h3>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="divtable pd15">
|
||||
<div class="firewall-port-box">
|
||||
<select id="firewalldType" class="bt-input-text c5 mr5" name="type" style="width:80px;">
|
||||
|
|
|
|||
Loading…
Reference in New Issue