Introduce SafeTemplates.Render to execute templates into a buffer and prevent partial HTML on errors. Replace direct ExecuteTemplate calls in partial handlers and add a make lint-templates target to catch bypasses. Update operator sites template/view model to use OwnerOrgName. Guard the FedWiki sync by skipping inserts when DefaultWorkspaceID is empty and scope deletes to the configured default workspace only.
38 lines
1.0 KiB
Makefile
38 lines
1.0 KiB
Makefile
# Makefile for building and pushing multi-arch Docker images
|
|
|
|
IMAGE_REPO = git.coopcloud.tech/wiki-cafe/member-console
|
|
DATE_TAG = $(shell date -u +%Y-%m-%dT%H-%MZ)
|
|
# PLATFORMS = linux/arm64,linux/amd64
|
|
PLATFORMS = linux/amd64
|
|
|
|
.PHONY: docker-push
|
|
|
|
docker-push:
|
|
docker buildx build \
|
|
--platform $(PLATFORMS) \
|
|
-t $(IMAGE_REPO):latest \
|
|
-t $(IMAGE_REPO):$(DATE_TAG) \
|
|
--push .
|
|
|
|
# Database migration targets
|
|
.PHONY: sqlc-generate
|
|
|
|
sqlc-generate:
|
|
cd internal/db && sqlc generate
|
|
|
|
# Build the application
|
|
.PHONY: build
|
|
build:
|
|
go build -o member-console .
|
|
|
|
# Lint: ensure no handler bypasses SafeTemplates by writing directly to ResponseWriter.
|
|
# All template rendering must go through h.Templates.Render() — see internal/server/render.go.
|
|
.PHONY: lint-templates
|
|
lint-templates:
|
|
@if grep -rn '\.ExecuteTemplate(w,' internal/server/; then \
|
|
echo "ERROR: Direct ExecuteTemplate on ResponseWriter found. Use h.Templates.Render() instead."; \
|
|
exit 1; \
|
|
else \
|
|
echo "OK: No direct ExecuteTemplate on ResponseWriter detected."; \
|
|
fi
|