This commit is contained in:
midoks 2022-09-19 15:01:17 +08:00
parent 6c0cb42e35
commit b7a3c32d3f
2 changed files with 44 additions and 3 deletions

View File

@ -430,8 +430,49 @@ var mail = {
$('#checkPostEnv tbody').append($(`<tr><td>`+_this.post_env_text[index] +`</td><td title="`+res[item].msg+`" class="${(res[item].status?"green":"red")}">${(res[item].status?"就绪":(res[item].msg !=''?(res[item].msg.toString().length>30?res[item].msg.toString().substring(0,30)+'...':res[item].msg.toString()):"异常"))}</td><td>${(res[item].status?"无操作":"<a href='javascript:;' class='btlink set_mail_key' data-keys= "+ item+" >修复</a>")}</td></tr>`))
}
$('#checkPostEnv .divtable').removeClass('mtb10');
callback && callback();
});
});
$('#checkPostEnv').unbind().on('click','a',function(){
var key = $(this).attr('data-keys');
var confirmA = layer.confirm('是否修复邮局环境?', {
title: '修复邮局环境',
icon: 3,
closeBtn:2,
btn: ['确定', '取消'],
},function(index, layero){
_this.repair_mail_env(key);
});
})
if(callback) callback()
},
//修复邮局环境
repair_mail_env: function (key) {
var _this = this,_key;
switch(key) {
case 'Postfix-Version':
case 'Postfix-install':
case 'Sqlite-support':
_key = 'repair_postfix';
break;
case 'Rspamd-install':
_key = 'install_rspamd';
break;
case 'Dovecot-install':
_key = 'repair_dovecot';
break;
}
console.log(key,_key);
this.send({
tips: '正在修复' + key + ',请稍候...',
method: _key,
success: function (res) {
layer.msg(res.msg, { icon: res.status?1:2 });
_this.create_post_env_table();
}
})
},

View File

@ -29,7 +29,7 @@ class mail_init:
'/usr/sbin/dovecot') else {"status": False, "msg": "Dovecot未安装,请点击修复按钮"}
data['Postfix-Version'] = self.check_postfix_ver()
data['Redis-install'] = {"status": True, "msg": "Redis已经安装"} if os.path.exists(
'/www/server/redis/src/redis-server') else {"status": False, "msg": "请到软件商店内安装Redis"}
mw.getServerDir() + '/redis/bin/redis-server') else {"status": False, "msg": "请到软件商店内安装Redis"}
data['Redis-Passwd'] = self.check_redis_passwd(data['Redis-install'])
data['Rspamd-install'] = {"status": True, "msg": "Rspamd已经安装"} if os.path.exists(
'/usr/bin/rspamd') else {"status": False, "msg": "Rspamd未安装,请点击修复按钮"}
@ -57,7 +57,7 @@ class mail_init:
return mw.returnData(False, "当前版本不支持或Postfix没有安装成功{}".format(postfix_version))
def check_redis_passwd(self, redis_install):
redis_conf = mw.readFile('/www/server/redis/redis.conf')
redis_conf = mw.readFile(mw.getServerDir() + '/redis/redis.conf')
if redis_install['status']:
if re.search('\n\s*requirepass', redis_conf):
return mw.returnData(True, "Redis已经设置密码")