- New notes: History, Artwork - Rewrite TMDB Integration: single detail request, entry mapper, rate limiter, refresh sync, stale-entry refresh, recommendations - Update pages, routing, API reference, models, database migrations, services, components, hooks, API clients, settings, media system, library, Electron (Tauri in progress) and known issues - Rewrite README for the current React/Express stack and setup
90 lines
2.8 KiB
Markdown
90 lines
2.8 KiB
Markdown
---
|
|
title: Settings Page
|
|
tags:
|
|
- feature
|
|
- settings
|
|
- maintenance
|
|
---
|
|
|
|
# Settings Page
|
|
|
|
## Overview
|
|
|
|
App configuration and maintenance tools at `/settings`, in two tabs: **General** and **Maintenance**.
|
|
|
|
## General Settings
|
|
|
|
Form using react-hook-form + zod validation.
|
|
|
|
| Field | Type | Description |
|
|
|---|---|---|
|
|
| TMDB API Key | Password input | Required for [[TMDB Integration]] |
|
|
| Backend Port | Number input | Port the backend server runs on (default 4000) |
|
|
|
|
Saved via `PUT /api/v1/settings`.
|
|
|
|
## TMDB Refresh
|
|
|
|
First card on the Maintenance tab. Refreshes entries whose `last_fetch` is older than N hours (default 24) — details, ids, ratings, genres, networks, seasons, episodes and credits.
|
|
|
|
- Shows how many entries are due; **Refresh stale entries** starts a background job, **Cancel** stops it
|
|
- Live progress (polled every 2s while running): done/total, ok, failed, current title; failures listed when finished
|
|
- Rate limited, so a large library takes a while; entries with auto sync off are skipped
|
|
- Endpoints: [[API Reference#Stale Entries Refresh]]
|
|
|
|
## Cleanup
|
|
|
|
Maintenance tools for cleaning up orphaned data. Uses backend maintenance endpoints.
|
|
|
|
### Orphan Files
|
|
|
|
Files that exist on disk but have **no matching database record**.
|
|
|
|
| Action | Button | Endpoint | Effect |
|
|
|---|---|---|---|
|
|
| Scan | `Scan` (outline) | `GET /maintenance/orphan-files` | Dry run — counts only |
|
|
| Delete | `Delete` (destructive) | `DELETE /maintenance/orphan-files` | Removes files from disk |
|
|
|
|
The Delete button only appears when the scan finds orphans.
|
|
|
|
### Orphan Media Records
|
|
|
|
Database records that point to **files that no longer exist on disk**.
|
|
|
|
| Action | Button | Endpoint | Effect |
|
|
|---|---|---|---|
|
|
| Scan | `Scan` (outline) | `GET /maintenance/orphan-media-records` | Dry run — counts only |
|
|
| Delete | `Delete` (destructive) | `DELETE /maintenance/orphan-media-records` | Removes DB records |
|
|
|
|
### Response Format
|
|
|
|
Both scan and delete return:
|
|
|
|
```json
|
|
{ "posters": 0, "logos": 0, "backdrops": 0, "stills": 0 }
|
|
```
|
|
|
|
Displayed as: "3 poster(s), 1 backdrop(s)" or "None found".
|
|
|
|
## Implementation Details
|
|
|
|
- State: `useState` for scan results (`OrphanResult | null`)
|
|
- Mutations: `useMutation` for scan and delete operations
|
|
- Loading: `Loader2` spinner on buttons during operations
|
|
- Conditional rendering: Delete button only shown when `hasOrphans(result) === true`
|
|
|
|
## Important Files
|
|
|
|
| File | Role |
|
|
|---|---|
|
|
| `react_frontend/src/pages/SettingsPage.tsx` | Page component |
|
|
| `react_frontend/src/api/maintenance.ts` | API client |
|
|
| `backend/controllers/maintenanceController.js` | Route handlers |
|
|
| `backend/services/maintenanceService.js` | Business logic |
|
|
|
|
## See Also
|
|
|
|
- [[API Reference#Maintenance]] — Endpoint details
|
|
- [[Media System]] — How media files are stored
|
|
- [[Env]] — Settings configuration
|