mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-10-26 09:11:01 +00:00
Refactor(frontend): Refactor frontend using Lit
Refactor(database): use gorm+sqlite instead of bbolt Feat: Add delete short link functionality Fix: Load correct configuration template during meta config conversion
This commit is contained in:
@@ -6,19 +6,27 @@ import (
|
||||
|
||||
"github.com/bestnite/sub2clash/common"
|
||||
"github.com/bestnite/sub2clash/config"
|
||||
"github.com/bestnite/sub2clash/model"
|
||||
M "github.com/bestnite/sub2clash/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
func ConvertHandler(template string) func(c *gin.Context) {
|
||||
func ConvertHandler() func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
query, err := M.ParseConvertQuery(c)
|
||||
if err != nil {
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
template := ""
|
||||
switch query.ClashType {
|
||||
case model.Clash:
|
||||
template = config.GlobalConfig.ClashTemplate
|
||||
case model.ClashMeta:
|
||||
template = config.GlobalConfig.MetaTemplate
|
||||
}
|
||||
sub, err := common.BuildSub(query.ClashType, query, template, config.GlobalConfig.CacheExpire, config.GlobalConfig.RequestRetryTimes)
|
||||
if err != nil {
|
||||
c.String(http.StatusInternalServerError, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user