diff --git a/README.md b/README.md index 28bfc22..97cb1d8 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ http://localhost:8080/raw/https://www.example.com | `DISABLE_FORM` | Disables URL Form Frontpage | `false` | | `FORM_PATH` | Path to custom Form HTML | `` | | `RULESET` | URL to a ruleset file | `https://raw.githubusercontent.com/kubero-dev/ladder/main/ruleset.yaml` or `/path/to/my/rules.yaml` | +| `EXPOSE_RULESET` | Make your Ruleset available to other ladders | `true` | | `ALLOWED_DOMAINS` | Comma separated list of allowed domains. Empty = no limitations | `` | | `ALLOWED_DOMAINS_RULESET` | Allow Domains from Ruleset. false = no limitations | `false` | @@ -117,7 +118,8 @@ See in [ruleset.yaml](ruleset.yaml) for an example. alert("Hello!"); - domain: www.anotherdomain.com # Domain where the rule applies - path: /article # Path where the rule applies + paths: # Paths where the rule applies + - /article googleCache: false # Search also in Google Cache regexRules: # Regex rules to apply - match: ]*\s+)?src="(/)([^"]*)" diff --git a/cmd/main.go b/cmd/main.go index dcbbdfa..24a6f05 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -39,7 +39,6 @@ func main() { Default: pf, Help: "This will spawn multiple processes listening"}) - // Parse input err := parser.Parse(os.Args) if err != nil { fmt.Print(parser.Usage(err)) @@ -74,9 +73,11 @@ func main() { } app.Get("/", handlers.Form) + app.Get("ruleset", handlers.Ruleset) app.Get("raw/*", handlers.Raw) app.Get("api/*", handlers.Api) + app.Get("ruleset", handlers.Raw) app.Get("/*", handlers.ProxySite) log.Fatal(app.Listen(":" + *port)) diff --git a/handlers/ruleset.go b/handlers/ruleset.go new file mode 100644 index 0000000..c716b3c --- /dev/null +++ b/handlers/ruleset.go @@ -0,0 +1,17 @@ +package handlers + +import ( + "github.com/gofiber/fiber/v2" + "gopkg.in/yaml.v3" +) + +func Ruleset(c *fiber.Ctx) error { + + body, err := yaml.Marshal(rulesSet) + if err != nil { + c.SendStatus(fiber.StatusInternalServerError) + return c.SendString(err.Error()) + } + + return c.SendString(string(body)) +}