feat: add multi-user support for favorites management and room clock synchronization

- Implemented a new API endpoint for retrieving and managing user favorites in /api/users.
- Added functionality for admins to edit the shared "main" user's favorites.
- Created a one-shot DB smoke test script for verifying multi-user kiosk migrations.
- Introduced a RoomClock class for synchronizing server time across clients using WebSocket.
This commit is contained in:
Marco Mooren
2026-05-13 13:53:12 +02:00
parent f6cdfd975c
commit 29423288ca
41 changed files with 4229 additions and 275 deletions

View File

@@ -213,6 +213,24 @@ textarea {
opacity: 0.65;
}
/* "Join group audio" affordance — pulses gently when a tap will silently
join the room's current stream without broadcasting a new command. */
.btn-play.cta-join {
animation: cta-pulse 1.8s ease-in-out infinite;
}
@keyframes cta-pulse {
0%,
100% {
box-shadow: 0 4px 12px var(--accent-glow);
}
50% {
box-shadow: 0 4px 22px var(--accent-glow), 0 0 0 6px rgba(255, 122, 61, 0.12);
}
}
.btn-stop {
background: var(--bg-2);
color: var(--muted);
@@ -313,47 +331,210 @@ textarea {
align-items: center;
}
/* Room sync pill: room picker + peer count + here/follow mode toggle. */
/* Group + listening-mode pill. Left half = group picker; right half = a
segmented Solo / Linked / Remote selector with a sliding indicator. */
.room-pill {
display: inline-flex;
align-items: center;
align-items: stretch;
gap: 6px;
padding: 4px 8px;
padding: 4px;
height: 36px;
background: var(--bg-2);
border: 1px solid var(--line);
border-radius: 999px;
font-size: 12px;
}
.room-pill .room-icon { opacity: .7; }
.room-pill .room-select {
.room-pill .rp-group {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 0 10px 0 8px;
border-right: 1px solid var(--line);
}
.room-pill .rp-group-icon {
opacity: .8;
}
.room-pill .rp-group-select {
background: transparent;
color: var(--fg);
border: none;
outline: none;
font-size: 12px;
max-width: 140px;
}
.room-pill .room-peers {
color: var(--muted-2);
font-variant-numeric: tabular-nums;
min-width: 18px;
text-align: center;
}
.room-pill .room-mode {
height: 26px;
padding: 0 10px;
border-radius: 999px;
border: 1px solid var(--line);
background: var(--bg-1);
color: var(--fg);
font-size: 11px;
cursor: pointer;
}
.room-pill .room-mode.follow-room {
background: linear-gradient(180deg, rgba(255, 122, 61, 0.18), rgba(255, 122, 61, 0.08));
.room-pill .rp-peers {
color: var(--muted-2);
font-variant-numeric: tabular-nums;
min-width: 14px;
text-align: center;
background: var(--bg-1);
border-radius: 999px;
padding: 1px 6px;
}
.mode-pill {
position: relative;
display: inline-flex;
align-items: stretch;
background: var(--bg-1);
border-radius: 999px;
padding: 2px;
isolation: isolate;
}
.mode-pill .mode-indicator {
position: absolute;
top: 2px;
bottom: 2px;
left: 2px;
width: calc((100% - 4px) / 2);
border-radius: 999px;
background: linear-gradient(180deg, rgba(255, 122, 61, 0.28), rgba(255, 122, 61, 0.12));
border: 1px solid rgba(255, 122, 61, 0.35);
transition: transform 180ms cubic-bezier(.4, 0, .2, 1);
z-index: 0;
}
.mode-pill .mode-indicator.pos-solo {
transform: translateX(0%);
}
.mode-pill .mode-indicator.pos-synced {
transform: translateX(100%);
}
.mode-pill .mode-seg {
position: relative;
z-index: 1;
display: inline-flex;
align-items: center;
gap: 4px;
padding: 0 10px;
height: 26px;
background: transparent;
border: none;
color: var(--muted-2);
font-size: 11px;
font-weight: 500;
cursor: pointer;
border-radius: 999px;
transition: color 120ms ease;
white-space: nowrap;
}
.mode-pill .mode-seg:hover {
color: var(--fg);
}
.mode-pill .mode-seg.on {
color: var(--accent-2);
border-color: rgba(255, 122, 61, 0.30);
}
.mode-pill .mode-seg-icon {
font-size: 13px;
line-height: 1;
}
.mode-pill .mode-seg-label {
letter-spacing: 0.02em;
}
@media (max-width: 720px) {
.mode-pill .mode-seg-label {
display: none;
}
.mode-pill .mode-seg {
padding: 0 8px;
}
}
/* Cross-client sync indicator (shown only in Linked mode). */
.sync-chip {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 0 10px;
height: 26px;
margin-left: 2px;
background: var(--bg-1);
border-radius: 999px;
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--muted-2);
transition: color 200ms ease, background 200ms ease;
}
.sync-chip .sync-dot {
font-size: 9px;
line-height: 1;
}
.sync-chip.sync-in-sync {
color: #67e08a;
background: rgba(103, 224, 138, 0.08);
}
.sync-chip.sync-catching-up,
.sync-chip.sync-lagging,
.sync-chip.sync-measuring {
color: #f0c460;
background: rgba(240, 196, 96, 0.08);
}
.sync-chip.sync-out-of-range,
.sync-chip.sync-no-anchor,
.sync-chip.sync-no-buffer {
color: var(--muted-2);
}
.sync-chip .sync-buffer {
-webkit-appearance: none;
appearance: none;
width: 70px;
height: 4px;
margin-left: 6px;
background: rgba(255, 255, 255, 0.18);
border-radius: 999px;
cursor: pointer;
}
.sync-chip .sync-buffer::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 12px;
height: 12px;
border-radius: 50%;
background: currentColor;
border: none;
}
.sync-chip .sync-buffer::-moz-range-thumb {
width: 12px;
height: 12px;
border-radius: 50%;
background: currentColor;
border: none;
}
@media (max-width: 720px) {
.sync-chip .sync-label {
display: none;
}
.sync-chip {
padding: 0 6px;
}
.sync-chip .sync-buffer {
width: 50px;
}
}
.search {
@@ -1501,4 +1682,124 @@ dialog.add-station select:focus {
.card.playing .score-badge {
border-color: var(--accent);
}
/* === Click-to-start gate modal === */
.play-gate-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.72);
backdrop-filter: blur(6px);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.play-gate-card {
background: var(--bg-2);
border: 1px solid var(--line);
border-radius: var(--radius-lg);
padding: 28px 32px;
min-width: 320px;
max-width: 480px;
box-shadow: var(--shadow-lg);
text-align: center;
}
.play-gate-title {
margin: 0 0 8px;
font-size: 20px;
}
.play-gate-station {
color: var(--accent);
font-weight: 600;
margin-bottom: 4px;
}
.play-gate-sub {
color: var(--muted);
font-size: 13px;
margin-bottom: 16px;
}
.play-gate-row {
display: flex;
gap: 12px;
justify-content: center;
margin-top: 18px;
}
.play-gate-start,
.play-gate-cancel {
padding: 10px 22px;
border-radius: var(--radius);
border: 1px solid var(--line);
background: var(--bg-3);
color: var(--fg);
font-size: 15px;
cursor: pointer;
}
.play-gate-start {
background: var(--accent);
border-color: var(--accent);
color: #07080b;
font-weight: 600;
}
.play-gate-start:hover {
filter: brightness(1.1);
}
.play-gate-cancel:hover {
background: var(--bg-1);
}
.play-gate-dismiss {
display: flex;
gap: 8px;
align-items: center;
justify-content: center;
margin-top: 14px;
color: var(--muted);
font-size: 12px;
cursor: pointer;
}
/* === Synced audio sub-toggle === */
.synced-audio-toggle {
display: inline-flex;
align-items: center;
gap: 6px;
background: var(--bg-1);
border: 1px solid var(--line);
border-radius: 999px;
padding: 4px 10px;
cursor: pointer;
user-select: none;
color: var(--muted);
font-size: 12px;
}
.synced-audio-toggle.on {
color: var(--fg);
border-color: rgba(255, 122, 61, 0.35);
}
.synced-audio-toggle input {
display: none;
}
.synced-audio-toggle .sa-icon {
font-size: 14px;
}
.vol.vol-master .vol-icon {
color: var(--accent);
}
.vol.vol-local {
opacity: 0.92;
}