Updated the Obsidian docs-vault
This commit is contained in:
1 parent
72fd77ee01
commit
260282a0e2
36 files changed
+3497
-144
No files matched your search
+66
-18
@@ -1,32 +1,80 @@
|
||||
---
|
||||
title: Settings Page
|
||||
tags:
|
||||
- feature
|
||||
- settings
|
||||
- maintenance
|
||||
---
|
||||
|
||||
# Settings Page
|
||||
|
||||
## Overview
|
||||
|
||||
App configuration and maintenance tools at `/settings`.
|
||||
App configuration and maintenance tools at `/settings`. Contains two card sections.
|
||||
|
||||
## Sections
|
||||
## General Settings
|
||||
|
||||
### General Settings
|
||||
- **TMDB API Key** — Required for media metadata lookups
|
||||
- **Backend Port** — Port the backend server runs on
|
||||
Form using react-hook-form + zod validation.
|
||||
|
||||
### Cleanup
|
||||
Added in Milestone 001. Uses [[Backend]] maintenance endpoints.
|
||||
| Field | Type | Description |
|
||||
|---|---|---|
|
||||
| TMDB API Key | Password input | Required for [[TMDB Integration]] |
|
||||
| Backend Port | Number input | Port the backend server runs on (default 4000) |
|
||||
|
||||
#### Orphan Files
|
||||
- **Scan** (`GET /maintenance/orphan-files`) — Dry run, returns counts of orphan files by type
|
||||
- **Delete** (`DELETE /maintenance/orphan-files`) — Removes orphan files from disk
|
||||
Saved via `PUT /api/v1/settings`.
|
||||
|
||||
#### Orphan Media Records
|
||||
- **Scan** (`GET /maintenance/orphan-media-records`) — Dry run, returns counts of DB records with no file
|
||||
- **Delete** (`DELETE /maintenance/orphan-media-records`) — Removes orphan records from database
|
||||
## 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 endpoints return: `{ posters: number, logos: number, backdrops: number, stills: number }`
|
||||
|
||||
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
|
||||
|
||||
- `react_frontend/src/pages/SettingsPage.tsx`
|
||||
- `react_frontend/src/api/maintenance.ts`
|
||||
- `backend/controllers/maintenanceController.js`
|
||||
- `backend/services/maintenanceService.js`
|
||||
| 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
|
||||
Reference in new issue
Block a user