summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-17 23:21:03 +0300
committerPaul Buetow <paul@buetow.org>2026-06-17 23:21:03 +0300
commit61890e0bd98262a55b3afff495ebfead33d76b96 (patch)
tree9422f31856e205f6e9374a14c5205027f912d458 /src
parent7c94be57437ecdc9cadeb95bc4c26a25040163a9 (diff)
Add configurable SOURCE_URL footer link; release 0.9.00.9.0
The footer "Site generated ... with <link>" was hardcoded to the shuriken.sh repository. Make it configurable via the SOURCE_URL config variable and the --source-url CLI flag (defaulting to the shuriken.sh repo, so existing sites are unchanged). The footer derives the displayed text from the URL by stripping its scheme. Plumbed through apply_config_defaults, CLI override targets/spec, --print-config, the verbose effective-config log, and the header template's new render_source_url_html (config_html) render var. Documented in shuriken.default.conf and README; added a generation test asserting a custom SOURCE_URL replaces the default footer link, and updated the print-config and header render-var-subset expectations. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/action.source.sh1
-rw-r--r--src/lib/config.print.source.sh1
-rw-r--r--src/lib/config.source.sh5
-rw-r--r--src/lib/template.source.sh5
-rw-r--r--src/shuriken.default.conf6
-rwxr-xr-xsrc/shuriken.sh2
6 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/action.source.sh b/src/lib/action.source.sh
index 918900f..36fef40 100644
--- a/src/lib/action.source.sh
+++ b/src/lib/action.source.sh
@@ -155,6 +155,7 @@ log_configured_action() {
log_verbose "Effective output directory: ${DIST_DIR:-}"
log_verbose "Effective template directory: ${TEMPLATE_DIR:-}"
log_verbose "Effective favicon: ${FAVICON:-(bundled default)}"
+ log_verbose "Effective source URL: $SOURCE_URL"
log_verbose "Effective image jobs: $IMAGE_JOBS"
log_verbose "Effective ImageMagick timeout: ${IMAGEMAGICK_TIMEOUT}s"
log_verbose "Effective tar timeout: ${TAR_TIMEOUT}s"
diff --git a/src/lib/config.print.source.sh b/src/lib/config.print.source.sh
index c5fe2b4..b886f8b 100644
--- a/src/lib/config.print.source.sh
+++ b/src/lib/config.print.source.sh
@@ -28,6 +28,7 @@ print_config() {
print_shell_assignment DIST_DIR "$DIST_DIR"
print_shell_assignment TEMPLATE_DIR "$TEMPLATE_DIR"
print_shell_assignment FAVICON "$FAVICON"
+ print_shell_assignment SOURCE_URL "$SOURCE_URL"
print_shell_assignment TITLE "$TITLE"
print_shell_assignment HEIGHT "$HEIGHT"
print_shell_assignment THUMBHEIGHT "$THUMBHEIGHT"
diff --git a/src/lib/config.source.sh b/src/lib/config.source.sh
index c13e807..c3c0731 100644
--- a/src/lib/config.source.sh
+++ b/src/lib/config.source.sh
@@ -39,6 +39,11 @@ apply_config_defaults() {
ORIGINAL_BASEPATH="${ORIGINAL_BASEPATH:-}"
RANDOM_SEED="${RANDOM_SEED:-}"
SHUFFLE="${SHUFFLE:-no}"
+ # SOURCE_URL is the project/source link shown in the page footer ("Site
+ # generated ... with <SOURCE_URL>"). Defaults to the shuriken.sh repo;
+ # override it per site (e.g. to the album's own repo) via config or
+ # --source-url. The footer derives the displayed text from the URL itself.
+ SOURCE_URL="${SOURCE_URL:-https://codeberg.org/snonux/shuriken.sh}"
SPLASH_PAGE="${SPLASH_PAGE:-yes}"
STATS_PAGE="${STATS_PAGE:-yes}"
SYNC_DELETE="${SYNC_DELETE:-yes}"
diff --git a/src/lib/template.source.sh b/src/lib/template.source.sh
index b5d3ad4..398e17d 100644
--- a/src/lib/template.source.sh
+++ b/src/lib/template.source.sh
@@ -190,6 +190,7 @@ declare -ra TEMPLATE_RENDER_FIELD_SPECS=(
'render_preview_thumbs_html|context_raw|preview_thumbs|preview_thumbs|previewpage'
'render_redirect_page_html|context_html|redirect_page|redirect_page|redirect'
'render_show_header_bar|context_raw|show_header_bar|show_header_bar|header'
+ 'render_source_url_html|config_html|SOURCE_URL||header'
'render_stats_body_html|context_raw|stats_body|stats_body|stats'
'render_stats_page_html|config_html|STATS_PAGE||header'
'render_tarball_include|tarball_include|||footer'
@@ -605,6 +606,10 @@ prepare_template_render_var__config_html() {
ORIGINAL_BASEPATH)
context_value="$ORIGINAL_BASEPATH"
;;
+ SOURCE_URL)
+ # Always defaulted by apply_config_defaults (footer credit link).
+ context_value="${SOURCE_URL:-}"
+ ;;
STATS_PAGE)
# Always defaulted by apply_config_defaults; degrade to
# "no" (link hidden) if somehow unset so the header bar
diff --git a/src/shuriken.default.conf b/src/shuriken.default.conf
index d71ef8e..38d070e 100644
--- a/src/shuriken.default.conf
+++ b/src/shuriken.default.conf
@@ -32,6 +32,12 @@ TEMPLATE_DIR=/usr/share/shuriken/templates/default
# shuriken favicon. Can also be set with --favicon PATH.
#FAVICON=$(pwd)/my-favicon.ico
+# Source/project link shown in the page footer ("Site generated ... with <URL>").
+# Defaults to the shuriken.sh repository; point it at your own album's repo if you
+# like. The displayed text is the URL without its scheme. Can also be set with
+# --source-url URL.
+#SOURCE_URL=https://codeberg.org/snonux/shuriken.sh
+
# Includes a .tar of the incoming dir in the dist, can be yes or no
TARBALL_INCLUDE=yes
TARBALL_SUFFIX=.tar
diff --git a/src/shuriken.sh b/src/shuriken.sh
index 75f79cb..de53d56 100755
--- a/src/shuriken.sh
+++ b/src/shuriken.sh
@@ -40,6 +40,7 @@ declare -ra CLI_CONFIG_OVERRIDE_TARGETS=(
IMAGE_JOBS
RANDOM_SEED
SHUFFLE
+ SOURCE_URL
SPLASH_PAGE
STATS_PAGE
SYNC_DELETE
@@ -48,6 +49,7 @@ declare -ra CLI_CONFIG_OVERRIDE_TARGETS=(
declare -Ar CLI_OPTION_SPEC=(
[--config]='kind=value target=SHURIKEN_CLI_CONFIG_FILE argument=path'
[--favicon]='kind=value config=FAVICON argument=path'
+ [--source-url]='kind=value config=SOURCE_URL argument=url'
[--incoming]='kind=value config=INCOMING_DIR'
[--dist]='kind=value config=DIST_DIR'
[--template]='kind=value config=TEMPLATE_DIR'