Files
raucao d846735b1e Crossfade the wallpaper only on intentional changes
Use a new bundled image for both the welcome screen and the dashboard
fallback, and crossfade into the first feed photo only when arriving from
the welcome screen or when the wallpaper changes after the first paint (a
live rotation or a manual pick). A plain open shows the resolved photo
outright, with no transition.

- wallpaper.gjs: three layers (bundled base, last settled photo, current
  photo). The current photo fades in on load and the previous one stays
  beneath for a crossfade; the photo layer renders only from the cached
  displayUrl, so a change fades instead of flashing the bundled base.
  Reduced motion settles instantly.
- photos.js: keep the last-known-good wallpaper on a cache miss or fetch
  error; add a one-shot timer that rotates at the day/week boundary while
  the dashboard stays open; expose animateEntry for the welcome entry.
- routes/index.js: set photos.animateEntry from the transition origin. A
  strict-mode route template's `this` is not the controller, so a
  controller property never reached the component.
- config/nostr.js: alias the welcome and fallback URLs to one image.

Tests and docs updated.
2026-11-10 15:18:13 +04:00

51 lines
2.2 KiB
JavaScript

// Nostr photo feeds. The protocol profile is documented in
// doc/nostr-photo-feeds.md. Keep these identifiers in sync with the published
// feed events and scripts/nostr/manifest.json.
export const NOSTR_RELAY_URL = 'wss://nostr.kosmos.org';
// Râu Cao (raucao@kosmos.org), the curator that publishes the official feeds.
export const NOSTR_PHOTO_CURATOR =
'1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb';
// Marks kind-30006 events that belong to the Dashtab photo-feed profile.
export const PHOTO_FEED_TAG = 'dashtab-photo-feed';
// Feed ids use a namespace so they cannot clash with other picture sets.
export const PHOTO_FEED_PREFIX = 'dt:';
export const NATURE_FEED_ID = 'dt:nature';
export const CITY_NIGHTS_FEED_ID = 'dt:city-nights';
// Nature is the default feed. City Nights is available but opt-in.
export const DEFAULT_ENABLED_FEED_IDS = [NATURE_FEED_ID];
// Bundled image shared by the welcome screen and the dashboard fallback, shown
// while the first feed photo is fetched and cached. The welcome -> dashboard
// crossfade fades from this image, so the two must stay identical.
const BUNDLED_WALLPAPER_URL =
'/img/wallpapers/manu-schwendener-DSwBHyWKiVw-unsplash.jpg';
export const WELCOME_WALLPAPER_URL = BUNDLED_WALLPAPER_URL;
// Shown on the dashboard until a cached feed original is available; the
// wallpaper crossfades from it into the first photo once that is cached.
export const FALLBACK_WALLPAPER_URL = BUNDLED_WALLPAPER_URL;
// Storage.
export const PHOTO_STORAGE_NAMESPACE = 'photos';
export const PHOTO_PREFERENCES_NAMESPACE = 'preferences';
export const PHOTO_CONFIG_KEY = 'photos.config';
export const PHOTO_CACHE_NAME = 'dashtab-photo-cache-v1';
export const PHOTO_CACHE_ORIGIN = 'https://dashtab.local';
// Protocol/query limits.
export const NOSTR_QUERY_TIMEOUT = 10_000;
export const PHOTO_ID_CHUNK_SIZE = 300;
export const PHOTO_PREFETCH_ORIGINAL_COUNT = 3;
// Rotation defaults to weekly. Bump ROTATION_VERSION when the persisted shape
// changes so legacy configs can be migrated intentionally.
export const DEFAULT_ROTATION = 'weekly';
export const ROTATION_MODES = ['weekly', 'daily', 'off'];
export const ROTATION_VERSION = 2;