From 3d87972edfdb1b3f78fa22982519ac02818df7ae Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 31 Mar 2025 12:33:35 +0800 Subject: Serve tarball of source rather than using individual source files --- .gitignore | 1 + Makefile | 9 ++++++--- resources.go | 11 +---------- templates/_footer.tmpl | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index c6e998b..c1935f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /forge /version.go /vendor +/source.tar.gz diff --git a/Makefile b/Makefile index 3783d4f..4344a99 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 @@ version.go: 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 54ff752..b0db7ee 100644 --- a/resources.go +++ b/resources.go @@ -13,16 +13,7 @@ import ( "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 4971694..43611f5 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 -}} -- cgit v1.2.3