Anubis module for Caddy
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add private_key option

Kot d492bfa6 97971b98

+18 -6
+11 -1
caddy_anubis.go
··· 1 1 package caddy_anubis 2 2 3 3 import ( 4 + "crypto/ed25519" 5 + "encoding/hex" 4 6 "fmt" 5 7 "log/slog" 6 8 "net" ··· 68 70 }) 69 71 m.Options.Policy = policy 70 72 m.anubis, err = libanubis.New(m.Options) 71 - 72 73 if err != nil { 73 74 return err 74 75 } ··· 118 119 return d.ArgErr() 119 120 } 120 121 m.PolicyFname = d.Val() 122 + case "private_key": 123 + if !d.Next() { 124 + return d.ArgErr() 125 + } 126 + seed, err := hex.DecodeString(d.Val()) 127 + if err != nil { 128 + return d.WrapErr(err) 129 + } 130 + m.Options.ED25519PrivateKey = ed25519.NewKeyFromSeed(seed) 121 131 } 122 132 } // anubis options 123 133
+7 -5
example/Caddyfile
··· 1 1 localhost { 2 2 @anubis { 3 - # This matcher allows you to select specific paths for Anubis to handle. 3 + # This matcher allows you to select specific paths for Anubis to handle. 4 4 # If you want to handle all paths, remove this block and use `anubis {...}` instead! 5 5 path / # don't let AI scrapers browse the file index 6 6 path /.within.website/* # required for anubis to work ··· 9 9 } 10 10 11 11 log http.handlers.anubis { 12 - level DEBUG 12 + level DEBUG 13 13 } 14 14 15 15 anubis @anubis { 16 - # This setting gets overridden a lot by the default bot policy. 17 - difficulty 4 16 + # This setting gets overridden a lot by the default bot policy. 17 + difficulty 4 18 18 19 - # Custom bot policy 19 + # Custom bot policy. 20 20 policy_fname example/botPolicy.yaml 21 + 22 + private_key "a183a07283e86b669e30e153ad4f0c7a9e2bbc3218fc8fa9d6b858b29e97d22b" 21 23 22 24 # FIXME: required for OpenGraph passthrough! 23 25 ## TODO: access upstream directly somehow?