aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/anubis/CHANGELOG.md5
-rw-r--r--cmd/anubis/botPolicies.json398
-rw-r--r--cmd/anubis/decaymap.go87
-rw-r--r--cmd/anubis/decaymap_test.go31
-rw-r--r--cmd/anubis/index.templ217
-rw-r--r--cmd/anubis/index_templ.go225
-rw-r--r--cmd/anubis/internal/config/config.go162
-rw-r--r--cmd/anubis/internal/config/config_test.go248
-rw-r--r--cmd/anubis/internal/config/testdata/bad/badregexes.json14
-rw-r--r--cmd/anubis/internal/config/testdata/bad/invalid.json5
-rw-r--r--cmd/anubis/internal/config/testdata/bad/nobots.json1
-rw-r--r--cmd/anubis/internal/config/testdata/good/allow_everyone.json12
-rw-r--r--cmd/anubis/internal/config/testdata/good/challengemozilla.json9
-rw-r--r--cmd/anubis/internal/config/testdata/good/everything_blocked.json10
-rw-r--r--cmd/anubis/internal/dnsbl/dnsbl.go95
-rw-r--r--cmd/anubis/internal/dnsbl/dnsbl_test.go61
-rw-r--r--cmd/anubis/internal/dnsbl/droneblresponse_string.go54
-rw-r--r--cmd/anubis/js/main.mjs89
-rw-r--r--cmd/anubis/js/proof-of-work-slow.mjs63
-rw-r--r--cmd/anubis/js/proof-of-work.mjs93
-rw-r--r--cmd/anubis/js/video.mjs16
-rw-r--r--cmd/anubis/main.go558
-rw-r--r--cmd/anubis/policy.go212
-rw-r--r--cmd/anubis/policy_test.go65
-rw-r--r--cmd/anubis/static/img/happy.webpbin59250 -> 0 bytes
-rw-r--r--cmd/anubis/static/img/pensive.webpbin49148 -> 0 bytes
-rw-r--r--cmd/anubis/static/img/sad.webpbin50802 -> 0 bytes
-rw-r--r--cmd/anubis/static/js/main.mjs2
-rw-r--r--cmd/anubis/static/js/main.mjs.brbin1216 -> 0 bytes
-rw-r--r--cmd/anubis/static/js/main.mjs.gzbin1451 -> 0 bytes
-rw-r--r--cmd/anubis/static/js/main.mjs.map7
-rw-r--r--cmd/anubis/static/js/main.mjs.zstbin1430 -> 0 bytes
-rw-r--r--cmd/anubis/static/robots.txt47
-rw-r--r--cmd/anubis/static/testdata/black.mp4bin1667 -> 0 bytes
34 files changed, 50 insertions, 2736 deletions
diff --git a/cmd/anubis/CHANGELOG.md b/cmd/anubis/CHANGELOG.md
deleted file mode 100644
index 612bec1..0000000
--- a/cmd/anubis/CHANGELOG.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# CHANGELOG
-
-## 2025-01-24
-
-- Added support for custom bot policy documentation, allowing administrators to change how Anubis works to meet their needs.
diff --git a/cmd/anubis/botPolicies.json b/cmd/anubis/botPolicies.json
deleted file mode 100644
index 0e33706..0000000
--- a/cmd/anubis/botPolicies.json
+++ /dev/null
@@ -1,398 +0,0 @@
-{
- "bots": [
- {
- "name": "amazonbot",
- "user_agent_regex": "Amazonbot",
- "action": "DENY"
- },
- {
- "name": "googlebot",
- "user_agent_regex": "\\+http\\://www\\.google\\.com/bot\\.html",
- "action": "ALLOW",
- "remote_addresses": [
- "2001:4860:4801:10::/64",
- "2001:4860:4801:11::/64",
- "2001:4860:4801:12::/64",
- "2001:4860:4801:13::/64",
- "2001:4860:4801:14::/64",
- "2001:4860:4801:15::/64",
- "2001:4860:4801:16::/64",
- "2001:4860:4801:17::/64",
- "2001:4860:4801:18::/64",
- "2001:4860:4801:19::/64",
- "2001:4860:4801:1a::/64",
- "2001:4860:4801:1b::/64",
- "2001:4860:4801:1c::/64",
- "2001:4860:4801:1d::/64",
- "2001:4860:4801:1e::/64",
- "2001:4860:4801:1f::/64",
- "2001:4860:4801:20::/64",
- "2001:4860:4801:21::/64",
- "2001:4860:4801:22::/64",
- "2001:4860:4801:23::/64",
- "2001:4860:4801:24::/64",
- "2001:4860:4801:25::/64",
- "2001:4860:4801:26::/64",
- "2001:4860:4801:27::/64",
- "2001:4860:4801:28::/64",
- "2001:4860:4801:29::/64",
- "2001:4860:4801:2::/64",
- "2001:4860:4801:2a::/64",
- "2001:4860:4801:2b::/64",
- "2001:4860:4801:2c::/64",
- "2001:4860:4801:2d::/64",
- "2001:4860:4801:2e::/64",
- "2001:4860:4801:2f::/64",
- "2001:4860:4801:31::/64",
- "2001:4860:4801:32::/64",
- "2001:4860:4801:33::/64",
- "2001:4860:4801:34::/64",
- "2001:4860:4801:35::/64",
- "2001:4860:4801:36::/64",
- "2001:4860:4801:37::/64",
- "2001:4860:4801:38::/64",
- "2001:4860:4801:39::/64",
- "2001:4860:4801:3a::/64",
- "2001:4860:4801:3b::/64",
- "2001:4860:4801:3c::/64",
- "2001:4860:4801:3d::/64",
- "2001:4860:4801:3e::/64",
- "2001:4860:4801:40::/64",
- "2001:4860:4801:41::/64",
- "2001:4860:4801:42::/64",
- "2001:4860:4801:43::/64",
- "2001:4860:4801:44::/64",
- "2001:4860:4801:45::/64",
- "2001:4860:4801:46::/64",
- "2001:4860:4801:47::/64",
- "2001:4860:4801:48::/64",
- "2001:4860:4801:49::/64",
- "2001:4860:4801:4a::/64",
- "2001:4860:4801:4b::/64",
- "2001:4860:4801:4c::/64",
- "2001:4860:4801:50::/64",
- "2001:4860:4801:51::/64",
- "2001:4860:4801:52::/64",
- "2001:4860:4801:53::/64",
- "2001:4860:4801:54::/64",
- "2001:4860:4801:55::/64",
- "2001:4860:4801:56::/64",
- "2001:4860:4801:60::/64",
- "2001:4860:4801:61::/64",
- "2001:4860:4801:62::/64",
- "2001:4860:4801:63::/64",
- "2001:4860:4801:64::/64",
- "2001:4860:4801:65::/64",
- "2001:4860:4801:66::/64",
- "2001:4860:4801:67::/64",
- "2001:4860:4801:68::/64",
- "2001:4860:4801:69::/64",
- "2001:4860:4801:6a::/64",
- "2001:4860:4801:6b::/64",
- "2001:4860:4801:6c::/64",
- "2001:4860:4801:6d::/64",
- "2001:4860:4801:6e::/64",
- "2001:4860:4801:6f::/64",
- "2001:4860:4801:70::/64",
- "2001:4860:4801:71::/64",
- "2001:4860:4801:72::/64",
- "2001:4860:4801:73::/64",
- "2001:4860:4801:74::/64",
- "2001:4860:4801:75::/64",
- "2001:4860:4801:76::/64",
- "2001:4860:4801:77::/64",
- "2001:4860:4801:78::/64",
- "2001:4860:4801:79::/64",
- "2001:4860:4801:80::/64",
- "2001:4860:4801:81::/64",
- "2001:4860:4801:82::/64",
- "2001:4860:4801:83::/64",
- "2001:4860:4801:84::/64",
- "2001:4860:4801:85::/64",
- "2001:4860:4801:86::/64",
- "2001:4860:4801:87::/64",
- "2001:4860:4801:88::/64",
- "2001:4860:4801:90::/64",
- "2001:4860:4801:91::/64",
- "2001:4860:4801:92::/64",
- "2001:4860:4801:93::/64",
- "2001:4860:4801:94::/64",
- "2001:4860:4801:95::/64",
- "2001:4860:4801:96::/64",
- "2001:4860:4801:a0::/64",
- "2001:4860:4801:a1::/64",
- "2001:4860:4801:a2::/64",
- "2001:4860:4801:a3::/64",
- "2001:4860:4801:a4::/64",
- "2001:4860:4801:a5::/64",
- "2001:4860:4801:c::/64",
- "2001:4860:4801:f::/64",
- "192.178.5.0/27",
- "192.178.6.0/27",
- "192.178.6.128/27",
- "192.178.6.160/27",
- "192.178.6.192/27",
- "192.178.6.32/27",
- "192.178.6.64/27",
- "192.178.6.96/27",
- "34.100.182.96/28",
- "34.101.50.144/28",
- "34.118.254.0/28",
- "34.118.66.0/28",
- "34.126.178.96/28",
- "34.146.150.144/28",
- "34.147.110.144/28",
- "34.151.74.144/28",
- "34.152.50.64/28",
- "34.154.114.144/28",
- "34.155.98.32/28",
- "34.165.18.176/28",
- "34.175.160.64/28",
- "34.176.130.16/28",
- "34.22.85.0/27",
- "34.64.82.64/28",
- "34.65.242.112/28",
- "34.80.50.80/28",
- "34.88.194.0/28",
- "34.89.10.80/28",
- "34.89.198.80/28",
- "34.96.162.48/28",
- "35.247.243.240/28",
- "66.249.64.0/27",
- "66.249.64.128/27",
- "66.249.64.160/27",
- "66.249.64.224/27",
- "66.249.64.32/27",
- "66.249.64.64/27",
- "66.249.64.96/27",
- "66.249.65.0/27",
- "66.249.65.128/27",
- "66.249.65.160/27",
- "66.249.65.192/27",
- "66.249.65.224/27",
- "66.249.65.32/27",
- "66.249.65.64/27",
- "66.249.65.96/27",
- "66.249.66.0/27",
- "66.249.66.128/27",
- "66.249.66.160/27",
- "66.249.66.192/27",
- "66.249.66.224/27",
- "66.249.66.32/27",
- "66.249.66.64/27",
- "66.249.66.96/27",
- "66.249.68.0/27",
- "66.249.68.128/27",
- "66.249.68.32/27",
- "66.249.68.64/27",
- "66.249.68.96/27",
- "66.249.69.0/27",
- "66.249.69.128/27",
- "66.249.69.160/27",
- "66.249.69.192/27",
- "66.249.69.224/27",
- "66.249.69.32/27",
- "66.249.69.64/27",
- "66.249.69.96/27",
- "66.249.70.0/27",
- "66.249.70.128/27",
- "66.249.70.160/27",
- "66.249.70.192/27",
- "66.249.70.224/27",
- "66.249.70.32/27",
- "66.249.70.64/27",
- "66.249.70.96/27",
- "66.249.71.0/27",
- "66.249.71.128/27",
- "66.249.71.160/27",
- "66.249.71.192/27",
- "66.249.71.224/27",
- "66.249.71.32/27",
- "66.249.71.64/27",
- "66.249.71.96/27",
- "66.249.72.0/27",
- "66.249.72.128/27",
- "66.249.72.160/27",
- "66.249.72.192/27",
- "66.249.72.224/27",
- "66.249.72.32/27",
- "66.249.72.64/27",
- "66.249.72.96/27",
- "66.249.73.0/27",
- "66.249.73.128/27",
- "66.249.73.160/27",
- "66.249.73.192/27",
- "66.249.73.224/27",
- "66.249.73.32/27",
- "66.249.73.64/27",
- "66.249.73.96/27",
- "66.249.74.0/27",
- "66.249.74.128/27",
- "66.249.74.160/27",
- "66.249.74.192/27",
- "66.249.74.32/27",
- "66.249.74.64/27",
- "66.249.74.96/27",
- "66.249.75.0/27",
- "66.249.75.128/27",
- "66.249.75.160/27",
- "66.249.75.192/27",
- "66.249.75.224/27",
- "66.249.75.32/27",
- "66.249.75.64/27",
- "66.249.75.96/27",
- "66.249.76.0/27",
- "66.249.76.128/27",
- "66.249.76.160/27",
- "66.249.76.192/27",
- "66.249.76.224/27",
- "66.249.76.32/27",
- "66.249.76.64/27",
- "66.249.76.96/27",
- "66.249.77.0/27",
- "66.249.77.128/27",
- "66.249.77.160/27",
- "66.249.77.192/27",
- "66.249.77.224/27",
- "66.249.77.32/27",
- "66.249.77.64/27",
- "66.249.77.96/27",
- "66.249.78.0/27",
- "66.249.78.32/27",
- "66.249.79.0/27",
- "66.249.79.128/27",
- "66.249.79.160/27",
- "66.249.79.192/27",
- "66.249.79.224/27",
- "66.249.79.32/27",
- "66.249.79.64/27",
- "66.249.79.96/27"
- ]
- },
- {
- "name": "bingbot",
- "user_agent_regex": "\\+http\\://www\\.bing\\.com/bingbot\\.htm",
- "action": "ALLOW",
- "remote_addresses": [
- "157.55.39.0/24",
- "207.46.13.0/24",
- "40.77.167.0/24",
- "13.66.139.0/24",
- "13.66.144.0/24",
- "52.167.144.0/24",
- "13.67.10.16/28",
- "13.69.66.240/28",
- "13.71.172.224/28",
- "139.217.52.0/28",
- "191.233.204.224/28",
- "20.36.108.32/28",
- "20.43.120.16/28",
- "40.79.131.208/28",
- "40.79.186.176/28",
- "52.231.148.0/28",
- "20.79.107.240/28",
- "51.105.67.0/28",
- "20.125.163.80/28",
- "40.77.188.0/22",
- "65.55.210.0/24",
- "199.30.24.0/23",
- "40.77.202.0/24",
- "40.77.139.0/25",
- "20.74.197.0/28",
- "20.15.133.160/27",
- "40.77.177.0/24",
- "40.77.178.0/23"
- ]
- },
- {
- "name": "qwantbot",
- "user_agent_regex": "\\+https\\://help\\.qwant\\.com/bot/",
- "action": "ALLOW",
- "remote_addresses": [
- "91.242.162.0/24"
- ]
- },
- {
- "name": "kagibot",
- "user_agent_regex": "\\+https\\://kagi\\.com/bot",
- "action": "ALLOW",
- "remote_addresses": [
- "216.18.205.234/32",
- "35.212.27.76/32",
- "104.254.65.50/32",
- "209.151.156.194/32"
- ]
- },
- {
- "name": "marginalia",
- "user_agent_regex": "search\\.marginalia\\.nu",
- "action": "ALLOW",
- "remote_addresses": [
- "193.183.0.162/31",
- "193.183.0.164/30",
- "193.183.0.168/30",
- "193.183.0.172/31",
- "193.183.0.174/32"
- ]
- },
- {
- "name": "mojeekbot",
- "user_agent_regex": "http\\://www\\.mojeek\\.com/bot\\.html",
- "action": "ALLOW",
- "remote_addresses": [
- "5.102.173.71/32"
- ]
- },
- {
- "name": "us-artificial-intelligence-scraper",
- "user_agent_regex": "\\+https\\://github\\.com/US-Artificial-Intelligence/scraper",
- "action": "DENY"
- },
- {
- "name": "well-known",
- "path_regex": "^/.well-known/.*$",
- "action": "ALLOW"
- },
- {
- "name": "favicon",
- "path_regex": "^/favicon.ico$",
- "action": "ALLOW"
- },
- {
- "name": "robots-txt",
- "path_regex": "^/robots.txt$",
- "action": "ALLOW"
- },
- {
- "name": "lightpanda",
- "user_agent_regex": "^Lightpanda/.*$",
- "action": "DENY"
- },
- {
- "name": "headless-chrome",
- "user_agent_regex": "HeadlessChrome",
- "action": "DENY"
- },
- {
- "name": "headless-chromium",
- "user_agent_regex": "HeadlessChromium",
- "action": "DENY"
- },
- {
- "name": "generic-bot-catchall",
- "user_agent_regex": "(?i:bot|crawler)",
- "action": "CHALLENGE",
- "challenge": {
- "difficulty": 16,
- "report_as": 4,
- "algorithm": "slow"
- }
- },
- {
- "name": "generic-browser",
- "user_agent_regex": "Mozilla",
- "action": "CHALLENGE"
- }
- ],
- "dnsbl": true
-}
diff --git a/cmd/anubis/decaymap.go b/cmd/anubis/decaymap.go
deleted file mode 100644
index dcd2952..0000000
--- a/cmd/anubis/decaymap.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package main
-
-import (
- "sync"
- "time"
-)
-
-func zilch[T any]() T {
- var zero T
- return zero
-}
-
-// DecayMap is a lazy key->value map. It's a wrapper around a map and a mutex. If values exceed their time-to-live, they are pruned at Get time.
-type DecayMap[K comparable, V any] struct {
- data map[K]decayMapEntry[V]
- lock sync.RWMutex
-}
-
-type decayMapEntry[V any] struct {
- Value V
- expiry time.Time
-}
-
-// NewDecayMap creates a new DecayMap of key type K and value type V.
-//
-// Key types must be comparable to work with maps.
-func NewDecayMap[K comparable, V any]() *DecayMap[K, V] {
- return &DecayMap[K, V]{
- data: make(map[K]decayMapEntry[V]),
- }
-}
-
-// expire forcibly expires a key by setting its time-to-live one second in the past.
-func (m *DecayMap[K, V]) expire(key K) bool {
- m.lock.RLock()
- val, ok := m.data[key]
- m.lock.RUnlock()
-
- if !ok {
- return false
- }
-
- m.lock.Lock()
- val.expiry = time.Now().Add(-1 * time.Second)
- m.data[key] = val
- m.lock.Unlock()
-
- return true
-}
-
-// Get gets a value from the DecayMap by key.
-//
-// If a value has expired, forcibly delete it if it was not updated.
-func (m *DecayMap[K, V]) Get(key K) (V, bool) {
- m.lock.RLock()
- value, ok := m.data[key]
- m.lock.RUnlock()
-
- if !ok {
- return zilch[V](), false
- }
-
- if time.Now().After(value.expiry) {
- m.lock.Lock()
- // Since previously reading m.data[key], the value may have been updated.
- // Delete the entry only if the expiry time is still the same.
- if m.data[key].expiry == value.expiry {
- delete(m.data, key)
- }
- m.lock.Unlock()
-
- return zilch[V](), false
- }
-
- return value.Value, true
-}
-
-// Set sets a key value pair in the map.
-func (m *DecayMap[K, V]) Set(key K, value V, ttl time.Duration) {
- m.lock.Lock()
- defer m.lock.Unlock()
-
- m.data[key] = decayMapEntry[V]{
- Value: value,
- expiry: time.Now().Add(ttl),
- }
-}
diff --git a/cmd/anubis/decaymap_test.go b/cmd/anubis/decaymap_test.go
deleted file mode 100644
index 73e0626..0000000
--- a/cmd/anubis/decaymap_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package main
-
-import (
- "testing"
- "time"
-)
-
-func TestDecayMap(t *testing.T) {
- dm := NewDecayMap[string, string]()
-
- dm.Set("test", "hi", 5*time.Minute)
-
- val, ok := dm.Get("test")
- if !ok {
- t.Error("somehow the test key was not set")
- }
-
- if val != "hi" {
- t.Errorf("wanted value %q, got: %q", "hi", val)
- }
-
- ok = dm.expire("test")
- if !ok {
- t.Error("somehow could not force-expire the test key")
- }
-
- _, ok = dm.Get("test")
- if ok {
- t.Error("got value even though it was supposed to be expired")
- }
-}
diff --git a/cmd/anubis/index.templ b/cmd/anubis/index.templ
deleted file mode 100644
index 79ae005..0000000
--- a/cmd/anubis/index.templ
+++ /dev/null
@@ -1,217 +0,0 @@
-package main
-
-import (
- "github.com/TecharoHQ/anubis"
- "github.com/TecharoHQ/anubis/xess"
-)
-
-templ base(title string, body templ.Component) {
- <!DOCTYPE html>
- <html>
- <head>
- <title>{ title }</title>
- <link rel="stylesheet" href={ xess.URL }/>
- <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
- <style>
- body,
- html {
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: auto;
- margin-right: auto;
- }
-
- .centered-div {
- text-align: center;
- }
-
- .lds-roller,
- .lds-roller div,
- .lds-roller div:after {
- box-sizing: border-box;
- }
-
- .lds-roller {
- display: inline-block;
- position: relative;
- width: 80px;
- height: 80px;
- }
-
- .lds-roller div {
- animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
- transform-origin: 40px 40px;
- }
-
- .lds-roller div:after {
- content: " ";
- display: block;
- position: absolute;
- width: 7.2px;
- height: 7.2px;
- border-radius: 50%;
- background: currentColor;
- margin: -3.6px 0 0 -3.6px;
- }
-
- .lds-roller div:nth-child(1) {
- animation-delay: -0.036s;
- }
-
- .lds-roller div:nth-child(1):after {
- top: 62.62742px;
- left: 62.62742px;
- }
-
- .lds-roller div:nth-child(2) {
- animation-delay: -0.072s;
- }
-
- .lds-roller div:nth-child(2):after {
- top: 67.71281px;
- left: 56px;
- }
-
- .lds-roller div:nth-child(3) {
- animation-delay: -0.108s;
- }
-
- .lds-roller div:nth-child(3):after {
- top: 70.90963px;
- left: 48.28221px;
- }
-
- .lds-roller div:nth-child(4) {
- animation-delay: -0.144s;
- }
-
- .lds-roller div:nth-child(4):after {
- top: 72px;
- left: 40px;
- }
-
- .lds-roller div:nth-child(5) {
- animation-delay: -0.18s;
- }
-
- .lds-roller div:nth-child(5):after {
- top: 70.90963px;
- left: 31.71779px;
- }
-
- .lds-roller div:nth-child(6) {
- animation-delay: -0.216s;
- }
-
- .lds-roller div:nth-child(6):after {
- top: 67.71281px;
- left: 24px;
- }
-
- .lds-roller div:nth-child(7) {
- animation-delay: -0.252s;
- }
-
- .lds-roller div:nth-child(7):after {
- top: 62.62742px;
- left: 17.37258px;
- }
-
- .lds-roller div:nth-child(8) {
- animation-delay: -0.288s;
- }
-
- .lds-roller div:nth-child(8):after {
- top: 56px;
- left: 12.28719px;
- }
-
- @keyframes lds-roller {
- 0% {
- transform: rotate(0deg);
- }
-
- 100% {
- transform: rotate(360deg);
- }
- }
- </style>
- @templ.JSONScript("anubis_version", anubis.Version)
- </head>
- <body id="top">
- <main>
- <center>
- <h1 id="title" class=".centered-div">{ title }</h1>
- </center>
- @body
- <footer>
- <center>
- <p>
- Protected by <a href="https://github.com/TecharoHQ/anubis">Anubis</a> from <a
- href="https://techaro.lol"
->Techaro</a>. Made with ❤️ in 🇨🇦.
- </p>
- </center>
- </footer>
- </main>
- </body>
- </html>
-}
-
-templ index() {
- <div class="centered-div">
- <img
- id="image"
- style="width:100%;max-width:256px;"
- src={ "/.within.website/x/cmd/anubis/static/img/pensive.webp?cacheBuster=" +
- anubis.Version }
- />
- <img
- style="display:none;"
- style="width:100%;max-width:256px;"
- src={ "/.within.website/x/cmd/anubis/static/img/happy.webp?cacheBuster=" +
- anubis.Version }
- />
- <p id="status">Loading...</p>
- <script async type="module" src={ "/.within.website/x/cmd/anubis/static/js/main.mjs?cacheBuster=" + anubis.Version }></script>
- <div id="spinner" class="lds-roller">
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- </div>
- <details>
- <summary>Why am I seeing this?</summary>
- <p>You are seeing this because the administrator of this website has set up <a href="https://github.com/TecharoHQ/anubis">Anubis</a> to protect the server against the scourge of <a href="https://thelibre.news/foss-infrastructure-is-under-attack-by-ai-companies/">AI companies aggressively scraping websites</a>. This can and does cause downtime for the websites, which makes their resources inaccessible for everyone.</p>
- <p>Anubis is a compromise. Anubis uses a <a href="https://anubis.techaro.lol/docs/design/why-proof-of-work">Proof-of-Work</a> scheme in the vein of <a href="https://en.wikipedia.org/wiki/Hashcash">Hashcash</a>, a proposed proof-of-work scheme for reducing email spam. The idea is that at individual scales the additional load is ignorable, but at mass scraper levels it adds up and makes scraping much more expensive.</p>
- <p>Ultimately, this is a hack whose real purpose is to give a "good enough" placeholder solution so that more time can be spent on fingerprinting and identifying headless browsers (EG: via how they do font rendering) so that the challenge proof of work page doesn't need to be presented to users that are much more likely to be legitimate.</p>
- <p>Please note that Anubis requires the use of modern JavaScript features that plugins like <a href="https://jshelter.org/">JShelter</a> will disable. Please disable JShelter or other such plugins for this domain.</p>
- </details>
- <noscript>
- <p>
- Sadly, you must enable JavaScript to get past this challenge. This is required because AI companies have changed
- the social contract around how website hosting works. A no-JS solution is a work-in-progress.
- </p>
- </noscript>
- <div id="testarea"></div>
- </div>
-}
-
-templ errorPage(message string) {
- <div class="centered-div">
- <img
- id="image"
- style="width:100%;max-width:256px;"
- src={ "/.within.website/x/cmd/anubis/static/img/sad.webp?cacheBuster=" + anubis.Version }
- />
- <p>{ message }.</p>
- <button onClick="window.location.reload();">Try again</button>
- <p><a href="/">Go home</a></p>
- </div>
-}
diff --git a/cmd/anubis/index_templ.go b/cmd/anubis/index_templ.go
deleted file mode 100644
index c3755c5..0000000
--- a/cmd/anubis/index_templ.go
+++ /dev/null
@@ -1,225 +0,0 @@
-// Code generated by templ - DO NOT EDIT.
-
-// templ: version: v0.3.833
-package main
-
-//lint:file-ignore SA4006 This context is only used if a nested component is present.
-
-import "github.com/a-h/templ"
-import templruntime "github.com/a-h/templ/runtime"
-
-import (
- "github.com/TecharoHQ/anubis"
- "github.com/TecharoHQ/anubis/xess"
-)
-
-func base(title string, body templ.Component) templ.Component {
- return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
- templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
- if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
- return templ_7745c5c3_CtxErr
- }
- templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
- if !templ_7745c5c3_IsBuffer {
- defer func() {
- templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err == nil {
- templ_7745c5c3_Err = templ_7745c5c3_BufErr
- }
- }()
- }
- ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Var1 := templ.GetChildren(ctx)
- if templ_7745c5c3_Var1 == nil {
- templ_7745c5c3_Var1 = templ.NopComponent
- }
- ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html><head><title>")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var2 string
- templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 12, Col: 17}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</title><link rel=\"stylesheet\" href=\"")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var3 string
- templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(xess.URL)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 13, Col: 41}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><style>\n body,\n html {\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-left: auto;\n margin-right: auto;\n }\n\n .centered-div {\n text-align: center;\n }\n\n .lds-roller,\n .lds-roller div,\n .lds-roller div:after {\n box-sizing: border-box;\n }\n\n .lds-roller {\n display: inline-block;\n position: relative;\n width: 80px;\n height: 80px;\n }\n\n .lds-roller div {\n animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n transform-origin: 40px 40px;\n }\n\n .lds-roller div:after {\n content: \" \";\n display: block;\n position: absolute;\n width: 7.2px;\n height: 7.2px;\n border-radius: 50%;\n background: currentColor;\n margin: -3.6px 0 0 -3.6px;\n }\n\n .lds-roller div:nth-child(1) {\n animation-delay: -0.036s;\n }\n\n .lds-roller div:nth-child(1):after {\n top: 62.62742px;\n left: 62.62742px;\n }\n\n .lds-rolle