1
0
mirror of https://github.com/bestnite/sub2clash.git synced 2025-12-15 18:40:16 +00:00

feat: Web UI

update: 校验Rule-Provider是否有重名
modify: 修改meta默认模板
modify: 根据Clash筛选返回配置中的节点类型
This commit is contained in:
2023-09-16 21:46:59 +08:00
parent 918521682c
commit d38d5bcb70
6 changed files with 313 additions and 8 deletions

View File

@@ -1,13 +1,25 @@
package api
import (
"embed"
"github.com/gin-gonic/gin"
"html/template"
"sub2clash/api/controller"
"sub2clash/middleware"
)
//go:embed templates/*
var templates embed.FS
func SetRoute(r *gin.Engine) {
r.Use(middleware.ZapLogger())
// 使用内嵌的模板文件
r.SetHTMLTemplate(template.Must(template.New("").ParseFS(templates, "templates/*")))
r.GET(
"/", func(c *gin.Context) {
c.HTML(200, "index.html", nil)
},
)
r.GET(
"/clash", func(c *gin.Context) {
controller.SubmodHandler(c)