From d5c58f42da42dcda89545e7027b9a7ec577051f7 Mon Sep 17 00:00:00 2001 From: Gianni Carafa Date: Fri, 3 Nov 2023 15:34:41 +0100 Subject: [PATCH] clean up --- handlers/proxy.go | 11 ++++++----- ruleset.yaml | 29 ++++++++++------------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/handlers/proxy.go b/handlers/proxy.go index 714ec4e..6fe4462 100644 --- a/handlers/proxy.go +++ b/handlers/proxy.go @@ -116,7 +116,7 @@ func loadRules() RuleSet { return RulesList } log.Println("Loading rules") - // TODO: Load the rules from the URL + resp, err := http.Get(rulesUrl) if err != nil { log.Println("ERROR:", err) @@ -149,10 +149,11 @@ func applyRules(domain string, path string, body string) string { if rule.Path != "" && rule.Path != path { continue } - for _, domRule := range rule.DomRules { - re := regexp.MustCompile(domRule.Match) - body = re.ReplaceAllString(body, domRule.Replace) - } + /* + for _, domRule := range rule.DomRules { + // run the dom rules + } + */ for _, regexRule := range rule.RegexRules { re := regexp.MustCompile(regexRule.Match) body = re.ReplaceAllString(body, regexRule.Replace) diff --git a/ruleset.yaml b/ruleset.yaml index dd07ef9..fe1eeed 100644 --- a/ruleset.yaml +++ b/ruleset.yaml @@ -1,24 +1,15 @@ -- domain: www.example.ch +- domain: www.example.com path: /article regexRules: - - match: "asdf" - replace: "asdf" - - match: "asdf" - replace: "asdf" + - match: ]*\s+)?src="(/)([^"]*)" + replace: