mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-24 11:09:16 +08:00
fix: 解决禁 ping 状态获取失败的问题 (#557)
This commit is contained in:
parent
8603d4347b
commit
4a4c2b24dd
@ -43,7 +43,7 @@ func (f *Firewall) Start() error {
|
||||
}
|
||||
|
||||
func (f *Firewall) PingStatus() (string, error) {
|
||||
stdout, _ := cmd.Exec("firewall-cmd --query-rich-rule='rule protocol value=icmp drop'")
|
||||
stdout, _ := cmd.Exec("firewall-cmd --zone=public --query-rich-rule='rule protocol value=icmp drop'")
|
||||
if stdout == "yes\n" {
|
||||
return constant.StatusEnable, nil
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ import { ref } from 'vue';
|
||||
|
||||
const baseInfo = ref<Host.FirewallBase>({ status: '', name: '', version: '', pingStatus: '' });
|
||||
const onPing = ref('Disable');
|
||||
const oldStatus = ref();
|
||||
|
||||
const acceptParams = (): void => {
|
||||
loadBaseInfo(true);
|
||||
@ -58,6 +59,7 @@ const loadBaseInfo = async (search: boolean) => {
|
||||
.then((res) => {
|
||||
baseInfo.value = res.data;
|
||||
onPing.value = baseInfo.value.pingStatus;
|
||||
oldStatus.value = onPing.value;
|
||||
emit('update:name', baseInfo.value.name);
|
||||
emit('update:status', baseInfo.value.status);
|
||||
if (search) {
|
||||
@ -118,8 +120,7 @@ const onPingOperate = async (operation: string) => {
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
emit('update:loading', true);
|
||||
loadBaseInfo(false);
|
||||
onPing.value = oldStatus.value;
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user