commit 7c41b4ff21d96712e1169236aebb4f1753701fe7 Author: Marko Zajc Date: Sat Feb 21 18:30:25 2026 +0100 Initial commit diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000000000..25e2c48d64aa3 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,15 @@ +pkgbase = nginx-mod-shapow + pkgdesc = Nginx module to keep bots out with a proof-of-work challenge + pkgver = 1.0 + pkgrel = 1 + url = https://git.zajc.tel/shapow.git/about + arch = x86_64 + license = AGPL-3.0-only + makedepends = nginx + makedepends = nginx-src + backup = etc/nginx/modules.d/19-shapow.conf + source = https://files.zajc.tel/public/builds/shapow/1.0/shapow-1.0.tar.xz + sha256sums = 254014a367e953cbe455395c783be3f8a5c514f90c7a2a7d2bf0c794d025502b + +pkgname = nginx-mod-shapow + depends = nginx diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000..b87c5e4be4423 --- /dev/null +++ b/LICENSE @@ -0,0 +1,12 @@ +Copyright Arch Linux Contributors + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/LICENSES/0BSD.txt b/LICENSES/0BSD.txt new file mode 120000 index 0000000000000..ea5b60640b01f --- /dev/null +++ b/LICENSES/0BSD.txt @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000000000..3ad8bc72ac2a6 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,59 @@ +# Maintainer: Marko Zajc + +pkgname=nginx-mod-shapow +pkgver=1.0 +pkgrel=1 + +_modname="${pkgname#nginx-mod-}" + +pkgdesc="Nginx module to keep bots out with a proof-of-work challenge" +arch=('x86_64') +makedepends=('nginx' 'nginx-src') +url="https://git.zajc.tel/shapow.git/about" +license=('AGPL-3.0-only') + +source=(https://files.zajc.tel/public/builds/$_modname/$pkgver/$_modname-$pkgver.tar.xz) +sha256sums=('254014a367e953cbe455395c783be3f8a5c514f90c7a2a7d2bf0c794d025502b') +backup=('etc/nginx/modules.d/19-shapow.conf') + +prepare() { + mkdir -p build + cd build + ln -sf /usr/src/nginx/auto + ln -sf /usr/src/nginx/src + + sed -i 's|^#define NGX_HTTP_SHAPOW_RESOURCE_ROOT .*|#define NGX_HTTP_SHAPOW_RESOURCE_ROOT "/usr/share/'$pkgname'"|' \ + "$srcdir/$_modname/src/config.h"; +} + +build() { + cd build + auto/configure \ + --with-ld-opt="$LDFLAGS" \ + --with-compat \ + --add-dynamic-module=../$_modname + make modules +} + +package() { + if [[ "$BUILDTOOL" == devtools ]]; then + local nginx_dep="nginx=$(nginx -v 2>&1 | sed 's|.*/||')" + depends+=($nginx_dep) + else + depends+=(nginx) + fi + + install -Dm644 "$srcdir"/$_modname/README.md "$pkgdir"/usr/share/licenses/$pkgname/README.md + install -Dm644 "$srcdir"/$_modname/screenshot.png "$pkgdir"/usr/share/licenses/$pkgname/screenshot.png + install -Dm644 "$srcdir"/$_modname/resources/challenge.html "$pkgdir"/usr/share/$pkgname/challenge.html + install -Dm644 "$srcdir"/$_modname/resources/challenge.css "$pkgdir"/usr/share/$pkgname/challenge.css + install -Dm644 "$srcdir"/$_modname/resources/challenge.js "$pkgdir"/usr/share/$pkgname/challenge.js + install -Dm644 "$srcdir"/$_modname/resources/challenge-worker.js "$pkgdir"/usr/share/$pkgname/challenge-worker.js + install -dm0755 "$pkgdir"/etc/nginx/modules.d + + cd build/objs + for mod in *.so; do + install -Dm755 $mod "$pkgdir"/usr/lib/nginx/modules/$mod + echo "load_module \"/usr/lib/nginx/modules/$mod\";" >> "$pkgdir/etc/nginx/modules.d/19-shapow.conf" + done +} diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 0000000000000..49e3625ad0e49 --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,25 @@ +version = 1 + +[[annotations]] +path = [ + "PKGBUILD", + "README.md", + "keys/**", + ".SRCINFO", + ".gitignore", + ".nvchecker.toml", + "*.install", + "*.sysusers", + "*sysusers.conf", + "*.tmpfiles", + "*tmpfiles.conf", + "*.logrotate", + "*.pam", + "*.service", + "*.socket", + "*.timer", + "*.desktop", + "*.hook", +] +SPDX-FileCopyrightText = "Arch Linux contributors" +SPDX-License-Identifier = "0BSD"