This commit is contained in:
cdle
2023-06-12 13:55:24 +08:00
parent 5b313d8ad9
commit 024adc8835
9 changed files with 195 additions and 164 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/admin/umi.c11a7664.js"></script> <script src="/admin/umi.2d4c6500.js"></script>
</body></html> </body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -16,7 +16,7 @@ func getPaterner(uuid, path string) {
} }
if address != "" { if address != "" {
for _, f := range ls { for _, f := range ls {
if f.Address == address && f.Title == path { if f.Address == address && (f.Title == path || f.UUID == path) {
data = plugins.GetBytes(f.UUID) data = plugins.GetBytes(f.UUID)
if data != nil { if data != nil {
return return
@@ -25,7 +25,7 @@ func getPaterner(uuid, path string) {
} }
if data == nil { if data == nil {
for _, l := range ls { for _, l := range ls {
if l.Address == address && l.Title == path { if l.Address == address && (l.Title == path || l.UUID == path) {
data = fetchScript(l.Address, l.UUID) data = fetchScript(l.Address, l.UUID)
if data == nil { if data == nil {
console.Warn("无法从订阅源获取 %s 的协作脚本 %s ", GetScriptNameByUUID(uuid), path) console.Warn("无法从订阅源获取 %s 的协作脚本 %s ", GetScriptNameByUUID(uuid), path)
+36 -5
View File
@@ -21,6 +21,8 @@ type RequestPluginResult struct {
Data []*common.Function `json:"data"` Data []*common.Function `json:"data"`
Page int `json:"page"` Page int `json:"page"`
Total int `json:"total"` Total int `json:"total"`
Tab1 int `json:"tab1"`
Tab2 int `json:"tab2"`
Time time.Time `json:"time"` Time time.Time `json:"time"`
} }
@@ -115,8 +117,9 @@ func initWebPluginList() {
GinApi(GET, "/api/plugins/list.json", func(ctx *gin.Context) { GinApi(GET, "/api/plugins/list.json", func(ctx *gin.Context) {
current := utils.Int(ctx.Query("current")) current := utils.Int(ctx.Query("current"))
pageSize := utils.Int(ctx.Query("pageSize")) pageSize := utils.Int(ctx.Query("pageSize"))
activeKey := ctx.Query("activeKey")
init := ctx.Query("init") init := ctx.Query("init")
title := ctx.Query("title") keyword := ctx.Query("keyword")
rr := RequestPluginResult{ rr := RequestPluginResult{
Success: true, Success: true,
} }
@@ -124,13 +127,14 @@ func initWebPluginList() {
pageSize = 10 pageSize = 10
} }
rr.Page = current rr.Page = current
rr.Data = []*common.Function{}
if current != 0 { if current != 0 {
var list []*common.Function var list []*common.Function
if title == "" { if keyword == "" {
list = plugin_list list = plugin_list
} else { } else {
for _, f := range plugin_list { for _, f := range plugin_list {
if strings.Contains(f.Title, title) || strings.Contains(f.Organization, title) { if strings.Contains(f.Title, keyword) || strings.Contains(f.Organization, keyword) {
list = append(list, f) list = append(list, f)
} }
} }
@@ -139,6 +143,34 @@ func initWebPluginList() {
initPluginList() initPluginList()
} }
rr.Total = len(list) rr.Total = len(list)
tab1 := []*common.Function{}
tab2 := []*common.Function{}
fc := []*common.Function{}
fc = append(fc, Functions...)
for i := range list {
ded := false
for j := range fc {
if list[i].UUID == fc[j].UUID {
ded = true
break
}
}
if ded {
tab1 = append(tab1, list[i])
} else {
tab2 = append(tab2, list[i])
}
}
if activeKey != "tab2" {
list = tab1
rr.Tab1 = len(list)
rr.Tab2 = rr.Total - len(list)
} else {
list = tab2
rr.Tab2 = len(list)
rr.Tab1 = rr.Total - len(list)
}
rr.Total = len(list)
begin := (current - 1) * pageSize begin := (current - 1) * pageSize
end := (current) * pageSize end := (current) * pageSize
if end > rr.Total { if end > rr.Total {
@@ -148,8 +180,7 @@ func initWebPluginList() {
begin = end begin = end
} }
rr.Data = append(rr.Data, list[begin:end]...) rr.Data = append(rr.Data, list[begin:end]...)
fc := []*common.Function{}
fc = append(fc, Functions...)
publics := []string{} publics := []string{}
for _, f := range Functions { for _, f := range Functions {
if f.Public && f.UUID != "" { if f.Public && f.UUID != "" {