mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 07:57:21 +08:00
fix: cli下修改端口后自动放行
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user