Add <rule-set>.<type=github/path/prefix>

This commit is contained in:
世界 2024-05-12 00:31:19 +08:00
parent 962bc9c7be
commit 76e13570a2
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 5 additions and 2 deletions

View File

@ -116,6 +116,8 @@ type GitHubRuleSetOptions struct {
Owner string `json:"owner,omitempty"`
Repo string `json:"repo,omitempty"`
Branch string `json:"branch,omitempty"`
Path string `json:"path,omitempty"`
Prefix string `json:"prefix,omitempty"`
RuleSet option.Listable[string] `json:"rule_set,omitempty"`
}

View File

@ -120,14 +120,15 @@ func (t *Template) renderRuleSet(ruleSets []option.RuleSet) []boxOption.RuleSet
for _, code := range ruleSet.GitHubOptions.RuleSet {
result = append(result, boxOption.RuleSet{
Type: C.RuleSetTypeRemote,
Tag: code,
Tag: ruleSet.GitHubOptions.Prefix + code,
Format: C.RuleSetFormatBinary,
RemoteOptions: boxOption.RemoteRuleSet{
URL: downloadURL +
ruleSet.GitHubOptions.Owner + "/" +
ruleSet.GitHubOptions.Repo + "/" +
ruleSet.GitHubOptions.Repo +
branchSplit +
ruleSet.GitHubOptions.Branch + "/" +
ruleSet.GitHubOptions.Path +
code + ".srs",
DownloadDetour: downloadDetour,
},