Skip to content

Commit e9b3ca5

Browse files
committed
refactor: Remove Claude settings and environment files; update API base URL handling
1 parent 4ded94d commit e9b3ca5

6 files changed

Lines changed: 12 additions & 29 deletions

File tree

.claude/settings.local.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,4 +483,5 @@ $RECYCLE.BIN/
483483
# Vim temporary swap files
484484
*.swp
485485

486+
.claude/*
486487

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Tests live in `src/Tests/` (xUnit + NSubstitute; integration tests use Testconta
5151
- **Tests** (`src/Tests/`) - xUnit test project: `Unit/` (queue, guild player, guild player manager, eventing) and `Integration/` (blacklist/statistics/user services against Testcontainers PostgreSQL).
5252
- **UI** (`src/UI/`)
5353
- `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).
54-
- `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`.
54+
- `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`.
5555
- **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.
5656

5757
### Key Patterns

src/UI/App/.env.development

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/UI/App/.env.production

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/UI/App/src/services/api.ts

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

0 commit comments

Comments
 (0)