necesse-server: 1.2.0-22728942 -> 1.2.0-23522718

add s3 server file caching via update script

(cherry picked from commit 638daaadb3)
This commit is contained in:
cr0n 2026-06-08 15:11:11 +02:00 committed by github-actions[bot]
commit 6952ffc485
2 changed files with 23 additions and 6 deletions

View file

@ -6,7 +6,7 @@
}:
let
version = "1.2.0-22728942";
version = "1.2.0-23522718";
urlVersion = lib.replaceStrings [ "." ] [ "-" ] version;
in
@ -15,8 +15,8 @@ stdenvNoCC.mkDerivation {
inherit version;
src = fetchzip {
url = "https://necessegame.com/content/server/${urlVersion}/necesse-server-linux64-${urlVersion}.zip";
hash = "sha256-kSBql3oHG368DczSM7FkWeAZcfTrNP1x31LX7HRrgTE=";
url = "https://necesse.pwn.sh/server/necesse-server-linux64-${urlVersion}.zip";
hash = "sha256-PIguTYULddLKj6PpoSvX3gNSvqrS7oRTOPuwoA0/XOc=";
};
# removing packaged jre since we use our own

View file

@ -3,13 +3,30 @@
set -eu -o pipefail
website=$(curl -sL https://necessegame.com/server)
version=$(
curl -s http://www.necessegame.com/server \
echo "$website" \
| pup 'a[href*="linux64"] text{}' \
| awk -F'[v ]' '/Linux64/ {print $4"-"$6}' \
| sort -Vu \
| tail -n1
)
[[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+\-[0-9]+$ ]] \
&& update-source-version necesse-server "$version"
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+\-[0-9]+$ ]]; then
version_url=${version//./-}
# extract the expiring presigned S3 URL for the new zip
url=$(
echo "$website" \
| pup "a[href*=\"linux64-${version_url}\"] attr{href}" \
| sed 's/\&/\&/g'
)
# call API to remote-fetch the zip immediately and keep it cached,
# then fetch the zip locally to get the SRI hash, then update.
# fails early if the zip cannot be remote-fetched / cached.
curl -s --fail-with-body "https://necesse.pwn.sh/cache.php?version=${version_url}" \
&& sri=$(nix-prefetch-url --unpack "$url" | xargs nix hash convert --hash-algo sha256 --to sri) \
&& update-source-version necesse-server "$version" "$sri"
fi