fffiloni's picture
Resolve feedback assets from the root static mount
d42577b verified
Raw History Blame Contribute Delete
92.6 kB
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>HF Radio MultiSource — Community Music</title> <style> [hidden] { display: none !important; } :root { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #f5f5f5; background: #09090e; } * { box-sizing: border-box; } body { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 5% 0%, rgba(120, 72, 255, 0.48), transparent 34%), radial-gradient(circle at 92% 95%, rgba(255, 120, 28, 0.34), transparent 31%), radial-gradient(circle at 45% 40%, rgba(120, 90, 255, 0.08), transparent 42%), linear-gradient(135deg, #101018, #050506 70%); } .app { position: relative; width: min(1120px, calc(100vw - 48px)); padding: 34px 40px 34px; border-radius: 30px; background: radial-gradient(circle at 10% 0%, rgba(125, 82, 255, 0.13), transparent 34%), radial-gradient(circle at 98% 100%, rgba(255, 120, 48, 0.13), transparent 36%), linear-gradient(135deg, rgba(34, 32, 45, 0.92), rgba(12, 14, 19, 0.92)); border: 1px solid rgba(170, 145, 255, 0.22); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.07); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); } .auth-corner { position: absolute; top: 34px; left: 54px; right: 48px; display: flex; gap: 10px; align-items: center; justify-content: space-between; z-index: 2; } .brand-label { display: inline-flex; align-items: center; gap: 11px; color: rgba(232, 216, 255, 0.98); font-size: 22px; font-weight: 900; letter-spacing: 0.155em; text-transform: uppercase; line-height: 1; white-space: nowrap; text-shadow: 0 0 20px rgba(165, 110, 255, 0.46), 0 0 42px rgba(165, 110, 255, 0.20); } .brand-label::before { content: ""; width: 10px; height: 10px; border-radius: 999px; background: #b991ff; box-shadow: 0 0 16px rgba(185, 145, 255, 0.90), 0 0 34px rgba(185, 145, 255, 0.36); } .auth-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; min-width: 0; } .auth-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.075); border: 1px solid rgba(255, 255, 255, 0.105); color: rgba(255, 255, 255, 0.90); text-decoration: none; font-size: 14px; font-weight: 750; line-height: 1; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045); transition: transform 120ms ease, background 120ms ease; } .auth-chip:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.11); } .auth-chip img { width: 24px; height: 24px; border-radius: 999px; object-fit: cover; display: block; background: rgba(255, 255, 255, 0.1); flex-shrink: 0; } .hero { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: auto 70px; column-gap: 34px; row-gap: 26px; align-items: start; margin-top: 58px; } .cover { grid-column: 1; grid-row: 1; width: 248px; aspect-ratio: 1 / 1; border-radius: 26px; object-fit: cover; background: rgba(255, 255, 255, 0.10); display: block; border: 1px solid rgba(255, 255, 255, 0.10); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.045); transition: opacity 220ms ease; will-change: opacity; } .content-top { grid-column: 2; grid-row: 1; min-width: 0; padding-top: 16px; } .eyebrow { margin: 0 0 12px; color: rgba(210, 183, 255, 0.94); font-size: 16px; font-weight: 760; letter-spacing: 0.125em; text-transform: uppercase; text-shadow: 0 0 18px rgba(160, 105, 255, 0.30); } h1 { margin: 0; color: #fff; font-size: clamp(36px, 4.5vw, 66px); line-height: 0.94; letter-spacing: -0.047em; font-weight: 850; overflow-wrap: normal; word-break: normal; max-width: 100%; max-height: 1.92em; overflow: hidden; transition: opacity 220ms ease, transform 220ms ease; will-change: opacity, transform; text-shadow: 0 12px 44px rgba(0, 0, 0, 0.28); } h1.single-line-title { white-space: nowrap; text-wrap: nowrap; max-height: none; } .track-text-fading { opacity: 0 !important; transform: translateY(4px); } .cover-fading { opacity: 0.56; } .visualizer { position: relative; width: 100%; height: 66px; margin: 0 0 12px; overflow: hidden; opacity: 0.84; } .track-progress { width: 100%; height: 4px; margin: -5px 0 14px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.075); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 0 18px rgba(185, 145, 255, 0.055); } .track-progress-fill { width: 0%; height: 100%; border-radius: inherit; background: linear-gradient( 90deg, rgba(185, 145, 255, 0.92), rgba(255, 150, 92, 0.92) ); box-shadow: 0 0 14px rgba(185, 145, 255, 0.20), 0 0 22px rgba(255, 150, 92, 0.10); transition: width 900ms linear; } body.is-loading-radio .cover { animation: loadingCoverFloat 3.8s ease-in-out infinite; } body.is-loading-radio #title { animation: loadingTitlePulse 2.4s ease-in-out infinite; } body.is-loading-radio .track-progress { background: rgba(255, 255, 255, 0.06); } body.is-loading-radio .track-progress-fill { width: 42% !important; animation: loadingProgressSweep 1.9s ease-in-out infinite; transition: none; } body.is-loading-radio #waveCanvas { opacity: 0.42; filter: drop-shadow(0 0 12px rgba(185, 145, 255, 0.16)); } .loading-status-word { display: inline-block; color: rgba(255, 255, 255, 0.76); animation: loadingTextPulse 1.8s ease-in-out infinite; } @keyframes loadingCoverFloat { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.01); } } @keyframes loadingTitlePulse { 0%, 100% { opacity: 0.86; text-shadow: 0 12px 44px rgba(0, 0, 0, 0.28); } 50% { opacity: 1; text-shadow: 0 12px 44px rgba(0, 0, 0, 0.28), 0 0 30px rgba(185, 145, 255, 0.16); } } @keyframes loadingProgressSweep { 0% { width: 8%; transform: translateX(-40%); } 50% { width: 54%; transform: translateX(58%); } 100% { width: 8%; transform: translateX(148%); } } @keyframes loadingTextPulse { 0%, 100% { opacity: 0.62; } 50% { opacity: 1; } } #waveCanvas { position: absolute; left: -6px; bottom: 0; width: 100%; height: 116px; display: block; transform: scaleY(0.40); transform-origin: bottom; } audio { display: none; } .live-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; margin-top: 0; } .live-meta { min-width: 0; color: rgba(255, 255, 255, 0.70); font-size: 14px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 999px; background: #ff4258; box-shadow: 0 0 16px rgba(255, 66, 88, 0.62); vertical-align: 1px; } .live-word { color: #ff4258; font-weight: 760; } .track-actions { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; } .icon-button { appearance: none; border: 0; width: auto; min-width: 42px; height: 34px; min-height: 34px; padding: 0 12px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: rgba(255, 255, 255, 0.075); border: 1px solid rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.93); font-size: 14px; font-weight: 900; line-height: 1; text-decoration: none; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); transition: transform 120ms ease, background 120ms ease, opacity 120ms ease; } .icon-button:hover:not(:disabled), .icon-button:hover:not(.disabled) { transform: translateY(-1px); background: rgba(255, 255, 255, 0.115); } .icon-button:disabled { cursor: default; opacity: 0.50; transform: none; } .icon-button.disabled { cursor: default; pointer-events: none; opacity: 0.50; transform: none; } .icon-button.like-button { min-width: 106px; white-space: nowrap; } .icon-button.like-button.liked { background: linear-gradient(135deg, rgba(255, 80, 140, 0.98), rgba(255, 120, 90, 0.98)); border-color: rgba(255, 255, 255, 0.20); color: #fff; box-shadow: 0 10px 34px rgba(255, 80, 140, 0.25); opacity: 1; } .icon-button.vote-button { min-width: 48px; } .icon-button.vote-button.voted { background: linear-gradient(135deg, rgba(185, 145, 255, 0.22), rgba(255, 255, 255, 0.085)); border-color: rgba(205, 170, 255, 0.32); color: #fff; box-shadow: 0 10px 28px rgba(160, 110, 255, 0.14); opacity: 1; } .icon-button.like-button:disabled { opacity: 1; } .icon-button.report-button { min-width: 42px; } .icon-button.report-button.reported { background: rgba(255, 120, 90, 0.14); border-color: rgba(255, 145, 110, 0.28); color: rgba(255, 210, 198, 0.96); opacity: 1; } .download-icon { width: 18px; height: 18px; display: block; } [data-tooltip] { position: relative; } [data-tooltip]::before { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%) translateY(4px); z-index: 30; width: max-content; max-width: 220px; padding: 8px 10px; border-radius: 11px; background: radial-gradient(circle at 15% 0%, rgba(185, 145, 255, 0.16), transparent 42%), rgba(18, 16, 24, 0.96); border: 1px solid rgba(220, 200, 255, 0.16); color: rgba(255, 255, 255, 0.90); font-size: 12px; font-weight: 700; line-height: 1.25; text-align: center; white-space: normal; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.055); opacity: 0; pointer-events: none; transition: opacity 130ms ease, transform 130ms ease; } [data-tooltip]::after { content: ""; position: absolute; left: 50%; bottom: calc(100% + 5px); transform: translateX(-50%) translateY(4px) rotate(45deg); z-index: 29; width: 8px; height: 8px; background: rgba(18, 16, 24, 0.96); border-right: 1px solid rgba(220, 200, 255, 0.16); border-bottom: 1px solid rgba(220, 200, 255, 0.16); opacity: 0; pointer-events: none; transition: opacity 130ms ease, transform 130ms ease; } [data-tooltip]:hover::before, [data-tooltip]:hover::after, [data-tooltip]:focus-visible::before, [data-tooltip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); } [data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { transform: translateX(-50%) translateY(0) rotate(45deg); } @media (hover: none) { [data-tooltip]::before, [data-tooltip]::after { display: none; } } .play-hero-button { grid-column: 1; grid-row: 2; width: 100%; min-height: 70px; padding: 0 24px; border-radius: 24px; justify-content: center; background: linear-gradient(135deg, rgba(168, 100, 255, 0.17), rgba(255, 255, 255, 0.065)); color: #fff; border: 1px solid rgba(190, 115, 255, 0.58); box-shadow: 0 16px 42px rgba(130, 70, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.075); font-size: 22px; font-weight: 900; letter-spacing: -0.01em; } .play-hero-button.primary { background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 238, 238, 0.94)); color: #111; border: 1px solid rgba(255, 255, 255, 0.60); box-shadow: 0 18px 44px rgba(255, 255, 255, 0.10), 0 14px 38px rgba(0, 0, 0, 0.22); } .play-hero-button.secondary { background: linear-gradient(135deg, rgba(180, 95, 255, 0.19), rgba(255, 255, 255, 0.075)); color: #fff; border: 1px solid rgba(205, 115, 255, 0.60); } .social-panel { grid-column: 2; grid-row: 2; height: 70px; min-width: 0; display: flex; flex-direction: column; justify-content: center; } .social-divider { width: 100%; height: 1px; margin: 0 0 14px; background: linear-gradient( 90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025) ); } .social-row { display: flex; align-items: center; gap: 18px; min-height: 38px; } .listener-icon { width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: baseline; justify-content: center; flex-shrink: 0; background: rgba(145, 105, 255, 0.16); border: 1px solid rgba(185, 145, 255, 0.21); color: rgba(230, 218, 255, 0.90); font-size: 21px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); } .player-listener-meta { color: rgba(255, 255, 255, 0.86); font-size: 15px; font-weight: 760; line-height: 1.2; white-space: nowrap; flex-shrink: 0; } button, .button-link { appearance: none; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 9px; transition: transform 120ms ease, background 120ms ease; box-sizing: border-box; text-decoration: none; border: 0; font-family: inherit; } button:hover:not(:disabled), .button-link:hover:not(.disabled) { transform: translateY(-1px); } button:disabled { cursor: default; transform: none; } .button-link.disabled, a.icon-button.disabled { cursor: default; transform: none; pointer-events: none; } .listener-avatars { display: flex; align-items: center; flex-shrink: 0; min-width: fit-content; } .listener-avatar { width: 38px; height: 38px; border-radius: 999px; object-fit: cover; background: rgba(255, 255, 255, 0.12); border: 2px solid rgba(16, 17, 22, 0.92); margin-left: -10px; display: block; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.26); } .listener-avatars a:first-child .listener-avatar { margin-left: 0; } .listener-extra { min-width: 38px; height: 38px; margin-left: -10px; padding: 0 9px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.86); background: rgba(255, 255, 255, 0.11); border: 2px solid rgba(16, 17, 22, 0.92); font-size: 13px; font-weight: 850; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.26); } .premium-section { position: relative; margin-top: 11px; border-radius: 17px; overflow: hidden; background: radial-gradient(circle at 0% 0%, rgba(150, 112, 255, 0.075), transparent 35%), radial-gradient(circle at 100% 100%, rgba(255, 120, 72, 0.035), transparent 45%), linear-gradient(135deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.030)); border: 1px solid rgba(210, 190, 255, 0.105); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 8px 26px rgba(0, 0, 0, 0.11); } .premium-section:first-of-type { margin-top: 28px; } .accordion { transition: opacity 220ms ease, transform 220ms ease; } .accordion summary, .debug-section summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 36px minmax(0, 1fr) 18px; gap: 13px; align-items: center; min-height: 52px; padding: 12px 15px 10px; user-select: none; } .accordion summary::-webkit-details-marker, .debug-section summary::-webkit-details-marker { display: none; } .section-icon { width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: rgba(225, 210, 255, 0.86); background: radial-gradient(circle at 35% 20%, rgba(190, 150, 255, 0.22), transparent 45%), rgba(120, 90, 255, 0.105); border: 1px solid rgba(190, 160, 255, 0.16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 6px 18px rgba(70, 40, 150, 0.11); font-size: 15px; line-height: 1; } .section-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; } .accordion-title { color: rgba(255, 255, 255, 0.84); font-size: 14.5px; font-weight: 820; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; } .accordion-title::before { content: none; } .section-chevron { width: 14px; height: 14px; position: relative; opacity: 0.64; transition: transform 150ms ease, opacity 150ms ease; } .section-chevron::before { content: ""; position: absolute; left: 3px; top: 2px; width: 6px; height: 6px; border-right: 3.6px solid rgba(255, 255, 255, 0.68); border-bottom: 3.6px solid rgba(255, 255, 255, 0.68); transform: rotate(45deg); transform-origin: center; } .accordion[open] .section-chevron, .debug-section[open] .section-chevron { transform: rotate(180deg); } .accordion-content { padding: 0 21px 12px 64px; margin-top: -7px; } .tags { display: flex; flex-wrap: wrap; gap: 0; min-height: 16px; margin: 0; transition: opacity 220ms ease, transform 220ms ease; will-change: opacity, transform; } .tag { padding: 0; border-radius: 0; background: transparent; color: rgba(218, 198, 255, 0.78); font-size: 19.5px; font-weight: 500; line-height: 1.32; opacity: 1; } .tag:not(:last-child)::after { content: "·"; margin: 0 7px; color: rgba(255, 255, 255, 0.30); opacity: 1; } .description-text { margin: 0; max-height: 78px; overflow: auto; color: rgba(255, 255, 255, 0.76); line-height: 1.38; font-size: 18px; font-style: italic; transition: opacity 220ms ease, transform 220ms ease; will-change: opacity, transform; } .lyrics-text { margin: 0; max-height: 200px; overflow: auto; white-space: pre-wrap; color: rgba(255, 255, 255, 0.80); font-size: 16px; line-height: 1.50; transition: opacity 220ms ease, transform 220ms ease; will-change: opacity, transform; margin: 20px 0; } .instrumental { font-style: italic; opacity: 0.58; } .cta-section { display: grid; grid-template-columns: 36px minmax(0, 1fr) 230px; gap: 13px; align-items: start; margin-top: 12px; padding: 14px 36px 14px 14px; border-radius: 18px; background: radial-gradient(circle at 100% 100%, rgba(255, 120, 48, 0.22), transparent 46%), radial-gradient(circle at 0% 0%, rgba(185, 145, 255, 0.11), transparent 35%), linear-gradient(135deg, rgba(255, 255, 255, 0.082), rgba(255, 120, 80, 0.070)); border: 1px solid rgba(255, 145, 72, 0.36); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.050), 0 10px 30px rgba(255, 110, 40, 0.085); } .cta-icon { align-self: start; margin-top: 1px; color: rgba(255, 198, 140, 0.88); background: radial-gradient(circle at 35% 20%, rgba(255, 196, 128, 0.24), transparent 45%), linear-gradient(135deg, rgba(255, 190, 120, 0.10), rgba(255, 135, 60, 0.12)); border-color: rgba(255, 165, 92, 0.22); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 22px rgba(255, 140, 70, 0.10), 0 0 24px rgba(255, 170, 95, 0.08); } .cta-icon svg { width: 16px; height: 16px; display: block; filter: drop-shadow(0 0 10px rgba(255, 193, 120, 0.24)) drop-shadow(0 0 18px rgba(255, 160, 90, 0.10)); } .cta-copy { min-width: 0; line-height: 1.32; } .cta-copy strong { display: block; margin-bottom: 4px; color: rgba(255, 255, 255, 0.94); font-size: 16px; font-weight: 880; letter-spacing: -0.025em; line-height: 1.1; } .cta-copy span { display: block; max-width: 720px; color: rgba(255, 255, 255, 0.74); font-size: 15px; line-height: 1.36; } .cta-copy-line + .cta-copy-line { margin-top: 2px; } .cta-link-button { align-self: center; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 15px; border-radius: 999px; color: #1c1110; text-decoration: none; background: radial-gradient(circle at 20% 0%, rgba(255, 247, 218, 0.60), transparent 48%), linear-gradient(135deg, #ffd1a1, #ff9a5f); border: 1px solid rgba(255, 220, 185, 0.42); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 12px 30px rgba(255, 120, 60, 0.18); font-size: 13px; font-weight: 920; line-height: 1; white-space: nowrap; transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease; } .cta-link-button:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.50), 0 14px 36px rgba(255, 130, 70, 0.24); } .cta-link-button::after { content: "↗"; font-size: 0.86em; line-height: 1; opacity: 0.82; } .next-refresh-text { display: inline-flex !important; align-items: center; gap: 8px; width: fit-content; margin-top: 20px; color: rgba(225, 209, 255, 0.78) !important; font-size: 16px !important; font-weight: 780; line-height: 1.25; letter-spacing: 0.012em; } .next-refresh-text::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: rgba(185, 145, 255, 0.96); box-shadow: 0 0 14px rgba(185, 145, 255, 0.76), 0 0 30px rgba(255, 145, 90, 0.18); flex-shrink: 0; } .debug-section { margin-top: 12px; border-radius: 14px; background: radial-gradient(circle at 0% 0%, rgba(130, 95, 255, 0.045), transparent 40%), rgba(255, 255, 255, 0.026); border: 1px solid rgba(180, 155, 255, 0.060); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 6px 18px rgba(0, 0, 0, 0.08); } .debug-section summary { grid-template-columns: 26px minmax(0, 1fr) 16px; gap: 10px; min-height: 38px; padding: 6px 12px; } .debug-section .section-icon { width: 24px; height: 24px; font-size: 12px; } .debug-section .accordion-title { font-size: 10px; letter-spacing: 0.09em; opacity: 0.74; } .debug-section .section-chevron { width: 12px; height: 12px; opacity: 0.52; } .debug-section .section-chevron::before { left: 3px; top: 3px; width: 5px; height: 5px; border-right-width: 1.4px; border-bottom-width: 1.4px; } .debug-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 12px 12px 48px; font-size: 11.5px; opacity: 0.68; } .debug-grid div { padding: 7px 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.045); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .debug-note { grid-column: 1 / -1; white-space: normal !important; line-height: 1.38; opacity: 0.72; } .message { margin: 64px 0 -32px; padding: 16px 18px; border-radius: 18px; background: radial-gradient(circle at 0% 0%, rgba(185, 145, 255, 0.08), transparent 36%), linear-gradient(135deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.068)); border: 1px solid rgba(255, 255, 255, 0.075); color: #fff; font-size: 15px; line-height: 1.45; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 16px 46px rgba(0, 0, 0, 0.12); } .message strong { display: block; margin-bottom: 3px; color: rgba(255, 255, 255, 0.95); font-weight: 850; } .message.error { background: rgba(255, 120, 120, 0.12); color: #ffd4d4; } @media (max-width: 1000px) { .app { width: min(920px, calc(100vw - 40px)); padding: 30px 30px 30px; } .auth-corner { top: 30px; left: 42px; right: 38px; } .brand-label { font-size: 15px; letter-spacing: 0.135em; } .auth-chip { min-height: 38px; padding: 8px 12px; font-size: 13px; } .hero { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 66px; column-gap: 28px; row-gap: 24px; margin-top: 56px; } .cover { width: 220px; border-radius: 24px; } .play-hero-button { min-height: 66px; border-radius: 22px; font-size: 21px; } .social-panel { height: 66px; } .content-top { padding-top: 12px; } .eyebrow { font-size: 15px; } h1 { font-size: clamp(34px, 4.4vw, 52px); } .message { margin-top: 58px; } } @media (max-width: 760px) { body { padding: 16px; } .app { width: min(100%, calc(100vw - 16px)); padding: 22px 18px 22px; border-radius: 24px; } .auth-corner { position: static; margin-bottom: 22px; justify-content: space-between; flex-wrap: wrap; } .message { margin: 0 0 18px; } .brand-label { width: 100%; font-size: 12px; letter-spacing: 0.12em; margin-bottom: 2px; } .auth-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; } .hero { grid-template-columns: 1fr; grid-template-rows: auto; gap: 16px; margin-top: 0; } .cover, .play-hero-button, .content-top, .social-panel { grid-column: auto; grid-row: auto; } .cover { order: 1; width: 100%; max-width: 320px; } .play-hero-button { order: 2; width: 100%; max-width: 320px; min-height: 64px; border-radius: 22px; font-size: 21px; } .content-top { order: 3; padding-top: 0; } .social-panel { order: 4; height: auto; } .eyebrow { font-size: 14px; margin-bottom: 8px; } h1 { font-size: clamp(31px, 9vw, 44px); line-height: 0.95; } .visualizer { height: 58px; margin: 10px 0 8px; } .track-progress { height: 4px; margin: -2px 0 13px; } #waveCanvas { height: 110px; transform: scaleY(0.40); } .live-row { align-items: flex-start; gap: 12px; } .live-meta { white-space: normal; font-size: 14px; } .track-actions { gap: 7px; } .icon-button { min-width: 40px; height: 34px; min-height: 34px; padding: 0 11px; font-size: 13px; border-radius: 12px; } .icon-button.like-button { min-width: 96px; white-space: nowrap; } .social-divider { margin: 12px 0 14px; } .social-row { gap: 12px; flex-wrap: wrap; } .listener-icon { width: 28px; height: 28px; font-size: 13px; } .player-listener-meta { font-size: 15px; } .listener-avatar { width: 32px; height: 32px; margin-left: -8px; } .listener-extra { min-width: 32px; height: 32px; margin-left: -8px; font-size: 12px; } .premium-section:first-of-type { margin-top: 24px; } .accordion summary { grid-template-columns: 34px minmax(0, 1fr) 18px; gap: 11px; min-height: 52px; padding: 10px 13px; } .section-icon { width: 30px; height: 30px; font-size: 14px; } .accordion-content { padding: 0 14px 13px 58px; margin-top: -6px; } .accordion-title { font-size: 11px; } .tag, .description-text, .lyrics-text { font-size: 12.5px; } .cta-section { grid-template-columns: 34px minmax(0, 1fr); gap: 11px; align-items: start; padding: 14px 13px; } .cta-copy strong { font-size: 14px; } .cta-copy span { font-size: 12.5px; } .cta-link-button { grid-column: 2; justify-self: start; width: fit-content; min-height: 36px; margin-top: 8px; padding: 0 13px; font-size: 12.5px; } .next-refresh-text { font-size: 12px !important; } .debug-section summary { grid-template-columns: 24px minmax(0, 1fr) 14px; min-height: 36px; padding: 6px 10px; } .debug-section .section-icon { width: 22px; height: 22px; font-size: 11px; } .debug-grid { grid-template-columns: 1fr; padding: 0 10px 10px 44px; font-size: 11px; } } .track-origin { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 12px 0 4px; color: rgba(255, 255, 255, .66); font-size: 12px; } .source-badge { display: inline-flex; align-items: center; max-width: 100%; padding: 5px 10px; border: 1px solid rgba(185, 145, 255, .32); border-radius: 999px; color: #e8d8ff; background: rgba(145, 105, 255, .12); text-decoration: none; font-weight: 750; overflow-wrap: anywhere; } .source-badge[href]:hover { background: rgba(145, 105, 255, .25); } .source-badge:focus-visible, .source-links a:focus-visible { outline: 2px solid #e8d8ff; outline-offset: 4px; } .source-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; min-width: 0; max-width: 260px; } .source-links .cta-link-button { font-size: 12px; padding: 10px 13px; max-width: 100%; white-space: normal; line-height: 1.3; } @media (max-width: 760px) { .source-links { grid-column: 2; width: 100%; max-width: none; justify-content: flex-start; } .track-origin { margin-top: 10px; } } </style> <link rel="stylesheet" href="/action-feedback.css?v=1" /> <script src="https://cdn.jsdelivr.net/gh/foobar404/wave.js/dist/bundle.js"></script> </head> <body> <main class="app"> <div id="message" class="message" hidden></div> <div class="auth-corner"> <div class="brand-label">HF Radio</div> <div class="auth-actions"> <a id="authButton" class="auth-chip" href="/oauth/huggingface/login"> Sign in </a> <a id="authProfile" class="auth-chip" href="#" target="_blank" rel="noopener noreferrer" hidden > <img id="authAvatar" alt="Profile avatar" /> <span id="authUsername"></span> </a> <a id="logoutButton" class="auth-chip" href="/oauth/huggingface/logout" hidden> Sign out </a> </div> </div> <section class="hero"> <img id="cover" class="cover" alt="Current track cover art" /> <div class="content-top"> <p class="eyebrow">Now Playing</p> <h1 id="title">Loading…</h1> <div id="trackOrigin" class="track-origin" hidden> <span id="trackSourceCaption">Generated with</span> <a id="trackSource" class="source-badge" target="_blank" rel="noopener noreferrer"></a> </div> <div class="visualizer"> <canvas id="waveCanvas"></canvas> </div> <div class="track-progress" aria-hidden="true"> <div id="trackProgressFill" class="track-progress-fill"></div> </div> <div class="live-row"> <div id="liveMeta" class="live-meta"> <span class="live-dot"></span><span class="live-word">Live</span> · loading tracks… </div> <div class="track-actions"> <button id="likeButton" class="icon-button like-button" disabled aria-label="Mark this song as a banger" data-tooltip="Only for absolute standouts" > ♡ Banger 0 </button> <button id="upvoteButton" class="icon-button vote-button upvote-button" disabled aria-label="Mark this song as radio-approved" data-tooltip="Plays well on radio" > ↑ 0 </button> <button id="downvoteButton" class="icon-button vote-button downvote-button" disabled aria-label="Mark this song as not great on air" data-tooltip="Not great on air" > ↓ 0 </button> <button id="reportButton" class="icon-button report-button" disabled aria-label="Report this song" data-tooltip="Report problematic track. HF PRO only" > ⚑ </button> <a id="downloadButton" class="icon-button disabled" href="#" target="_blank" rel="noopener noreferrer" aria-label="Download song" data-tooltip="Download this track" > <svg class="download-icon" viewBox="0 0 24 24" fill="none" aria-hidden="true"> <path d="M12 3v10.5m0 0 4-4m-4 4-4-4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M5 17.5v1.25A2.25 2.25 0 0 0 7.25 21h9.5A2.25 2.25 0 0 0 19 18.75V17.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" /> </svg> </a> </div> </div> </div> <button id="playToggleButton" class="primary play-hero-button" aria-label="Listen" title="Listen" > ▶ Listen </button> <div class="social-panel"> <div class="social-divider"></div> <div class="social-row"> <span class="listener-icon">♙</span> <span id="playerListenerMeta" class="player-listener-meta"> 0 listening now </span> <div id="listenerAvatars" class="listener-avatars" hidden></div> </div> </div> </section> <audio id="player" preload="none"></audio> <details id="trackDetailsAccordion" class="accordion premium-section" open> <summary> <span class="section-icon">♫</span> <span class="section-main"> <span class="accordion-title">Track details</span> <span id="tags" class="tags" hidden></span> </span> <span class="section-chevron" aria-hidden="true"></span> </summary> <div class="accordion-content"> <p id="description" class="description-text"></p> </div> </details> <details id="lyricsAccordion" class="accordion premium-section"> <summary> <span class="section-icon">▤</span> <span class="section-main"> <span class="accordion-title">Track Lyrics</span> </span> <span class="section-chevron" aria-hidden="true"></span> </summary> <div class="accordion-content"> <pre id="lyrics" class="lyrics-text instrumental">Instrumental</pre> </div> </details> <div class="cta premium-section cta-section"> <span class="section-icon cta-icon" aria-hidden="true"> <svg viewBox="0 0 24 24" fill="none"> <path d="M12 2.8L14.1 9.9L21.2 12L14.1 14.1L12 21.2L9.9 14.1L2.8 12L9.9 9.9L12 2.8Z" fill="url(#ctaSparkleMain)" /> <path d="M18.4 4.2L19 6L20.8 6.6L19 7.2L18.4 9L17.8 7.2L16 6.6L17.8 6L18.4 4.2Z" fill="url(#ctaSparkleSmall)" opacity="0.95" /> <defs> <linearGradient id="ctaSparkleMain" x1="6" y1="4" x2="18" y2="20" gradientUnits="userSpaceOnUse"> <stop stop-color="#FFE5B8" /> <stop offset="0.55" stop-color="#FFC37A" /> <stop offset="1" stop-color="#FF9F5A" /> </linearGradient> <linearGradient id="ctaSparkleSmall" x1="16" y1="4.2" x2="20.8" y2="9" gradientUnits="userSpaceOnUse"> <stop stop-color="#FFF2CF" /> <stop offset="1" stop-color="#FFBE77" /> </linearGradient> </defs> </svg> </span> <div class="cta-copy"> <strong>Your song could play next.</strong> <span class="cta-copy-line">Create and share a track with the community.</span> <span class="cta-copy-line">New songs get a shot every hour, and community votes help shape what comes back.</span> <span id="nextRefreshText" class="next-refresh-text"> Next mix refreshes soon </span> </div> <div id="sourceLinks" class="source-links" aria-label="Create music"> <a class="cta-link-button" href="https://huggingface.co/spaces/victor/MiniMax-Music3-Jam" target="_blank" rel="noopener noreferrer">Create with MiniMax Music 3</a> <a class="cta-link-button" href="https://huggingface.co/spaces/victor/ace-step-jam" target="_blank" rel="noopener noreferrer">Create with ACE-Step</a> </div> </div> <details class="debug premium-section debug-section"> <summary> <span class="section-icon debug-icon">☼</span> <span class="section-main"> <span class="accordion-title">Debug details</span> </span> <span class="section-chevron" aria-hidden="true"></span> </summary> <section class="debug-grid"> <div>Catalogs: <span id="bucket">—</span></div> <div>Tracks: <span id="trackCount">0</span></div> <div>Mode: <span id="mode">—</span></div> <div>Radio: <span id="serverState">—</span></div> <div>Live listeners: <span id="liveListeners">0</span></div> <div>Signed-in listeners: <span id="signedInListeners">0</span></div> <div>Index: <span id="index">—</span></div> <div>Server position: <span id="elapsed">0s</span></div> <div>Likes: <span id="likeCount">0</span></div> <div>Upvotes: <span id="upvoteCount">0</span></div> <div>Downvotes: <span id="downvoteCount">0</span></div> <div>Reports: <span id="reportCount">0</span></div> <div>Likes storage: <span id="likesState">—</span></div> <div class="debug-note"> Stream: <code>/stream.mp3</code>. Tracks are read from public Hugging Face buckets and transcoded server-side with ffmpeg. </div> </section> </details> </main> <script src="/action-feedback.js?v=1"></script> <script> const DEFAULT_COVER_URL = "https://huggingface.co/datasets/Chunte/Huggy/resolve/main/modern%20Huggies/Huggy%20Hi.png"; const HEARTBEAT_INTERVAL_MS = 10000; const TRACK_UI_SWITCH_DELAY_MS = 900; const TRACK_UI_FADE_OUT_MS = 180; const TRACK_UI_FADE_IN_DELAY_MS = 40; const LOADING_STATUS_STEPS = [ "scanning the community catalogs…", "reading track metadata…", "checking likes and reports…", "building the hourly mix…", "warming up the broadcast…" ]; const LOADING_STATUS_STEP_MS = 1800; const AUDIO_WATCHDOG_INTERVAL_MS = 4000; const AUDIO_STALLED_RECONNECT_SECONDS = 10; const AUDIO_MAX_DRIFT_SECONDS = 10; const AUDIO_RECONNECT_COOLDOWN_MS = 30000; const AUDIO_MIN_PLAYING_SECONDS_BEFORE_DRIFT_CHECK = 12; const VOTE_COOLDOWN_MS = 24 * 60 * 60 * 1000; const listenerId = crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`; const player = document.getElementById("player"); const waveCanvas = document.getElementById("waveCanvas"); const trackProgressFill = document.getElementById("trackProgressFill"); const cover = document.getElementById("cover"); const title = document.getElementById("title"); const trackOrigin = document.getElementById("trackOrigin"); const trackSource = document.getElementById("trackSource"); const trackSourceCaption = document.getElementById("trackSourceCaption"); const sourceLinks = document.getElementById("sourceLinks"); let renderedSourceLinks = null; const liveMeta = document.getElementById("liveMeta"); const playerListenerMeta = document.getElementById("playerListenerMeta"); const listenerAvatars = document.getElementById("listenerAvatars"); const trackDetailsAccordion = document.getElementById("trackDetailsAccordion"); const tags = document.getElementById("tags"); const description = document.getElementById("description"); const lyricsAccordion = document.getElementById("lyricsAccordion"); const lyrics = document.getElementById("lyrics"); const message = document.getElementById("message"); const authButton = document.getElementById("authButton"); const authProfile = document.getElementById("authProfile"); const authAvatar = document.getElementById("authAvatar"); const authUsername = document.getElementById("authUsername"); const logoutButton = document.getElementById("logoutButton"); const bucket = document.getElementById("bucket"); const trackCount = document.getElementById("trackCount"); const mode = document.getElementById("mode"); const index = document.getElementById("index"); const elapsed = document.getElementById("elapsed"); const serverState = document.getElementById("serverState"); const liveListeners = document.getElementById("liveListeners"); const signedInListeners = document.getElementById("signedInListeners"); const likeCount = document.getElementById("likeCount"); const upvoteCount = document.getElementById("upvoteCount"); const downvoteCount = document.getElementById("downvoteCount"); const reportCount = document.getElementById("reportCount"); const likesState = document.getElementById("likesState"); const playToggleButton = document.getElementById("playToggleButton"); const likeButton = document.getElementById("likeButton"); const upvoteButton = document.getElementById("upvoteButton"); const downvoteButton = document.getElementById("downvoteButton"); const reportButton = document.getElementById("reportButton"); const downloadButton = document.getElementById("downloadButton"); const nextRefreshText = document.getElementById("nextRefreshText"); const WAVE_DRAW_HEIGHT = 116; let currentTrackId = null; let currentUser = null; let renderedTrackKey = null; let pendingTrackKey = null; let pendingTrackStatus = null; let pendingTrackTimer = null; let userIsListening = false; let listenerHeartbeatTimer = null; let wave = null; let waveReady = false; let progressBaseElapsed = 0; let progressBaseDuration = 0; let progressBaseUpdatedAt = 0; let nextRefreshAtMs = null; let radioLoadingState = false; let audioWatchdogTimer = null; let playbackAnchorWallTime = 0; let playbackAnchorCurrentTime = 0; let lastPlayerCurrentTime = 0; let lastPlayerProgressAt = 0; let lastAudioReconnectAt = 0; let isAudioReconnecting = false; cover.src = DEFAULT_COVER_URL; cover.addEventListener("error", () => { if (cover.src !== DEFAULT_COVER_URL) { cover.src = DEFAULT_COVER_URL; } }); authAvatar.addEventListener("error", () => { authAvatar.src = DEFAULT_COVER_URL; }); async function getJSON(url, options = {}) { const res = await fetch(url, options); if (!res.ok) { const text = await res.text(); throw new Error(`HTTP ${res.status}: ${text}`); } return await res.json(); } function showMessage(html, isError = false) { message.hidden = false; message.innerHTML = html; message.classList.toggle("error", isError); } function hideMessage() { message.hidden = true; message.innerHTML = ""; message.classList.remove("error"); } function setTooltip(element, text) { if (!element) { return; } element.removeAttribute("title"); if (text) { element.setAttribute("data-tooltip", text); } else { element.removeAttribute("data-tooltip"); } } function setRadioLoadingState(isLoading) { radioLoadingState = Boolean(isLoading); document.body.classList.toggle("is-loading-radio", radioLoadingState); } function getLoadingStatusStep() { const stepIndex = Math.floor(Date.now() / LOADING_STATUS_STEP_MS) % LOADING_STATUS_STEPS.length; return LOADING_STATUS_STEPS[stepIndex]; } function renderLoadingLiveMeta() { liveMeta.innerHTML = '<span class="live-dot"></span><span class="live-word">Live</span> · ' + `<span class="loading-status-word">${getLoadingStatusStep()}</span>`; } function setTrackUiFading(isFading) { title.classList.toggle("track-text-fading", isFading); tags.classList.toggle("track-text-fading", isFading); description.classList.toggle("track-text-fading", isFading); lyrics.classList.toggle("track-text-fading", isFading); cover.classList.toggle("cover-fading", isFading); } function transitionToTrackStatus(status) { setTrackUiFading(true); window.setTimeout(() => { renderStatus(status, { forceTrackUpdate: true }); requestAnimationFrame(() => { requestAnimationFrame(() => { setTrackUiFading(false); }); }); }, TRACK_UI_FADE_OUT_MS); } function fitTitleToWidth() { const width = window.innerWidth; const isMobile = width <= 760; const isSmallEmbed = width <= 1100; const isTablet = width <= 1280; const maxFontSize = isMobile ? 48 : isSmallEmbed ? 50 : isTablet ? 58 : 66; const minSingleLineFontSize = isMobile ? 29 : isSmallEmbed ? 36 : isTablet ? 42 : 48; const twoLineMaxFontSize = isMobile ? 36 : isSmallEmbed ? 40 : isTablet ? 46 : 52; const minTwoLineFontSize = isMobile ? 25 : isSmallEmbed ? 30 : isTablet ? 34 : 38; const step = 2; const maxLines = 2; title.classList.add("single-line-title"); title.style.fontSize = `${maxFontSize}px`; let size = maxFontSize; while ( size > minSingleLineFontSize && title.scrollWidth > title.clientWidth ) { size -= step; title.style.fontSize = `${size}px`; } if (title.scrollWidth <= title.clientWidth) { return; } title.classList.remove("single-line-title"); title.style.fontSize = `${twoLineMaxFontSize}px`; size = twoLineMaxFontSize; let computed = window.getComputedStyle(title); let lineHeight = parseFloat(computed.lineHeight); let maxHeight = lineHeight * maxLines + 2; while ( size > minTwoLineFontSize && (title.scrollHeight > maxHeight || title.scrollWidth > title.clientWidth) ) { size -= step; title.style.fontSize = `${size}px`; computed = window.getComputedStyle(title); lineHeight = parseFloat(computed.lineHeight); maxHeight = lineHeight * maxLines + 2; } } async function loadCurrentUser() { try { const result = await getJSON("/api/me"); if (!result.authenticated || !result.user) { currentUser = null; authButton.hidden = false; authProfile.hidden = true; logoutButton.hidden = true; return; } const user = result.user; currentUser = user; authButton.hidden = true; authProfile.hidden = false; logoutButton.hidden = false; authProfile.href = user.profile_url || `https://huggingface.co/${user.username}`; authAvatar.src = user.avatar_url || DEFAULT_COVER_URL; authUsername.textContent = `@${user.username || "hf-user"}`; } catch (err) { console.warn("Could not load current HF user:", err); currentUser = null; authButton.hidden = false; authProfile.hidden = true; logoutButton.hidden = true; } } function resizeWaveCanvas() { const container = waveCanvas.parentElement; const rect = container.getBoundingClientRect(); if (!rect.width) { return; } waveCanvas.width = Math.floor(rect.width); waveCanvas.height = WAVE_DRAW_HEIGHT; } function setupWaveVisualizer() { if (waveReady) { return; } if (typeof Wave === "undefined") { console.warn("Wave.js is not loaded"); showMessage( "Audio visualizer could not load, but the radio can still play.", true ); return; } resizeWaveCanvas(); wave = new Wave(player, waveCanvas); wave.addAnimation( new wave.animations.Lines({ count: 72, lineWidth: 2, lineColor: "rgba(205, 185, 255, 0.78)", rounded: false, bottom: true }) ); waveReady = true; } window.addEventListener("resize", () => { fitTitleToWidth(); if (!waveReady) { return; } resizeWaveCanvas(); }); function updateListenerCountFromPayload(payload) { if (!payload || payload.active_listeners === undefined) { return; } liveListeners.textContent = payload.active_listeners; signedInListeners.textContent = payload.signed_in_listener_count ?? 0; updatePlayerListenerMetaFromCount(payload.active_listeners ?? 0); } async function notifyListenerStart() { const payload = await getJSON(`/api/listener/start/${listenerId}`, { method: "POST", }); updateListenerCountFromPayload(payload); } async function notifyListenerHeartbeat() { const payload = await getJSON(`/api/listener/heartbeat/${listenerId}`, { method: "POST", }); updateListenerCountFromPayload(payload); } async function notifyListenerStop() { const payload = await getJSON(`/api/listener/stop/${listenerId}`, { method: "POST", keepalive: true, }); updateListenerCountFromPayload(payload); } function sendBeaconListenerStop() { if (!navigator.sendBeacon) { fetch(`/api/listener/stop/${listenerId}`, { method: "POST", keepalive: true, }).catch(() => {}); return; } navigator.sendBeacon(`/api/listener/stop/${listenerId}`); } function startListenerHeartbeat() { stopListenerHeartbeat(); listenerHeartbeatTimer = setInterval(() => { if (!userIsListening) { return; } notifyListenerHeartbeat().catch((err) => { console.warn("Listener heartbeat failed:", err); }); }, HEARTBEAT_INTERVAL_MS); } function stopListenerHeartbeat() { if (listenerHeartbeatTimer) { clearInterval(listenerHeartbeatTimer); listenerHeartbeatTimer = null; } } window.addEventListener("pagehide", () => { if (userIsListening) { sendBeaconListenerStop(); } }); function likedStorageKey(trackId) { return `hf-radio-liked:${trackId}`; } function hasLiked(trackId) { return localStorage.getItem(likedStorageKey(trackId)) === "1"; } function markLiked(trackId) { localStorage.setItem(likedStorageKey(trackId), "1"); } function voteStorageKey(trackId) { return `hf-radio-vote:${trackId}`; } function getVoteRecord(trackId) { const raw = localStorage.getItem(voteStorageKey(trackId)); if (!raw) { return null; } if (raw === "up" || raw === "down") { const migratedRecord = { vote: raw, voted_at: 0, }; localStorage.setItem( voteStorageKey(trackId), JSON.stringify(migratedRecord) ); return migratedRecord; } try { const parsed = JSON.parse(raw); if ( !parsed || (parsed.vote !== "up" && parsed.vote !== "down") ) { localStorage.removeItem(voteStorageKey(trackId)); return null; } return { vote: parsed.vote, voted_at: Number(parsed.voted_at || 0), }; } catch { localStorage.removeItem(voteStorageKey(trackId)); return null; } } function voteIsStillActive(record) { if (!record || !record.voted_at) { return false; } return Date.now() - record.voted_at < VOTE_COOLDOWN_MS; } function getVote(trackId) { const record = getVoteRecord(trackId); if (!voteIsStillActive(record)) { return null; } return record.vote; } function markVote(trackId, vote) { localStorage.setItem( voteStorageKey(trackId), JSON.stringify({ vote, voted_at: Date.now(), }) ); } function clearVote(trackId) { localStorage.removeItem(voteStorageKey(trackId)); } function reportedStorageKey(trackId) { return `hf-radio-reported:${trackId}`; } function hasReported(trackId) { return localStorage.getItem(reportedStorageKey(trackId)) === "1"; } function markReported(trackId) { localStorage.setItem(reportedStorageKey(trackId), "1"); } function clearReported(trackId) { localStorage.removeItem(reportedStorageKey(trackId)); } function renderTags(trackTags) { tags.innerHTML = ""; if (!Array.isArray(trackTags) || trackTags.length === 0) { tags.hidden = true; return; } tags.hidden = false; trackTags.slice(0, 8).forEach((tag) => { const pill = document.createElement("span"); pill.className = "tag"; pill.textContent = String(tag); tags.appendChild(pill); }); } function renderListenerAvatars(profiles, totalSignedInCount = 0) { listenerAvatars.innerHTML = ""; if (!Array.isArray(profiles) || profiles.length === 0) { listenerAvatars.hidden = true; return; } listenerAvatars.hidden = false; profiles.slice(0, 8).forEach((profile) => { const link = document.createElement("a"); link.href = profile.profile_url || "#"; link.target = "_blank"; link.rel = "noopener noreferrer"; link.title = profile.username || "Hugging Face user"; const img = document.createElement("img"); img.className = "listener-avatar"; img.src = profile.avatar_url || DEFAULT_COVER_URL; img.alt = profile.username || "Listener"; img.addEventListener("error", () => { img.src = DEFAULT_COVER_URL; }); link.appendChild(img); listenerAvatars.appendChild(link); }); const hiddenCount = Math.max(0, totalSignedInCount - profiles.length); if (hiddenCount > 0) { const extra = document.createElement("span"); extra.className = "listener-extra"; extra.textContent = `+${hiddenCount}`; listenerAvatars.appendChild(extra); } } function updatePlayerListenerMetaFromCount(listenerCount) { const count = Number(listenerCount || 0); playerListenerMeta.textContent = count === 1 ? "1 listening now" : `${count} listening now`; } function updateTrackProgress(status = null) { if (status) { const duration = Number(status.track?.duration || 0); const elapsed = Number(status.elapsed || 0); if (!status.track || !Number.isFinite(duration) || duration <= 0) { progressBaseElapsed = 0; progressBaseDuration = 0; progressBaseUpdatedAt = Date.now(); trackProgressFill.style.width = "0%"; return; } progressBaseElapsed = Math.max(0, elapsed); progressBaseDuration = duration; progressBaseUpdatedAt = Date.now(); } if (!progressBaseDuration || progressBaseDuration <= 0) { trackProgressFill.style.width = "0%"; return; } const elapsedSinceStatus = (Date.now() - progressBaseUpdatedAt) / 1000; const currentElapsed = progressBaseElapsed + Math.max(0, elapsedSinceStatus); const progress = Math.max(0, Math.min(1, currentElapsed / progressBaseDuration)); trackProgressFill.style.width = `${progress * 100}%`; } function formatRemainingTime(totalSeconds) { const seconds = Math.max(0, Math.ceil(totalSeconds)); const hours = Math.floor(seconds / 3600); const minutes = Math.floor((seconds % 3600) / 60); const remainingSeconds = seconds % 60; if (hours > 0) { return `${hours}h ${minutes}m`; } if (minutes > 0) { return `${minutes}m ${remainingSeconds}s`; } return `${remainingSeconds}s`; } function renderNextRefreshText() { if (!nextRefreshText) { return; } if (!nextRefreshAtMs || !Number.isFinite(nextRefreshAtMs)) { nextRefreshText.textContent = "Next mix refreshes at the top of the hour"; return; } const remainingMs = nextRefreshAtMs - Date.now(); if (remainingMs <= 0) { nextRefreshText.textContent = "Next mix refreshes soon"; return; } nextRefreshText.textContent = `Next mix refreshes in ${formatRemainingTime(remainingMs / 1000)}`; } function updateNextRefresh(status) { if (!status || !status.next_refresh_at) { nextRefreshAtMs = null; renderNextRefreshText(); return; } const parsed = Date.parse(status.next_refresh_at); if (!Number.isFinite(parsed)) { nextRefreshAtMs = null; } else { nextRefreshAtMs = parsed; } renderNextRefreshText(); } function updateLiveMeta(status) { const tracks = status.track_count ?? 0; if (!status.track && status.is_loading) { renderLoadingLiveMeta(); return; } if (!status.track) { liveMeta.innerHTML = '<span class="live-dot"></span><span class="live-word">Live</span> · waiting for tracks'; return; } const trackLabel = tracks === 1 ? "track" : "tracks"; liveMeta.innerHTML = `<span class="live-dot"></span><span class="live-word">Live</span> · ${tracks} ${trackLabel} selected until the next hourly refresh`; } function updatePlayerListenerMeta(status) { updatePlayerListenerMetaFromCount(status.active_listeners ?? 0); } function updatePlayButton() { if (userIsListening && !player.paused) { playToggleButton.textContent = "■ Stop"; playToggleButton.classList.remove("primary"); playToggleButton.classList.add("secondary"); playToggleButton.setAttribute("aria-label", "Stop listening"); playToggleButton.setAttribute("title", "Stop listening"); } else { playToggleButton.textContent = "▶ Listen"; playToggleButton.classList.remove("secondary"); playToggleButton.classList.add("primary"); playToggleButton.setAttribute("aria-label", "Listen"); playToggleButton.setAttribute("title", "Listen"); } } function setActionButtonContent(button, icon, label = "") { let iconElement = button.querySelector(".radio-action-icon"); let labelElement = button.querySelector(".radio-action-label"); if (!iconElement || !labelElement) { iconElement = document.createElement("span"); iconElement.className = "radio-action-icon"; iconElement.setAttribute("aria-hidden", "true"); labelElement = document.createElement("span"); labelElement.className = "radio-action-label"; button.replaceChildren(iconElement, labelElement); } iconElement.textContent = icon; labelElement.textContent = label; labelElement.hidden = !label; } function playActionFeedback(kind, trackId) { if (!currentUser || currentTrackId !== trackId) return; const button = { banger: likeButton, up: upvoteButton, down: downvoteButton, report: reportButton }[kind]; try { window.RadioActionFeedback?.play(button, kind); } catch (error) { // Optional visuals must never turn a saved vote into an apparent error. console.warn("Action feedback unavailable:", error); } } function updateLikeButton(track) { if (!track || !track.id) { likeButton.disabled = true; likeButton.classList.remove("liked"); setActionButtonContent(likeButton, "♡", "Banger 0"); likeButton.setAttribute("aria-label", "Banger unavailable"); setTooltip(likeButton, "Banger unavailable"); likeCount.textContent = "0"; return; } const count = Number(track.like_count || 0); likeCount.textContent = String(count); if (!currentUser) { likeButton.disabled = true; likeButton.classList.remove("liked"); setActionButtonContent(likeButton, "♡", `Banger ${count}`); likeButton.setAttribute("aria-label", "Sign in with Hugging Face to mark this song as a banger"); setTooltip(likeButton, "Sign in with Hugging Face to mark this as a banger"); } else if (hasReported(track.id)) { likeButton.disabled = true; likeButton.classList.remove("liked"); setActionButtonContent(likeButton, "♡", `Banger ${count}`); likeButton.setAttribute("aria-label", "Cannot mark a reported song as a banger"); setTooltip(likeButton, "You reported this song"); } else if (hasLiked(track.id)) { likeButton.disabled = true; likeButton.classList.add("liked"); setActionButtonContent(likeButton, "♥", `Banger ${count}`); likeButton.setAttribute("aria-label", `Marked as banger. ${count} Banger votes`); setTooltip(likeButton, "Already marked as banger"); } else { likeButton.disabled = false; likeButton.classList.remove("liked"); setActionButtonContent(likeButton, "♡", `Banger ${count}`); likeButton.setAttribute("aria-label", `Mark this song as a banger. ${count} banger likes`); setTooltip(likeButton, "Only for absolute standouts"); } } function updateVoteButtons(track) { if (!track || !track.id) { upvoteButton.disabled = true; downvoteButton.disabled = true; upvoteButton.classList.remove("voted"); downvoteButton.classList.remove("voted"); setActionButtonContent(upvoteButton, "↑", "0"); setActionButtonContent(downvoteButton, "↓", "0"); upvoteButton.setAttribute("aria-label", "Upvote unavailable"); downvoteButton.setAttribute("aria-label", "Downvote unavailable"); setTooltip(upvoteButton, "Upvote unavailable"); setTooltip(downvoteButton, "Downvote unavailable"); upvoteCount.textContent = "0"; downvoteCount.textContent = "0"; return; } const upCount = Number(track.upvote_count || 0); const downCount = Number(track.downvote_count || 0); const currentVote = getVote(track.id); upvoteCount.textContent = String(upCount); downvoteCount.textContent = String(downCount); setActionButtonContent(upvoteButton, "↑", String(upCount)); setActionButtonContent(downvoteButton, "↓", String(downCount)); upvoteButton.classList.toggle("voted", currentVote === "up"); downvoteButton.classList.toggle("voted", currentVote === "down"); if (!currentUser) { upvoteButton.disabled = true; downvoteButton.disabled = true; upvoteButton.setAttribute("aria-label", "Sign in with Hugging Face to vote on this song"); downvoteButton.setAttribute("aria-label", "Sign in with Hugging Face to vote on this song"); setTooltip(upvoteButton, "Sign in with Hugging Face to vote"); setTooltip(downvoteButton, "Sign in with Hugging Face to vote"); return; } upvoteButton.disabled = false; downvoteButton.disabled = false; upvoteButton.setAttribute("aria-label", currentVote === "up" ? `Remove radio approval. ${upCount} upvotes` : `Mark this song as radio-approved. ${upCount} upvotes`); downvoteButton.setAttribute("aria-label", currentVote === "down" ? `Remove downvote. ${downCount} downvotes` : `Mark this song as not great on air. ${downCount} downvotes`); setTooltip(upvoteButton, currentVote === "up" ? "Remove radio approval" : "Plays well on radio"); setTooltip(downvoteButton, currentVote === "down" ? "Remove downvote" : "Not great on air"); } function currentUserIsPro() { return Boolean(currentUser && (currentUser.is_pro || currentUser.isPro)); } function currentUserProStatusIsKnown() { return Boolean( currentUser && ( currentUser.is_pro !== undefined || currentUser.isPro !== undefined ) ); } function updateReportButton(track) { if (!track || !track.id) { reportButton.disabled = true; reportButton.classList.remove("reported"); setActionButtonContent(reportButton, "⚑"); reportButton.setAttribute("aria-label", "Report unavailable"); setTooltip(reportButton, "Report unavailable"); return; } const count = Number(track.report_count || 0); if (!currentUser) { reportButton.disabled = true; reportButton.classList.remove("reported"); setActionButtonContent(reportButton, "⚑"); reportButton.setAttribute("aria-label", "Sign in with Hugging Face to report this song"); setTooltip(reportButton, "Sign in with Hugging Face to report"); return; } if (hasReported(track.id)) { reportButton.disabled = false; reportButton.classList.add("reported"); setActionButtonContent(reportButton, "⚑"); reportButton.setAttribute("aria-label", `Undo report. ${count} reports`); setTooltip(reportButton, "Undo report"); } else { reportButton.disabled = false; reportButton.classList.remove("reported"); setActionButtonContent(reportButton, "⚑"); reportButton.setAttribute("aria-label", `Report this song. ${count} reports`); setTooltip(reportButton, "Report problematic track"); } } function updateDownloadButton(track) { if (!track || !track.audio_url) { downloadButton.href = "#"; downloadButton.classList.add("disabled"); downloadButton.setAttribute("aria-label", "Download unavailable"); setTooltip(downloadButton, "Download unavailable"); return; } downloadButton.href = track.audio_url; downloadButton.classList.remove("disabled"); downloadButton.setAttribute("aria-label", "Download current song"); setTooltip(downloadButton, "Download this track"); } function getTrackKey(status) { if (!status || !status.track) { return "none"; } const type = status.now_playing_type || (status.track.is_jingle ? "jingle" : "song"); const identity = status.track.id || status.track.audio_url || status.track.title || "unknown"; return `${type}:${identity}`; } function safeSourceUrl(value) { try { const url = new URL(value); return url.protocol === "https:" ? url.href : ""; } catch { return ""; } } function renderTrackSource(track) { trackOrigin.hidden = !track; trackSource.removeAttribute("href"); trackSource.removeAttribute("title"); trackSourceCaption.textContent = ""; trackSource.textContent = ""; if (!track) return; if (track.is_jingle || track.is_segment || track.is_custom_track) { trackSource.textContent = track.is_jingle ? "Station jingle" : track.is_segment ? "Editorial segment" : "Studio selection"; return; } trackSourceCaption.textContent = track.source_label ? "Generated with" : ""; trackSource.textContent = track.source_label || "Community music"; const url = safeSourceUrl(track.source_space_url); if (url) { trackSource.href = url; trackSource.title = `Visit ${track.source_label || "the music source"}`; } } function renderSourceLinks(sources) { if (!Array.isArray(sources)) return; const signature = JSON.stringify(sources.map(source => [source.id, source.label, source.space_url])); if (signature === renderedSourceLinks) return; renderedSourceLinks = signature; sourceLinks.replaceChildren(); for (const source of sources) { const url = safeSourceUrl(source.space_url); if (!url) continue; const link = document.createElement("a"); link.className = "cta-link-button"; link.href = url; link.target = "_blank"; link.rel = "noopener noreferrer"; link.textContent = `Create with ${source.label || source.id}`; sourceLinks.appendChild(link); } } function renderLiveStatus(status) { bucket.textContent = status.music_sources?.map(source => source.bucket_id).join(", ") || status.bucket_id || "—"; renderSourceLinks(status.music_sources); trackCount.textContent = status.track_count ?? 0; mode.textContent = status.mode || "—"; serverState.textContent = status.is_playing ? "broadcasting" : "loading"; liveListeners.textContent = status.active_listeners ?? 0; signedInListeners.textContent = status.signed_in_listener_count ?? 0; elapsed.textContent = `${Math.floor(status.elapsed || 0)}s`; likesState.textContent = status.likes_enabled ? "ok" : "error"; if (status.track && status.track.id) { upvoteCount.textContent = String(Number(status.track.upvote_count || 0)); downvoteCount.textContent = String(Number(status.track.downvote_count || 0)); reportCount.textContent = String(Number(status.track.report_count || 0)); } else { upvoteCount.textContent = "0"; downvoteCount.textContent = "0"; reportCount.textContent = "0"; } updateTrackProgress(status); updateNextRefresh(status); index.textContent = status.current_index === null || status.current_index === undefined ? "—" : status.current_index + 1; updateLiveMeta(status); updatePlayerListenerMeta(status); renderListenerAvatars( status.listener_profiles || [], status.signed_in_listener_count || 0 ); updatePlayButton(); } function renderStatus(status, options = {}) { renderLiveStatus(status); setRadioLoadingState(Boolean(status.is_loading && !status.track)); const nextTrackKey = getTrackKey(status); if ( !options.forceTrackUpdate && renderedTrackKey !== null && nextTrackKey !== renderedTrackKey ) { pendingTrackKey = nextTrackKey; pendingTrackStatus = status; if (!pendingTrackTimer) { pendingTrackTimer = setTimeout(() => { const delayedStatus = pendingTrackStatus; pendingTrackTimer = null; pendingTrackStatus = null; pendingTrackKey = null; if (delayedStatus) { transitionToTrackStatus(delayedStatus); } }, TRACK_UI_SWITCH_DELAY_MS); } return; } if ( !options.forceTrackUpdate && renderedTrackKey !== null && nextTrackKey === renderedTrackKey ) { renderTrackSource(status.track); if (status.track) { updateLikeButton(status.track); updateVoteButtons(status.track); updateReportButton(status.track); updateDownloadButton(status.track); } else { updateLikeButton(null); updateVoteButtons(null); updateReportButton(null); updateDownloadButton(null); } return; } if (nextTrackKey === renderedTrackKey && pendingTrackTimer) { clearTimeout(pendingTrackTimer); pendingTrackTimer = null; pendingTrackStatus = null; pendingTrackKey = null; } const previousRenderedTrackKey = renderedTrackKey; renderedTrackKey = nextTrackKey; if (nextTrackKey !== previousRenderedTrackKey) window.RadioActionFeedback?.clear(); if (!status.track) { renderTrackSource(null); currentTrackId = null; updateLikeButton(null); updateVoteButtons(null); updateReportButton(null); updateDownloadButton(null); renderTags([]); trackDetailsAccordion.hidden = true; description.textContent = ""; lyrics.textContent = "Instrumental"; lyrics.classList.add("instrumental"); if (status.is_loading) { showMessage( "<strong>Preparing the hourly community mix…</strong>" + "Fresh tracks, likes and reports are being processed." ); title.textContent = "Building the next mix…"; requestAnimationFrame(fitTitleToWidth); } else if (status.last_error) { showMessage( "Error while reading the music catalogs:<br><code>" + status.last_error + "</code>", true ); title.textContent = "Error"; requestAnimationFrame(fitTitleToWidth); } else { showMessage( "No tracks found. The public catalogs may be unavailable, empty, " + "or the expected <code>songs/*/meta.json</code> structure was not found.", true ); title.textContent = "No tracks"; requestAnimationFrame(fitTitleToWidth); } cover.src = DEFAULT_COVER_URL; lyrics.scrollTop = 0; description.scrollTop = 0; updatePlayButton(); return; } hideMessage(); const track = status.track; const trackChanged = nextTrackKey !== previousRenderedTrackKey; renderTrackSource(track); currentTrackId = track.id || null; title.textContent = track.title || "Untitled"; requestAnimationFrame(fitTitleToWidth); renderTags(track.tags || []); if (track.description || (Array.isArray(track.tags) && track.tags.length > 0)) { trackDetailsAccordion.hidden = false; description.textContent = track.description || ""; } else { trackDetailsAccordion.hidden = true; description.textContent = ""; } if (track.thumb_url) { cover.src = track.thumb_url; } else { cover.src = DEFAULT_COVER_URL; } if (track.lyrics) { lyrics.textContent = track.lyrics; lyrics.classList.remove("instrumental"); } else { lyrics.textContent = "Instrumental"; lyrics.classList.add("instrumental"); } if (trackChanged) { requestAnimationFrame(() => { lyrics.scrollTop = 0; description.scrollTop = 0; }); } updateLikeButton(track); updateVoteButtons(track); updateReportButton(track); updateDownloadButton(track); updatePlayButton(); } function resetAudioWatchdogAnchor() { const now = Date.now(); const currentTime = Number.isFinite(player.currentTime) ? player.currentTime : 0; playbackAnchorWallTime = now; playbackAnchorCurrentTime = currentTime; lastPlayerCurrentTime = currentTime; lastPlayerProgressAt = now; } function markPlayerProgress() { if (!userIsListening) { return; } const currentTime = Number.isFinite(player.currentTime) ? player.currentTime : 0; if (currentTime > lastPlayerCurrentTime + 0.15) { lastPlayerCurrentTime = currentTime; lastPlayerProgressAt = Date.now(); } } async function reconnectLiveStream(reason) { if (!userIsListening || isAudioReconnecting) { return; } const now = Date.now(); if (now - lastAudioReconnectAt < AUDIO_RECONNECT_COOLDOWN_MS) { return; } isAudioReconnecting = true; lastAudioReconnectAt = now; console.warn(`[audio] Reconnecting live stream: ${reason}`); showMessage("Audio stream drifted from live. Reconnecting…", true); try { await playRadio(true); } catch (err) { console.warn("Audio reconnect failed:", err); } finally { resetAudioWatchdogAnchor(); isAudioReconnecting = false; } } function checkAudioWatchdog() { if (!userIsListening || player.paused || !player.getAttribute("src")) { return; } const now = Date.now(); const currentTime = Number.isFinite(player.currentTime) ? player.currentTime : 0; if (!playbackAnchorWallTime || !lastPlayerProgressAt) { resetAudioWatchdogAnchor(); return; } if (currentTime > lastPlayerCurrentTime + 0.15) { lastPlayerCurrentTime = currentTime; lastPlayerProgressAt = now; } const stalledSeconds = (now - lastPlayerProgressAt) / 1000; const expectedCurrentTime = playbackAnchorCurrentTime + (now - playbackAnchorWallTime) / 1000; const driftSeconds = expectedCurrentTime - currentTime; const hasPlayedLongEnough = (now - playbackAnchorWallTime) / 1000 >= AUDIO_MIN_PLAYING_SECONDS_BEFORE_DRIFT_CHECK; if (stalledSeconds >= AUDIO_STALLED_RECONNECT_SECONDS) { reconnectLiveStream(`stalled for ${stalledSeconds.toFixed(1)}s`); return; } if (hasPlayedLongEnough && driftSeconds >= AUDIO_MAX_DRIFT_SECONDS) { reconnectLiveStream(`drift ${driftSeconds.toFixed(1)}s`); } } function startAudioWatchdog() { stopAudioWatchdog(); resetAudioWatchdogAnchor(); audioWatchdogTimer = setInterval(checkAudioWatchdog, AUDIO_WATCHDOG_INTERVAL_MS); } function stopAudioWatchdog() { if (audioWatchdogTimer) { clearInterval(audioWatchdogTimer); audioWatchdogTimer = null; } } async function refreshStatus() { const status = await getJSON("/api/status"); renderStatus(status); return status; } async function playRadio(forceReconnect = false) { setupWaveVisualizer(); const hasStream = Boolean(player.getAttribute("src")); if (userIsListening && !player.paused && hasStream && !forceReconnect) { await refreshStatus(); updatePlayButton(); return; } userIsListening = true; if (forceReconnect || !hasStream) { player.src = "/stream.mp3?t=" + Date.now(); } try { await player.play(); resetAudioWatchdogAnchor(); hideMessage(); try { await notifyListenerStart(); } catch (err) { console.warn("Listener start failed:", err); } startListenerHeartbeat(); startAudioWatchdog(); } catch (err) { console.warn("Playback failed:", err); userIsListening = false; stopListenerHeartbeat(); updatePlayButton(); showMessage( "Audio playback could not start. Please click “Listen” again.", true ); return; } updatePlayButton(); await refreshStatus(); } async function stopRadio() { stopListenerHeartbeat(); stopAudioWatchdog(); userIsListening = false; player.pause(); player.removeAttribute("src"); player.load(); try { await notifyListenerStop(); } catch (err) { console.warn("Listener stop failed:", err); } updatePlayButton(); try { await refreshStatus(); } catch (err) { console.warn("Status refresh after stop failed:", err); } } async function likeCurrentSong() { const actionTrackId = currentTrackId; if (!actionTrackId) { return; } if (!currentUser) { showMessage("Please sign in with Hugging Face to like tracks.", true); return; } if (hasLiked(actionTrackId) || hasReported(actionTrackId)) { return; } likeButton.disabled = true; try { const result = await getJSON(`/api/like/${actionTrackId}`, { method: "POST", }); markLiked(actionTrackId); if (currentTrackId !== actionTrackId) return; if (result.status) { renderStatus(result.status, { forceTrackUpdate: true }); } else { likeCount.textContent = String(result.like_count || 0); likeButton.classList.add("liked"); setActionButtonContent(likeButton, "♥", `Banger ${result.like_count || 0}`); likeButton.setAttribute("aria-label", `Marked as banger. ${result.like_count || 0} Banger votes`); setTooltip(likeButton, "Already marked as banger"); } playActionFeedback("banger", actionTrackId); } catch (err) { console.error(err); const needsSignIn = String(err.message || "").includes("401"); showMessage( needsSignIn ? "Please sign in with Hugging Face to like tracks." : "Could not save your like. Please try again later.", true ); likeButton.disabled = false; } } async function voteCurrentSong(nextVote) { const actionTrackId = currentTrackId; if (!actionTrackId) { return; } if (!currentUser) { showMessage("Please sign in with Hugging Face to vote on tracks.", true); return; } const previousVote = getVote(actionTrackId); const calls = []; if (previousVote === nextVote) { calls.push(`/api/un${nextVote}vote/${actionTrackId}`); } else { if (previousVote === "up") { calls.push(`/api/unupvote/${actionTrackId}`); } else if (previousVote === "down") { calls.push(`/api/undownvote/${actionTrackId}`); } calls.push(`/api/${nextVote}vote/${actionTrackId}`); } upvoteButton.disabled = true; downvoteButton.disabled = true; try { let result = null; for (const endpoint of calls) { result = await getJSON(endpoint, { method: "POST" }); } if (previousVote === nextVote) { clearVote(actionTrackId); } else { markVote(actionTrackId, nextVote); } if (currentTrackId !== actionTrackId) return; if (result && result.status) { renderStatus(result.status, { forceTrackUpdate: true }); } else if (result) { const partialTrack = { id: actionTrackId, like_count: result.like_count || 0, upvote_count: result.upvote_count || 0, downvote_count: result.downvote_count || 0, report_count: result.report_count || 0, }; updateLikeButton(partialTrack); updateVoteButtons(partialTrack); updateReportButton(partialTrack); } if (previousVote !== nextVote) playActionFeedback(nextVote, actionTrackId); } catch (err) { console.error(err); const needsSignIn = String(err.message || "").includes("401"); showMessage( needsSignIn ? "Please sign in with Hugging Face to vote on tracks." : "Could not save your vote. Please try again later.", true ); try { await refreshStatus(); } catch (refreshErr) { console.warn("Could not refresh status after vote error:", refreshErr); } } } async function reportCurrentSong() { const actionTrackId = currentTrackId; if (!actionTrackId) { return; } if (!currentUser) { showMessage("Please sign in with Hugging Face to report tracks.", true); return; } const shouldUndoReport = hasReported(actionTrackId); const endpoint = shouldUndoReport ? `/api/unreport/${actionTrackId}` : `/api/report/${actionTrackId}`; reportButton.disabled = true; try { const result = await getJSON(endpoint, { method: "POST", }); if (shouldUndoReport) { clearReported(actionTrackId); } else { markReported(actionTrackId); } if (currentTrackId !== actionTrackId) return; if (result.status) { renderStatus(result.status, { forceTrackUpdate: true }); } else { const partialTrack = { id: actionTrackId, like_count: result.like_count || 0, upvote_count: result.upvote_count || 0, downvote_count: result.downvote_count || 0, report_count: result.report_count || 0, }; updateLikeButton(partialTrack); updateVoteButtons(partialTrack); updateReportButton(partialTrack); } if (!shouldUndoReport) playActionFeedback("report", actionTrackId); } catch (err) { console.error(err); const errorMessage = String(err.message || ""); const needsSignIn = errorMessage.includes("401"); const needsPro = errorMessage.includes("403"); showMessage( needsSignIn ? "Please sign in with Hugging Face to report tracks." : needsPro ? "Hugging Face PRO is required to report tracks." : shouldUndoReport ? "Could not undo your report. Please try again later." : "Could not save your report. Please try again later.", true ); reportButton.disabled = false; } } playToggleButton.addEventListener("click", () => { if (userIsListening && !player.paused) { stopRadio(); } else { playRadio(false); } }); likeButton.addEventListener("click", likeCurrentSong); upvoteButton.addEventListener("click", () => voteCurrentSong("up")); downvoteButton.addEventListener("click", () => voteCurrentSong("down")); reportButton.addEventListener("click", reportCurrentSong); player.addEventListener("playing", () => { resetAudioWatchdogAnchor(); updatePlayButton(); }); player.addEventListener("timeupdate", markPlayerProgress); player.addEventListener("waiting", () => { console.warn("[audio] player waiting"); }); player.addEventListener("stalled", () => { console.warn("[audio] player stalled"); }); player.addEventListener("pause", updatePlayButton); player.addEventListener("error", () => { if (userIsListening) { showMessage( "Audio stream error. Reconnecting in a few seconds…", true ); setTimeout(() => { if (userIsListening) { playRadio(true); } }, 3000); } }); async function initApp() { await loadCurrentUser(); try { await refreshStatus(); } catch (err) { console.error(err); title.textContent = "Error"; requestAnimationFrame(fitTitleToWidth); liveMeta.innerHTML = '<span class="live-dot"></span><span class="live-word">Live</span> · Could not load the radio status.'; playerListenerMeta.textContent = "0 listening now"; cover.src = DEFAULT_COVER_URL; updateTrackProgress({ track: null, elapsed: 0 }); setRadioLoadingState(false); updatePlayButton(); } setInterval(refreshStatus, 5000); setInterval(renderNextRefreshText, 1000); setInterval(() => { if (radioLoadingState) { renderLoadingLiveMeta(); } }, LOADING_STATUS_STEP_MS); } initApp(); setInterval(updateTrackProgress, 1000); </script> </body> </html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>HF Radio MultiSource — Community Music</title>
<style>
[hidden] {
display: none !important;
}
:root {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
color: #f5f5f5;
background: #09090e;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
padding: 24px;
background:
radial-gradient(circle at 5% 0%, rgba(120, 72, 255, 0.48), transparent 34%),
radial-gradient(circle at 92% 95%, rgba(255, 120, 28, 0.34), transparent 31%),
radial-gradient(circle at 45% 40%, rgba(120, 90, 255, 0.08), transparent 42%),
linear-gradient(135deg, #101018, #050506 70%);
}
.app {
position: relative;
width: min(1120px, calc(100vw - 48px));
padding: 34px 40px 34px;
border-radius: 30px;
background:
radial-gradient(circle at 10% 0%, rgba(125, 82, 255, 0.13), transparent 34%),
radial-gradient(circle at 98% 100%, rgba(255, 120, 48, 0.13), transparent 36%),
linear-gradient(135deg, rgba(34, 32, 45, 0.92), rgba(12, 14, 19, 0.92));
border: 1px solid rgba(170, 145, 255, 0.22);
box-shadow:
0 24px 80px rgba(0, 0, 0, 0.52),
inset 0 1px 0 rgba(255, 255, 255, 0.07);
backdrop-filter: blur(18px);
-webkit-backdrop-filter: blur(18px);
}
.auth-corner {
position: absolute;
top: 34px;
left: 54px;
right: 48px;
display: flex;
gap: 10px;
align-items: center;
justify-content: space-between;
z-index: 2;
}
.brand-label {
display: inline-flex;
align-items: center;
gap: 11px;
color: rgba(232, 216, 255, 0.98);
font-size: 22px;
font-weight: 900;
letter-spacing: 0.155em;
text-transform: uppercase;
line-height: 1;
white-space: nowrap;
text-shadow:
0 0 20px rgba(165, 110, 255, 0.46),
0 0 42px rgba(165, 110, 255, 0.20);
}
.brand-label::before {
content: "";
width: 10px;
height: 10px;
border-radius: 999px;
background: #b991ff;
box-shadow:
0 0 16px rgba(185, 145, 255, 0.90),
0 0 34px rgba(185, 145, 255, 0.36);
}
.auth-actions {
display: flex;
gap: 10px;
align-items: center;
justify-content: flex-end;
min-width: 0;
}
.auth-chip {