• T28 replaces the "开发中敬请期待" placeholder on dance.html's 传衣服
    tab with a real upload panel: file input, the live spend_garment price
    pulled from the new public GET /api/pricing (not hardcoded, per
    dev-plan-4.md's acceptance criterion), and a submit flow that POSTs to
    T27's /api/dance/upload-garment. Not logged in opens the existing T22
    login modal instead of failing silently; not email-verified shows an
    inline message; a 402 (insufficient balance) points at the new topup
    flow; success refreshes the balance and immediately polls the queue,
    same as the free wardrobe pick's own pollState() call.
    
    T29 adds a 充值 pill (visible once logged in) opening a tier picker
    built from GET /api/pricing's topup_tier entries, POSTing to T24's
    /api/credits/checkout and navigating to whatever URL comes back (the
    mock completion page today, Stripe's hosted Checkout once a real key
    lands tomorrow — both redirect back to dance.html?topup=success/
    cancelled). A one-shot banner reads that query param on load, then
    scrubs it via history.replaceState. The account button's own label
    now also shows creditBalance, riding on the field GET /api/auth/me
    already started returning in T24.
    
    Manually verified end to end against the live server (localhost:8934):
    register -> verify -> mock checkout -> balance updates in the header
    -> topup banner -> upload panel shows the live price and opens the
    login modal when logged out. The upload itself surfaced that
    production's one seed character had never been marked isDefault (see
    the preceding commit) — not a bug in this code, but blocked a live
    walk of the full generate path until fixed.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_011DUiYs6UjxDMkfvnjtsKFo
    yibo authored
     
    Browse File »
  • Reuses the existing nickname-modal/.nickname-box comic-panel look (a
    new .auth-error line and a plain-text auth-link-btn are the only new
    CSS) rather than inventing a second visual language. A "登录" topbar
    button opens the modal (email/password, toggle between login/
    register, cancel); once logged in it becomes "<nickname or email
    prefix> · 退出".
    
    Entirely optional, same as T19-T21 designed it: the modal's only
    trigger is that one button, nothing forces it open, and free browsing/
    voting keeps working on the plain viewer_uid cookie exactly as before.
    Manually verified end to end against the real running server (Chrome):
    register auto-logs in, an existing viewer_nickname cookie bound onto
    the new account and shown in the button, logout reverts the UI.
    
    auth-ui.test.js is a structural check (id/getElementById consistency,
    all four /api/auth/* endpoints wired, modal starts hidden) since no
    DOM/browser tooling is available to `node --test` here to render the
    pages for a full interaction test.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_011Deddn3sM3oQnmvqWSMb4y
    yibo authored
     
    Browse File »
  • Backend (server.js):
    - T11: dance.html gets its own schedule/queue state machine, persisted to
      dance-state.json (gitignored, same as live-state.json). Per MVCP M.8,
      the schedule stores videoId references rather than inlined clip
      snapshots like live's does, joining back to library.json at read time.
      Generalized pickBestIndexByStatus/extracted pickLeastPlayedClip so both
      channels' schedulers share the same selection logic instead of forking
      it; live's random-fill pool now excludes channel:"dance" clips (and
      vice versa) so the two channels' filler picks stay independent, which
      wasn't true before this (T8's dance clips could have leaked into
      live.html's filler).
    - T12: GET /api/dance/wardrobe — public, unauthenticated list of active
      garments.
    - T15: POST /api/dance/pick {garmentId, nickname?} — free path, always
      uses the configured default character, reuses submitGeneration (T8/T9)
      whole including its M.7 dedupe cache, then hands the result to
      danceQueue. In-flight generations are reconciled against generationJobs
      on each schedule tick rather than via a promise chain, so a pick
      request survives a server restart the same way T8's own jobs do.
    - T17: separate danceViewers map and POST /api/dance/queue/vote/:id, so
      viewer counts and votes don't mix with live.html's.
    - SCHEDULE_TICK_MS env var makes both channels' tick interval
      configurable so tests don't wait out a real 2s.
    
    Frontend:
    - dance.html (T13/T14/T16): reuses live.html's visual language via
      live.css, adds dance.css for the 9:16 boxed player and wardrobe grid.
      Left column is a 衣柜/传衣服/传人 tab set (only 衣柜 is wired up —
      the other two need accounts/credits, dev-plan-2.md 第三/四期); right
      column shows the queue with vote buttons instead of live.html's chat.
      Age-confirmation gate (5.1节) blocks the page on first visit via a
      cookie, non-dismissable by clicking the backdrop.
    
    Tests: dance-channel.test.js spins up a mock H3 Console (same approach
    as dressup-generate.test.js) to exercise wardrobe listing, pick
    rejection/happy-path/dedupe, vote, and independent viewer counts
    end to end.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    yibo authored
     
    Browse File »