2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 07:57:21 +08:00

fix: cli下修改端口后自动放行

This commit is contained in:
耗子
2024-11-11 14:13:18 +08:00
parent 34300431a4
commit 5606d980be
2 changed files with 15 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ import (
"github.com/TheTNB/panel/internal/http/request"
"github.com/TheTNB/panel/pkg/api"
"github.com/TheTNB/panel/pkg/cert"
"github.com/TheTNB/panel/pkg/firewall"
"github.com/TheTNB/panel/pkg/io"
"github.com/TheTNB/panel/pkg/ntp"
"github.com/TheTNB/panel/pkg/systemctl"
@@ -390,6 +391,19 @@ func (s *CliService) Port(ctx context.Context, cmd *cli.Command) error {
return err
}
// 放行端口
fw := firewall.NewFirewall()
err = fw.Port(firewall.FireInfo{
Type: firewall.TypeNormal,
PortStart: uint(config.HTTP.Port),
PortEnd: uint(config.HTTP.Port),
Direction: firewall.DirectionIn,
Strategy: firewall.StrategyAccept,
}, firewall.OperationAdd)
if err != nil {
return err
}
if err = io.Write("/usr/local/etc/panel/config.yml", string(encoded), 0700); err != nil {
return err
}

View File

@@ -151,7 +151,7 @@ func (r *Redis) Data(page, pageSize int) ([]RedisKV, error) {
continue
}
if kv.Length > 500 {
value = fmt.Sprintf("data is too long, can't display")
value = "data is too long, can't display"
}
if str, ok := value.(string); ok {