x
This commit is contained in:
@@ -8,6 +8,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/admin/umi.1177c492.js"></script>
|
||||
<script src="/admin/umi.0643bb4a.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
@@ -24,8 +24,10 @@ type RequestPluginResult struct {
|
||||
Tab1 int `json:"tab1"`
|
||||
Tab2 int `json:"tab2"`
|
||||
Tab3 int `json:"tab3"`
|
||||
Tab string `json:"tab"`
|
||||
Time time.Time `json:"time"`
|
||||
Classes map[string]int `json:"classes"`
|
||||
Origins map[string]string `json:"origins"`
|
||||
}
|
||||
|
||||
var plugin_list = []*common.Function{}
|
||||
@@ -117,12 +119,15 @@ func initWebPluginList() {
|
||||
return nil
|
||||
})
|
||||
GinApi(GET, "/api/plugins/list.json", func(ctx *gin.Context) {
|
||||
// ctx.QueryArray()
|
||||
origins := ctx.QueryArray("origin[]")
|
||||
current := utils.Int(ctx.Query("current"))
|
||||
pageSize := utils.Int(ctx.Query("pageSize"))
|
||||
activeKey := ctx.Query("activeKey")
|
||||
init := ctx.Query("init")
|
||||
keyword := ctx.Query("keyword")
|
||||
class := ctx.Query("class")
|
||||
mclass := ctx.Query("mclass")
|
||||
rr := RequestPluginResult{
|
||||
Success: true,
|
||||
}
|
||||
@@ -140,13 +145,33 @@ func initWebPluginList() {
|
||||
}
|
||||
var list []*common.Function
|
||||
if keyword == "" {
|
||||
list = append(list, plugin_list...)
|
||||
} else {
|
||||
for _, f := range plugin_list {
|
||||
if strings.Contains(f.Title, keyword) || strings.Contains(f.Organization, keyword) {
|
||||
list = append(list, f)
|
||||
if len(origins) == 0 {
|
||||
list = append(list, plugin_list...)
|
||||
|
||||
} else {
|
||||
for _, f := range plugin_list {
|
||||
if Contains(origins, f.Organization) {
|
||||
list = append(list, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if len(origins) == 0 {
|
||||
for _, f := range plugin_list {
|
||||
if strings.Contains(f.Title, keyword) || strings.Contains(f.Organization, keyword) {
|
||||
list = append(list, f)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for _, f := range plugin_list {
|
||||
if strings.Contains(f.Title, keyword) || strings.Contains(f.Organization, keyword) {
|
||||
if Contains(origins, f.Organization) {
|
||||
list = append(list, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
rr.Total = len(list)
|
||||
tab1 := []*common.Function{}
|
||||
@@ -165,6 +190,7 @@ func initWebPluginList() {
|
||||
classes[class] = append(classes[class], list[i])
|
||||
} else {
|
||||
for _, class := range list[i].Classes {
|
||||
class = strings.TrimRight(class, "类")
|
||||
if _, ok := classes[class]; !ok {
|
||||
classes[class] = []*common.Function{}
|
||||
}
|
||||
@@ -181,7 +207,11 @@ func initWebPluginList() {
|
||||
list, _ = classes[class]
|
||||
}
|
||||
rr.Classes = classesNum
|
||||
var origins = map[string]string{}
|
||||
for i := range list { //处理第二分类
|
||||
if list[i].Organization != "" {
|
||||
origins[list[i].Organization] = list[i].Organization
|
||||
}
|
||||
ded := false
|
||||
for j := range fc {
|
||||
if list[i].UUID == fc[j].UUID {
|
||||
@@ -198,7 +228,7 @@ func initWebPluginList() {
|
||||
tab2 = append(tab2, list[i])
|
||||
}
|
||||
}
|
||||
|
||||
rr.Origins = origins
|
||||
if activeKey == "tab2" {
|
||||
list = tab2
|
||||
rr.Tab1 = len(tab1)
|
||||
@@ -215,6 +245,17 @@ func initWebPluginList() {
|
||||
rr.Tab2 = len(tab2)
|
||||
rr.Tab3 = len(tab3)
|
||||
}
|
||||
tab := ""
|
||||
if mclass == "true" {
|
||||
if rr.Tab2 > rr.Tab1 {
|
||||
list = tab2
|
||||
tab = "tab2"
|
||||
} else {
|
||||
list = tab1
|
||||
tab = "tab1"
|
||||
}
|
||||
}
|
||||
rr.Tab = tab
|
||||
rr.Total = len(list)
|
||||
if len(list) == 0 {
|
||||
ctx.JSON(200, rr)
|
||||
|
||||
+5
-7
@@ -126,18 +126,16 @@ func init() {
|
||||
proxies.Foreach(func(b1, b2 []byte) error {
|
||||
new := string(b2)
|
||||
var ncfg = ProxyConfig{}
|
||||
var params = map[string]interface{}{}
|
||||
if strings.HasPrefix(new, "o:") {
|
||||
err := json.Unmarshal([]byte(strings.Replace(new, "o:", "", 1)), &ncfg)
|
||||
var data = []byte(strings.Replace(new, "o:", "", 1))
|
||||
err := json.Unmarshal(data, &ncfg)
|
||||
json.Unmarshal(data, ¶ms)
|
||||
if err != nil {
|
||||
console.Log("无法解析的代理数据:", err)
|
||||
return nil
|
||||
}
|
||||
// ncfg.RuleMatcher, err = preprocessRules(ncfg.Rules)
|
||||
if err != nil {
|
||||
console.Log("无法处理的代理匹配规则:", err)
|
||||
return nil
|
||||
}
|
||||
p, err := adapter.ParseProxy(structToMap(ncfg))
|
||||
p, err := adapter.ParseProxy(params)
|
||||
if err != nil {
|
||||
console.Log("无法解析的代理:", err)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user