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>
<body>
<div id="root"></div>
<script src="/admin/umi.c11a7664.js"></script>
<script src="/admin/umi.2d4c6500.js"></script>
</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 != "" {
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)
if data != nil {
return
@@ -25,7 +25,7 @@ func getPaterner(uuid, path string) {
}
if data == nil {
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)
if data == nil {
console.Warn("无法从订阅源获取 %s 的协作脚本 %s ", GetScriptNameByUUID(uuid), path)
+36 -5
View File
@@ -21,6 +21,8 @@ type RequestPluginResult struct {
Data []*common.Function `json:"data"`
Page int `json:"page"`
Total int `json:"total"`
Tab1 int `json:"tab1"`
Tab2 int `json:"tab2"`
Time time.Time `json:"time"`
}
@@ -115,8 +117,9 @@ func initWebPluginList() {
GinApi(GET, "/api/plugins/list.json", func(ctx *gin.Context) {
current := utils.Int(ctx.Query("current"))
pageSize := utils.Int(ctx.Query("pageSize"))
activeKey := ctx.Query("activeKey")
init := ctx.Query("init")
title := ctx.Query("title")
keyword := ctx.Query("keyword")
rr := RequestPluginResult{
Success: true,
}
@@ -124,13 +127,14 @@ func initWebPluginList() {
pageSize = 10
}
rr.Page = current
rr.Data = []*common.Function{}
if current != 0 {
var list []*common.Function
if title == "" {
if keyword == "" {
list = plugin_list
} else {
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)
}
}
@@ -139,6 +143,34 @@ func initWebPluginList() {
initPluginList()
}
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
end := (current) * pageSize
if end > rr.Total {
@@ -148,8 +180,7 @@ func initWebPluginList() {
begin = end
}
rr.Data = append(rr.Data, list[begin:end]...)
fc := []*common.Function{}
fc = append(fc, Functions...)
publics := []string{}
for _, f := range Functions {
if f.Public && f.UUID != "" {