🎨几乎全部完成
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"wireguard-ui/http/response"
|
||||
"wireguard-ui/http/vo"
|
||||
"wireguard-ui/model"
|
||||
"wireguard-ui/script"
|
||||
"wireguard-ui/service"
|
||||
"wireguard-ui/utils"
|
||||
)
|
||||
@@ -44,7 +45,12 @@ func (ClientApi) Save(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
component.Wireguard().ServerControl("E:\\Workspace\\Go\\wireguard-ui\\template\\tmp\\wg0.conf")
|
||||
go func() {
|
||||
if err := script.New().GenerateConfig(); err != nil {
|
||||
log.Errorf("执行脚本失败")
|
||||
}
|
||||
}()
|
||||
|
||||
response.R(c).OK()
|
||||
}
|
||||
|
||||
@@ -64,7 +70,12 @@ func (ClientApi) Delete(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
component.Wireguard().ServerControl("E:\\Workspace\\Go\\wireguard-ui\\template\\tmp\\wg0.conf")
|
||||
go func() {
|
||||
if err := script.New().GenerateConfig(); err != nil {
|
||||
log.Errorf("执行脚本失败")
|
||||
}
|
||||
}()
|
||||
|
||||
response.R(c).OK()
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,13 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"gitee.ltd/lxh/logger/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
"slices"
|
||||
"wireguard-ui/http/param"
|
||||
"wireguard-ui/http/response"
|
||||
"wireguard-ui/model"
|
||||
"wireguard-ui/script"
|
||||
"wireguard-ui/service"
|
||||
"wireguard-ui/utils"
|
||||
)
|
||||
@@ -35,6 +38,15 @@ func (setting) Set(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var whiteCodes = []string{"WG_SETTING", "WG_SERVER"}
|
||||
if slices.Contains(whiteCodes, p.Code) {
|
||||
go func() {
|
||||
if err := script.New().GenerateConfig(); err != nil {
|
||||
log.Errorf("执行脚本失败")
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
response.R(c).OK()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user