1
0
mirror of https://github.com/bestnite/sub2clash.git synced 2026-04-26 12:51:52 +00:00

refactor: preserve template yaml structure

This commit is contained in:
2026-04-25 23:22:36 +10:00
parent 2d863752b1
commit 9d23b11751
12 changed files with 1395 additions and 472 deletions
+1 -3
View File
@@ -41,9 +41,7 @@ func ConvertHandler() func(c *gin.Context) {
}
if query.NodeListMode {
nodelist := M.NodeList{}
nodelist.Proxy = sub.Proxy
marshal, err := yaml.Marshal(nodelist)
marshal, err := sub.MarshalNodeListYAML()
if err != nil {
c.String(http.StatusInternalServerError, "YAML序列化失败: "+err.Error())
return
+2 -5
View File
@@ -12,10 +12,9 @@ import (
"github.com/bestnite/sub2clash/common/database"
"github.com/bestnite/sub2clash/config"
"github.com/bestnite/sub2clash/model"
M "github.com/bestnite/sub2clash/model"
"gopkg.in/yaml.v3"
"github.com/gin-gonic/gin"
"gopkg.in/yaml.v3"
)
type shortLinkGenRequset struct {
@@ -191,9 +190,7 @@ func GetRawConfHandler(c *gin.Context) {
}
if shortLink.Config.NodeListMode {
nodelist := M.NodeList{}
nodelist.Proxy = sub.Proxy
marshal, err := yaml.Marshal(nodelist)
marshal, err := sub.MarshalNodeListYAML()
if err != nil {
c.String(http.StatusInternalServerError, "YAML序列化失败: "+err.Error())
return