mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 09:13:49 +08:00
feat: 修改面板端口自动放行
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/TheTNB/panel/internal/app"
|
||||
"github.com/TheTNB/panel/internal/biz"
|
||||
"github.com/TheTNB/panel/internal/http/request"
|
||||
"github.com/TheTNB/panel/pkg/firewall"
|
||||
"github.com/TheTNB/panel/pkg/io"
|
||||
"github.com/TheTNB/panel/pkg/shell"
|
||||
"github.com/TheTNB/panel/pkg/tools"
|
||||
@@ -201,6 +202,16 @@ func (r *settingRepo) UpdatePanelSetting(ctx context.Context, setting *request.P
|
||||
config.HTTP.Entrance = setting.Entrance
|
||||
config.HTTP.TLS = setting.HTTPS
|
||||
|
||||
// 放行端口
|
||||
fw := firewall.NewFirewall()
|
||||
err = fw.Port(firewall.FireInfo{
|
||||
Port: uint(config.HTTP.Port),
|
||||
Protocol: "tcp",
|
||||
}, firewall.OperationAdd)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
encoded, err := yaml.MarshalWithOptions(config, yaml.WithComment(cm))
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
||||
@@ -16,7 +16,7 @@ func NewExists(db *gorm.DB) *Exists {
|
||||
return &Exists{DB: db}
|
||||
}
|
||||
|
||||
// Exists 格式 `exists=categories,id,other_field`
|
||||
// Exists 格式 `exists=categories id other_field`
|
||||
func (r *Exists) Exists(fl validator.FieldLevel) bool {
|
||||
requestValue := fl.Field().Interface()
|
||||
params := strings.Fields(fl.Param())
|
||||
|
||||
@@ -16,7 +16,7 @@ func NewNotExists(db *gorm.DB) *NotExists {
|
||||
return &NotExists{DB: db}
|
||||
}
|
||||
|
||||
// NotExists 格式 `not_exists=categories,id,other_field`
|
||||
// NotExists 格式 `not_exists=categories id other_field`
|
||||
func (r *NotExists) NotExists(fl validator.FieldLevel) bool {
|
||||
requestValue := fl.Field().Interface()
|
||||
params := strings.Fields(fl.Param())
|
||||
|
||||
Reference in New Issue
Block a user