www-apps/anubis: new package, add 1.16.0

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
This commit is contained in:
Anna (cybertailor) Vyalkova
2025-04-19 16:06:54 +05:00
parent acad9b8584
commit 079dd9ea75
5 changed files with 124 additions and 0 deletions

1
www-apps/anubis/Manifest Normal file
View File

@@ -0,0 +1 @@
DIST anubis-src-vendor-npm-1.16.0.tar.gz 5194724 BLAKE2B 7de4b65e86c7bcd2b909189bab3541f2d074877c59a2402e765e9733ae613c84c4e55819a2ea8f42d6c45af02cf55c47482c773ea1089607e075767021fdb135 SHA512 772547e0b9459d13ff3ac3bb86819e5803de1f12a8729b78cc4f50f69b16bbaddc94e3c329be5f1d2426688b3a8a4c05c1ac1039e953febb893faf9400d75475

View File

@@ -0,0 +1,49 @@
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit go-module systemd
DESCRIPTION="Weighs the soul of incoming HTTP requests to stop AI crawlers"
HOMEPAGE="
https://anubis.techaro.lol/
https://github.com/TecharoHQ/anubis
"
SRC_URI="https://github.com/TecharoHQ/anubis/releases/download/v${PV}/anubis-src-vendor-npm-${PV}.tar.gz"
S="${WORKDIR}/anubis-src-vendor-npm-${PV}"
LICENSE="Apache-2.0 BSD MIT OFL-1.1"
SLOT="0"
KEYWORDS="~amd64"
DOCS=(
# from yeetfile.js
README.md
docs/docs/CHANGELOG.md
docs/docs/admin/policies.md
docs/docs/admin/native-install.mdx
data/botPolicies.json
)
src_compile() {
emake prebaked-build
}
src_test() {
local -x DONT_USE_NETWORK=1
ego test ./... || die
}
src_install() {
dobin var/anubis
systemd_dounit run/anubis@.service
newinitd "${FILESDIR}"/anubis.initd anubis
newconfd "${FILESDIR}"/anubis.confd anubis
insinto /etc/anubis
doins run/default.env
einstalldocs
}

View File

@@ -0,0 +1,27 @@
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# The URL of the service that Anubis should forward valid requests to. Supports
# Unix domain sockets.
#ANUBIS_TARGET="http://localhost:3923"
#ANUBIS_TARGET="unix:///path/to/socket"
# The network address that Anubis listens on.
#
# If unset, listen on /run/anubis_${instance}/anubis.sock Unix socket instead.
#ANUBIS_BIND_PORT=":8923"
# The network address that Anubis serves Prometheus metrics on.
#
# If unset, listen on /run/anubis_${instance}/metrix.sock Unix socket instead.
#ANUBIS_METRICS_BIND_PORT=":9090"
# The difficulty of the challenge, or the number of leading zeroes that must be
# in successful responses.
#ANUBIS_DIFFICULTY=4
# Configure the user[:group] Anubis will run as.
#ANUBIS_USER="anubis:anubis"
# Additional command-line options for Anubis.
#ANUBIS_OPTS=""

View File

@@ -0,0 +1,31 @@
#!/sbin/openrc-run
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# shellcheck shell=sh
instance=${RC_SVCNAME#*.}
supervisor="supervise-daemon"
command="/usr/bin/anubis"
command_args="\
-bind ${ANUBIS_BIND_PORT:-/run/anubis_${instance?}/anubis.sock -bind-network unix} \
-metrics-bind ${ANUBIS_METRICS_BIND_PORT:-/run/anubis_${instance?}/metrics.sock -metrics-bind-network unix} \
-target ${ANUBIS_TARGET:-http://localhost:3923} \
-difficulty ${ANUBIS_DIFFICULTY:-4} \
${ANUBIS_OPTS}
"
command_user="${ANUBIS_USER:-anubis:anubis}"
command_background=1
pidfile="/run/anubis_${instance?}/anubis.pid"
start_pre() {
if [ "${instance?}" = "${RC_SVCNAME?}" ]; then
eerror "${RC_SVCNAME?} cannot be started directly. You must create"
eerror "symbolic links to it for the services you want to start"
eerror "and add those to the appropriate runlevels."
return 1
fi
checkpath -d -o "${command_user?}" "/run/anubis_${instance?}"
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>cyber+gentoo@sysrq.in</email>
<name>Anna</name>
</maintainer>
<longdescription>
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.
</longdescription>
<upstream>
<remote-id type="github">TecharoHQ/anubis</remote-id>
</upstream>
</pkgmetadata>