Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

Krea wallpaper (Val Town)

Currently stoppedwallpaper.cron.ts is a script (not cron) and has ENABLED = false. Flip both to resume.

Daily Krea 2 Large wallpaper generation, hosted on Val Town.

Pipeline (same as local generate.py):

  1. Submit Krea 2 Large job (style refs + moodboard)
  2. Poll until complete, then 2× upscale via Krea Enhance
  3. Upload to Supabase wallpapers/krea/ (+ latest.png alias)
  4. Email joshuacfang@gmail.com the iOS Shortcuts smart link

Krea jobs take minutes, so the cron uses a state machine across 15-minute ticks (Val Town's 10–60s execution limit can't hold a poll loop).

Deploy

Val: https://www.val.town/x/fang/kreaWallpaper/code/

export PATH="$HOME/.deno/bin:$PATH" export VAL_TOWN_API_KEY=$(grep '^VAL_API_KEY=' ../../../.env | cut -d= -f2-) cd src/wallpapers/val vt push # after local edits

Root .env uses VAL_API_KEY; the vt CLI expects VAL_TOWN_API_KEY (same token). KREA_API_KEY, SUPABASE_URL, and SUPABASE_SERVICE_ROLE_KEY are already set on the val.

Email to external addresses requires Val Town Pro.

In the Val Town UI for wallpaper.cron.ts, set schedule to */15 * * * * (every 15 min — minimum on free tier). Optional env vars on the val:

VariableNotes
WALLPAPER_THEMEDefault: fireworks and splendor for 4th of july
WALLPAPER_SHORTCUT_NAMEDefault: My Wallpaper
WALLPAPER_HOUR_PTEarliest PT hour to start daily job (default 8)

Manual test

Click Run on wallpaper.cron.ts in the Val Town editor. First tick either starts a job (if after WALLPAPER_HOUR_PT and not yet done today) or polls an in-progress job.

Local script

../generate.py remains for one-off runs from this machine. The Val Town job is the scheduled path.