Update media handling

This commit is contained in:
2025-10-02 14:01:27 +02:00
parent 0e54a6019e
commit 3b24e64131
7 changed files with 205 additions and 49 deletions

View File

@@ -6,7 +6,7 @@ Luxtools is now implemented entirely in Go. The project serves a retro-styled HT
```
luxtools/
├── assets/ # Runtime asset directory served from disk (/assets/*)
├── media/ # Runtime media directory served from disk (/media/*)
├── cmd/luxtools/ # Main program entrypoint
├── internal/server/ # HTTP server, handlers, helpers, and tests
├── web/
@@ -33,7 +33,23 @@ The server listens on [http://127.0.0.1:5000](http://127.0.0.1:5000) and serves:
- `/counter` — HTMX-powered counter snippet with server-side state
- `/time` — current server timestamp
- `/static/*` — vendored assets from `web/static`
- `/assets/*` — runtime assets from the shared `assets` directory
- `/media/*` — runtime media files served from the configured directory
### Configuration
The server looks for media files in the following order:
1. A directory specified via `--media-dir` on the command line.
2. The `media_dir` value in an optional JSON config file passed with `--config`.
3. A `media` directory located alongside the binary or in the current working directory.
Sample config file:
```json
{
"media_dir": "/var/lib/luxtools/media"
}
```
## Testing