diff --git a/CLAUDE.md b/CLAUDE.md index 092c8cb..4d2bb6f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -13,48 +13,97 @@ The shows have distinct themes and identities: ## Scope -This repo covers the **frontend only** — the public-facing website. Icecast configuration, Yunohost server administration, and streaming software are out of scope. Do not look for or suggest changes to server-side streaming config. +This repo covers the **website** — the public pages, the admin backend, and the site's MariaDB database. Icecast configuration, Yunohost server administration, and streaming software are out of scope. Do not look for or suggest changes to server-side streaming config. + +The one approved exception is [cli/poll_icecast.php](cli/poll_icecast.php), a cron job that reads the Icecast status API to record track history. It only reads from Icecast; it never configures it. ## Key Files +Public pages: - [index.php](index.php) — Main page. Contains the audio player, now-playing widget, upcoming schedule section, and about section. Show information is updated here manually before each broadcast. -- [now_playing.php](now_playing.php) — Fetches the currently playing track from the Icecast JSON status API and returns it as HTML. Called by the frontend every 15 seconds via `setInterval`. -- [live.php](live.php) — Page for active broadcasts. Player on the left, recently played list on the right; the header background and heading change with the current show. +- [live.php](live.php) — Page to send listeners to while streaming. Player on the left, recently played list on the right; the sidebar background and the heading change with the current show. +- [now_playing.php](now_playing.php) — Returns the currently playing track as HTML. Called by `index.php` and `live.php` every 15 seconds. - [recently_played.php](recently_played.php) — Returns the current broadcast's track history as table rows for `live.php`. -- [includes/icecast.php](includes/icecast.php) — Shared Icecast fetching/parsing, album art lookup and Last.fm link helpers. + +Admin backend ([admin/](admin/)): +- [admin/login.php](admin/login.php), [admin/logout.php](admin/logout.php) — Username/password login. +- [admin/index.php](admin/index.php) — Dashboard: broadcast status, queue the next show, switch the live show, clear the queue. +- [admin/shows.php](admin/shows.php), [admin/show_edit.php](admin/show_edit.php) — List, add, edit and delete shows, including background image uploads. + +Shared includes: - [includes/db.php](includes/db.php) — `getDB()` returns a shared PDO connection (session time zone UTC). -- [includes/broadcasts.php](includes/broadcasts.php) — Broadcast lifecycle and track history logic. +- [includes/icecast.php](includes/icecast.php) — Icecast fetching/parsing, album art lookup (iTunes Search API) and Last.fm link helpers. +- [includes/broadcasts.php](includes/broadcasts.php) — Broadcast lifecycle, show queueing and track history logic. +- [includes/auth.php](includes/auth.php) — Admin sessions, login throttling and CSRF helpers. +- [includes/admin_layout.php](includes/admin_layout.php) — `adminHeader()`/`adminFooter()` page chrome and `flash()` messages for admin pages. + +Command-line tools (run over SSH from the site root): - [cli/poll_icecast.php](cli/poll_icecast.php) — Cron-run poller that records broadcasts and tracks. -- [cli/set_show.php](cli/set_show.php) — Sets which show is airing next (or now). +- [cli/set_show.php](cli/set_show.php) — Lists shows, or queues/sets the show by slug. Same behaviour as the dashboard control. - [cli/create_admin.php](cli/create_admin.php) — Creates an admin account or resets its password. -- [admin/](admin/) — Admin backend. Every page calls `requireAdmin()` from [includes/auth.php](includes/auth.php) and uses `adminHeader()`/`adminFooter()` from [includes/admin_layout.php](includes/admin_layout.php). + +Other: +- [sql/schema.sql](sql/schema.sql) — Full database schema plus seed data for the five shows. Safe to re-run. +- [config/db_credentials.example.php](config/db_credentials.example.php) — Template for the gitignored `config/db_credentials.php`. ## Architecture - **Backend:** PHP only. No Composer, no package manager, no build step. - **Frontend:** HTML5 UP Strata template with custom CSS additions. No npm, no webpack, no preprocessor — edit CSS directly in `assets/css/main.css` or inline `