mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -170,6 +170,45 @@ class config_api:
|
||||
mw.setBackupDir(backup_path)
|
||||
return mw.returnJson(True, '修改默认备份目录成功!')
|
||||
|
||||
def setBasicAuthApi(self):
|
||||
basic_user = request.form.get('basic_user', '').strip()
|
||||
basic_pwd = request.form.get('basic_pwd', '').strip()
|
||||
basic_open = request.form.get('is_open', '').strip()
|
||||
|
||||
salt = '_md_salt'
|
||||
path = 'config/basic_auth.json'
|
||||
|
||||
is_open = False
|
||||
if basic_open == 'True':
|
||||
is_open = True
|
||||
|
||||
if basic_user == '' or basic_pwd == '':
|
||||
return mw.returnJson(True, '用户和密码不能为空!')
|
||||
|
||||
ba_conf = None
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
ba_conf = json.loads(public.readFile(path))
|
||||
except:
|
||||
os.remove(path)
|
||||
|
||||
if not ba_conf:
|
||||
ba_conf = {
|
||||
"basic_user": mw.md5(basic_user + salt),
|
||||
"basic_pwd": mw.md5(basic_pwd + salt),
|
||||
"open": is_open
|
||||
}
|
||||
else:
|
||||
ba_conf['basic_user'] = mw.md5(basic_user + salt)
|
||||
ba_conf['basic_pwd'] = mw.md5(basic_pwd + salt)
|
||||
ba_conf['open'] = is_open
|
||||
|
||||
mw.writeFile(path, json.dumps(ba_conf))
|
||||
os.chmod(path, 384)
|
||||
mw.writeLog('面板设置', '设置BasicAuth状态为: %s' % is_open)
|
||||
mw.writeFile('data/reload.pl', 'True')
|
||||
return mw.returnJson(True, '设置成功!')
|
||||
|
||||
def setApi(self):
|
||||
webname = request.form.get('webname', '')
|
||||
port = request.form.get('port', '')
|
||||
|
||||
@@ -71,6 +71,11 @@ cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d ${serverPath}/php-apt/${type} ];then
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-apt/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-apt/index.py restart ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-apt/index.py initd_install ${type}
|
||||
|
||||
# 安装通用扩展
|
||||
echo "install PHP-APT[${type}] extend start"
|
||||
cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${type:0:1}.${type:1:2} install gd
|
||||
@@ -83,11 +88,6 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php-apt/${type} ];then
|
||||
cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${type:0:1}.${type:1:2} install redis
|
||||
cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${type:0:1}.${type:1:2} install memcached
|
||||
echo "install PHP-APT[${type}] extend end"
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-apt/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-apt/index.py restart ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-apt/index.py initd_install ${type}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -61,6 +61,11 @@ fi
|
||||
cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d ${serverPath}/php-yum/${type} ];then
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-yum/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-yum/index.py initd_install ${type}
|
||||
|
||||
# 安装通用扩展
|
||||
echo "install PHP-YUM[${type}] extend start"
|
||||
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install gd
|
||||
@@ -73,10 +78,6 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php-yum/${type} ];then
|
||||
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install redis
|
||||
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install memcached
|
||||
echo "install PHP-YUM[${type}] extend end"
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-yum/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-yum/index.py initd_install ${type}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d ${serverPath}/php/${type} ];then
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_install ${type}
|
||||
|
||||
# 安装通用扩展
|
||||
echo "install PHP${type} extend start"
|
||||
cd ${rootPath}/plugins/php/versions/common && bash gd.sh install ${type}
|
||||
@@ -62,10 +66,6 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php/${type} ];then
|
||||
cd ${rootPath}/plugins/php/versions/common && bash redis.sh install ${type}
|
||||
cd ${rootPath}/plugins/php/versions/common && bash memcached.sh install ${type}
|
||||
echo "install PHP${type} extend end"
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_install ${type}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user