Weighs the soul of incoming HTTP requests to stop AI crawlers
11
fork

Configure Feed

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

at main 87 lines 3.2 kB view raw
1$`npm run assets`; 2 3[ 4 "amd64", 5 "arm64", 6 "ppc64le", 7 "riscv64", 8].forEach(goarch => { 9 [deb, rpm, tarball].forEach(method => method.build({ 10 name: "anubis", 11 description: "Anubis weighs the souls of incoming HTTP requests and uses a sha256 proof-of-work challenge in order to protect upstream resources from scraper bots.", 12 homepage: "https://anubis.techaro.lol", 13 license: "MIT", 14 goarch, 15 16 documentation: { 17 "./README.md": "README.md", 18 "./LICENSE": "LICENSE", 19 "./data/botPolicies.json": "botPolicies.json", 20 "./data/botPolicies.yaml": "botPolicies.yaml", 21 }, 22 23 build: ({ bin, etc, systemd, doc }) => { 24 $`go build -o ${bin}/anubis -ldflags '-s -w -extldflags "-static" -X "github.com/TecharoHQ/anubis.Version=${git.tag()}"' ./cmd/anubis`; 25 $`go build -o ${bin}/anubis-robots2policy -ldflags '-s -w -extldflags "-static" -X "github.com/TecharoHQ/anubis.Version=${git.tag()}"' ./cmd/robots2policy`; 26 27 file.install("./run/anubis@.service", `${systemd}/anubis@.service`); 28 file.install("./run/default.env", `${etc}/default.env`); 29 30 $`mkdir -p ${doc}/docs` 31 $`cp -a docs/docs ${doc}`; 32 $`find ${doc} -name _category_.json -delete`; 33 $`mkdir -p ${doc}/data`; 34 $`cp -a data/apps ${doc}/data/apps`; 35 $`cp -a data/bots ${doc}/data/bots`; 36 $`cp -a data/clients ${doc}/data/clients`; 37 $`cp -a data/common ${doc}/data/common`; 38 $`cp -a data/crawlers ${doc}/data/crawlers`; 39 $`cp -a data/meta ${doc}/data/meta`; 40 }, 41 })); 42}); 43 44// NOTE(Xe): Fixes #217. This is a "half baked" tarball that includes the harder 45// parts for deterministic distros already done. Distributions like NixOS, Gentoo 46// and *BSD ports have a difficult time fitting the square peg of their dependency 47// model into the bazaar of round holes that various modern languages use. Needless 48// to say, this makes adoption easier. 49tarball.build({ 50 name: "anubis-src-vendor", 51 license: "MIT", 52 // XXX(Xe): This is needed otherwise go will be very sad. 53 platform: yeet.goos, 54 goarch: yeet.goarch, 55 56 build: ({ out }) => { 57 // prepare clean checkout in $out 58 $`git archive --format=tar HEAD | tar xC ${out}`; 59 // vendor Go dependencies 60 $`cd ${out} && go mod vendor`; 61 // write VERSION file 62 $`echo ${git.tag()} > ${out}/VERSION`; 63 }, 64 65 mkFilename: ({ name, version }) => `${name}-${version}`, 66}); 67 68tarball.build({ 69 name: "anubis-src-vendor-npm", 70 license: "MIT", 71 // XXX(Xe): This is needed otherwise go will be very sad. 72 platform: yeet.goos, 73 goarch: yeet.goarch, 74 75 build: ({ out }) => { 76 // prepare clean checkout in $out 77 $`git archive --format=tar HEAD | tar xC ${out}`; 78 // vendor Go dependencies 79 $`cd ${out} && go mod vendor`; 80 // build NPM-bound dependencies 81 $`cd ${out} && npm ci && npm run assets && rm -rf node_modules` 82 // write VERSION file 83 $`echo ${git.tag()} > ${out}/VERSION`; 84 }, 85 86 mkFilename: ({ name, version }) => `${name}-${version}`, 87});