Backend: - Expose GET /config/playback so the frontend can detect whether anonymous listening is enabled without requiring auth - Wire anonymous access through track streaming and YouTube resolve flows Frontend: - Allow browsing/listening without a session when the backend enables it - Redesign Inicio, Sidebar and top bar with a new dark theme, typography, and layout (top bar with live quick-search, sticky/blurred on scroll) - Populate Top música, Popular and Recomendados with real Musify + YouTube Music data instead of placeholders - Various shape, spacing, color and animation refinements across the redesigned components Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
15 lines
589 B
TypeScript
15 lines
589 B
TypeScript
import { redirect } from '@sveltejs/kit';
|
|
import type { LayoutServerLoad } from './$types';
|
|
import { getAllowAnonymousListening } from '$lib/server/playbackConfig';
|
|
|
|
const PUBLIC_PATHS = new Set(['/login']);
|
|
|
|
export const load: LayoutServerLoad = async ({ locals, url, fetch }) => {
|
|
const allowAnonymousListening = await getAllowAnonymousListening(fetch);
|
|
|
|
if (!locals.user && !allowAnonymousListening && !PUBLIC_PATHS.has(url.pathname)) {
|
|
redirect(302, `/login?returnTo=${encodeURIComponent(url.pathname + url.search)}`);
|
|
}
|
|
return { user: locals.user, allowAnonymousListening };
|
|
};
|