diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-11 10:49:42 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-11 10:49:42 +0300 |
| commit | 4ec261d55e9d5b1f88f3a0a37a55d1cd699d193b (patch) | |
| tree | 3768b47e11d0c54113d2871abaa16220e2edffc0 | |
| parent | 1e7b394e56085a9cc33b8b8b64b094d5223e8853 (diff) | |
Copy favicon when refreshing splash
| -rwxr-xr-x | bin/photoalbum | 3 | ||||
| -rw-r--r-- | src/lib/album.source.sh | 3 | ||||
| -rwxr-xr-x | tests/cli.sh | 34 |
3 files changed, 38 insertions, 2 deletions
diff --git a/bin/photoalbum b/bin/photoalbum index 065793f..656d208 100755 --- a/bin/photoalbum +++ b/bin/photoalbum @@ -2268,7 +2268,8 @@ refresh_splash() { tmp_path=$(mktemp "$DIST_DIR/.index.html.XXXXXX") tmp_html=$(basename "$tmp_path") - if render_album_splash_page 'photos' '.' 'blurs' '.' "$tmp_html"; then + if render_album_splash_page 'photos' '.' 'blurs' '.' "$tmp_html" \ + && prepare_generation_site_assets; then mv "$DIST_DIR/$tmp_html" "$DIST_DIR/index.html" log_info "Refreshed splash page $(_display_path "$DIST_DIR/index.html")" return diff --git a/src/lib/album.source.sh b/src/lib/album.source.sh index 0f67396..704db34 100644 --- a/src/lib/album.source.sh +++ b/src/lib/album.source.sh @@ -949,7 +949,8 @@ refresh_splash() { tmp_path=$(mktemp "$DIST_DIR/.index.html.XXXXXX") tmp_html=$(basename "$tmp_path") - if render_album_splash_page 'photos' '.' 'blurs' '.' "$tmp_html"; then + if render_album_splash_page 'photos' '.' 'blurs' '.' "$tmp_html" \ + && prepare_generation_site_assets; then mv "$DIST_DIR/$tmp_html" "$DIST_DIR/index.html" log_info "Refreshed splash page $(_display_path "$DIST_DIR/index.html")" return diff --git a/tests/cli.sh b/tests/cli.sh index 2a71dba..7870a86 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -2456,6 +2456,37 @@ test_refresh_splash_rewrites_only_index_from_existing_assets() { test::teardown } +test_refresh_splash_copies_favicon_for_legacy_dist() { + local config_file + local output + local top_index_html + + test::setup + config_file="$TEST_TMPDIR/photoalbum.conf" + mkdir -p \ + "$TEST_TMPDIR/incoming" \ + "$TEST_TMPDIR/dist/photos" \ + "$TEST_TMPDIR/dist/blurs" + printf 'legacy photo\n' > "$TEST_TMPDIR/dist/photos/legacy.jpg" + printf 'legacy blur\n' > "$TEST_TMPDIR/dist/blurs/legacy.jpg" + test::write_album_config \ + "$config_file" "$TEST_TMPDIR/incoming" "$TEST_TMPDIR/dist" \ + 'Legacy refresh album' 40 + + output=$( + cd "$TEST_TMPDIR" + "$TEST_PHOTOALBUM" --refresh-splash + ) + + top_index_html=$(<"$TEST_TMPDIR/dist/index.html") + test::assert_contains 'Refreshed splash page' "$output" + test::assert_contains \ + '<link rel="icon" href="./favicon.ico" type="image/x-icon">' \ + "$top_index_html" + test::assert_file_exists "$TEST_TMPDIR/dist/favicon.ico" + test::teardown +} + test_refresh_splash_requires_existing_generated_assets() { local config_file local output @@ -3774,6 +3805,9 @@ main() { '--refresh-splash rewrites only root index from existing assets' \ test_refresh_splash_rewrites_only_index_from_existing_assets test::run_case \ + '--refresh-splash copies favicon for legacy dist' \ + test_refresh_splash_copies_favicon_for_legacy_dist + test::run_case \ '--refresh-splash requires existing generated assets' \ test_refresh_splash_requires_existing_generated_assets test::run_case \ |
