This commit is contained in:
cdle
2023-07-05 17:19:56 +08:00
parent 873bccce55
commit 643ecd0f9c
21 changed files with 573 additions and 81 deletions
+36
View File
@@ -319,6 +319,7 @@ type CarryGroup struct {
// CARRY API
func init() {
GinApi(GET, "/api/carry/groups", RequireAuth, func(ctx *gin.Context) {
current := utils.Int(ctx.Query("current"))
pageSize := utils.Int(ctx.Query("pageSize"))
@@ -364,6 +365,41 @@ func init() {
"data": names,
})
})
GinApi(GET, "/api/proxy/scripts", RequireAuth, func(ctx *gin.Context) {
var scripts = map[string]string{}
functions := Functions
for _, function := range functions {
if function.UUID != "" {
scripts[function.UUID] = function.Title + ".js"
}
}
ctx.JSON(200, map[string]interface{}{
"success": true,
"data": scripts,
})
})
var isNumeric = func(keyword string) bool {
for _, c := range keyword {
if c != '.' && (c < '0' || c > '9') {
return false
}
}
return true
}
GinApi(GET, "/api/proxy/rules", RequireAuth, func(ctx *gin.Context) {
keyword := ctx.Query("keyword")
var scripts = map[string]string{}
scripts[keyword] = keyword
if strings.HasSuffix(keyword, ".") && !isNumeric(keyword) {
for _, suffix := range []string{"com", "cn"} {
scripts[keyword+suffix] = keyword + suffix
}
}
ctx.JSON(200, map[string]interface{}{
"success": true,
"data": scripts,
})
})
GinApi(GET, "/api/carry/group_selects", RequireAuth, func(ctx *gin.Context) {
chat_id := ctx.Query("chat_id")
platform := ctx.Query("platform")