Skip to content

Commit

Permalink
Merge category-*-cn to geolocation-cn
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Sep 7, 2024
1 parent d4b71e0 commit 19b54b9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,18 @@ func mergeTags(data map[string][]geosite.Item) {
}
cnCodeList = append(cnCodeList, code)
}
for _, code := range codeList {
if !strings.HasPrefix(code, "category-") {
continue
}
if !strings.HasSuffix(code, "-cn") {
continue
}
if strings.Contains(code, "@") {
continue
}
cnCodeList = append(cnCodeList, code)
}
newMap := make(map[geosite.Item]bool)
for _, item := range data["geolocation-cn"] {
newMap[item] = true
Expand All @@ -280,6 +292,10 @@ func mergeTags(data map[string][]geosite.Item) {
newList = append(newList, item)
}
data["geolocation-cn"] = newList
data["cn"] = append(newList, geosite.Item{
Type: geosite.RuleTypeDomainSuffix,
Value: "cn",
})
println("merged cn categories: " + strings.Join(cnCodeList, ","))
}

Expand Down

0 comments on commit 19b54b9

Please sign in to comment.