From 3d87972edfdb1b3f78fa22982519ac02818df7ae Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 31 Mar 2025 12:33:35 +0800 Subject: [PATCH] Serve tarball of source rather than using individual source files --- .gitignore | 1 + Makefile | 9 ++++++--- resources.go | 11 +---------- templates/_footer.tmpl | 2 +- diff --git a/.gitignore b/.gitignore index c6e998b5f8e08e39bbb5fdf6c4af6ef6f401bc62..c1935f4a0e1d59a9806412d5b4e2aafb164f5d81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /forge /version.go /vendor +/source.tar.gz diff --git a/Makefile b/Makefile index 3783d4f6c19255c82d313315d47b0a68e9b68af8..4344a99556c24c95769b44f4c07f1c8109213a0b 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,12 @@ # SPDX-License-Identifier: AGPL-3.0-only # SPDX-FileContributor: Runxi Yu -.PHONY: clean version.go man +.PHONY: clean version.go man source.tar.gz CFLAGS = -Wall -Wextra -Werror -pedantic -std=c99 -D_GNU_SOURCE MAN_PAGES = forge.5 hookc.1 -forge: version.go hookc/*.c hookc/hookc man # TODO - go mod vendor +forge: source.tar.gz version.go hookc/*.c hookc/hookc man # TODO go build . man: $(MAN_PAGES:%=man/%.html) $(MAN_PAGES:%=man/%.txt) @@ -28,3 +27,7 @@ clean: $(RM) forge version.go vendor +source.tar.gz: + rm -f source.tar.gz + go mod vendor + git ls-files -z | xargs -0 tar -czf source.tar.gz vendor diff --git a/resources.go b/resources.go index 54ff7522a0237b548d4b3404de3d1e409c41d35b..b0db7ee16ad5ee74d478043b57dd5fa3b1c92002 100644 --- a/resources.go +++ b/resources.go @@ -13,16 +13,7 @@ "github.com/tdewolff/minify/v2" "github.com/tdewolff/minify/v2/html" ) -// We embed all source for easy AGPL compliance. -// -//go:embed .gitignore .gitattributes -//go:embed LICENSE README.md -//go:embed *.go go.mod go.sum -//go:embed *.scfg -//go:embed Makefile -//go:embed static/* templates/* scripts/* sql/* man/* -//go:embed hookc/*.c -//go:embed vendor/* +//go:embed LICENSE source.tar.gz var sourceFS embed.FS var sourceHandler = http.StripPrefix( diff --git a/templates/_footer.tmpl b/templates/_footer.tmpl index 4971694c8977e7956e8099540ebc7f9332818a9e..43611f51b54d353e187ffee846d9de5df90f8637 100644 --- a/templates/_footer.tmpl +++ b/templates/_footer.tmpl @@ -5,7 +5,7 @@ */}} {{- define "footer" -}} Lindenii Forge {{ .global.forge_version }} -(source, +(source, upstream, license) {{- end -}} -- 2.48.1