Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .claude/settings.local.json

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,5 @@ $RECYCLE.BIN/
# Vim temporary swap files
*.swp

.claude/*

2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Tests live in `src/Tests/` (xUnit + NSubstitute; integration tests use Testconta
- **Tests** (`src/Tests/`) - xUnit test project: `Unit/` (queue, guild player, guild player manager, eventing) and `Integration/` (blacklist/statistics/user services against Testcontainers PostgreSQL).
- **UI** (`src/UI/`)
- `Api/` - ASP.NET Core minimal-API endpoints (see `ControllerExtensions.cs`) with JWT bearer auth. Anonymous stats endpoints (`/api/statistics-all`, `/api/statistics-today` for today's top songs, `/api/users`); radio-source CRUD and token validation require authorization. Login checks against `JwtSettings:InternalPassword` (no user password hashing).
- `App/` - React 19 + TypeScript SPA, responsive down to phone widths (breakpoints at 1024/768/480px in `index.css`; `hide-sm`/`hide-md` classes drop table columns on small screens). The index route is an Overview landing page (`pages/Overview.tsx` + `components/RankList.tsx`) with headline stats, top-songs-today, all-time favorites, top listeners, and a latest-activity feed derived from each user's recent songs. The song/user dashboards support search, sortable columns, pagination (`Pagination`/`SortableTh` components, 10 rows per page), an all-time/today filter (songs), relative "last played" timestamps (`utils/time.ts`), and auto-refresh every 60s via TanStack Query `refetchInterval`. Charts adapt to mobile via the `useIsMobile` hook. The API base URL is relative (`/api`) in production builds because the Worker serves the SPA and API from the same origin (works for local docker and deployment alike); only `.env.development` points at `http://localhost:5000/api` for the Vite dev server. Build output writes into `src/Worker/wwwroot/`, which is served by the Worker as static files with SPA fallback to `index.html`.
- `App/` - React 19 + TypeScript SPA, responsive down to phone widths (breakpoints at 1024/768/480px in `index.css`; `hide-sm`/`hide-md` classes drop table columns on small screens). The index route is an Overview landing page (`pages/Overview.tsx` + `components/RankList.tsx`) with headline stats, top-songs-today, all-time favorites, top listeners, and a latest-activity feed derived from each user's recent songs. The song/user dashboards support search, sortable columns, pagination (`Pagination`/`SortableTh` components, 10 rows per page), an all-time/today filter (songs), relative "last played" timestamps (`utils/time.ts`), and auto-refresh every 60s via TanStack Query `refetchInterval`. Charts adapt to mobile via the `useIsMobile` hook. The API base URL is hardcoded in `services/api.ts`: relative `/api` for builds (the Worker serves the SPA and API from the same origin, so this works for local docker and deployment alike) and `http://localhost:5000/api` only when `import.meta.env.DEV` is true (the Vite dev server). Do NOT reintroduce `VITE_API_BASE_URL` env files: bun auto-loads `.env*` into `process.env`, which outranks `.env.production` in Vite and once leaked the dev URL into a deployed production build. Note that `deployment/docker-compose.override.yml` (VS debug tooling) sets `BUILD_CONFIGURATION: Debug` and a `--wait-for-debugger` entrypoint; it is auto-applied if you run `docker compose` from `deployment/` without `-f`, so always use the explicit `-f deployment/docker-compose.yml` form for real runs. Build output writes into `src/Worker/wwwroot/`, which is served by the Worker as static files with SPA fallback to `index.html`.
- **Worker** (`src/Worker/`) - Composition root. Program.cs builds a `WebApplication` that hosts the NetCord Discord gateway (registered via `AddDiscordGateway`), the ASP.NET Core web API, and the `GuildPlayerManager` hosted service in one process on port 5000.

### Key Patterns
Expand Down
1 change: 0 additions & 1 deletion src/UI/App/.env.development

This file was deleted.

1 change: 0 additions & 1 deletion src/UI/App/.env.production

This file was deleted.

14 changes: 10 additions & 4 deletions src/UI/App/src/services/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// The production build uses a relative path because the Worker serves the SPA
// and the API from the same origin (works for local docker and deployment).
// The dev server overrides this via .env.development to reach localhost:5000.
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL ?? '/api';
// Production builds use a relative path because the Worker serves the SPA and
// the API from the same origin (works for local docker and deployment alike).
// Dev-mode builds (vite dev server on :5173, or build:dev) target the Worker
// on localhost:5000 directly.
// Deliberately not read from VITE_API_BASE_URL: bun auto-loads .env files into
// process.env, which outranks .env.production in Vite and once leaked the dev
// URL into a production build.
export const API_BASE_URL = import.meta.env.DEV
? 'http://localhost:5000/api'
: '/api';
Loading