| Age | Commit message (Collapse) | Author |
|
|
|
SoC violation
- Add ErrCannotDeleteSelf sentinel error in service layer.
- Change DeleteUser signature to (ctx, callerID, id) across all layers.
- Move self-deletion guard from handleDeleteUser handler into userAdminService.DeleteUser.
- Update handleError to map ErrCannotDeleteSelf to 400 BadRequest.
- Adjust all affected tests to use the new signature.
|
|
|
|
|
|
|
|
|
|
|
|
Create a new internal/mediatype package with a single source of truth for:
- Extension-to-media-type mappings (TypeForExt)
- Extension-to-MIME mappings (MIMETypeForExt)
- Supported extension checks (IsSupportedExt, IsImageExt, IsCoverImageExt)
Replace duplicated logic across:
- internal/service/service.go (supportedExtensions, guessMediaType)
- internal/scanner/scanner.go (mediaExtensions, imageExtensions, mediaTypeFromExt)
- internal/api/handlers.go (probe.MimeTypeForFilename)
- internal/probe/probe.go (imageExtensions, isImagePath)
- internal/probe/remux.go (MimeTypeForFilename)
Divergent defaults unified: both scanner and service now default unknown
extensions to video (model.MediaTypeVideo) via mediatype.TypeForExt.
Update tests to use mediatype package and remove obsolete scanner tests.
Update AGENTS.md to reflect the new package.
|
|
|
|
|
|
to internal/probe
Move LooksLikeMPEGTS, MimeTypeForFilename and the ffmpeg remux path out of the api transport layer into a new internal/probe/remux.go package.
This removes os/exec and mime tables from the api layer, satisfying the DIP principle.
- New probe.Remuxer interface with FFRemuxer implementation
- Server depends on probe.Remuxer, injected via NewServer
- Updated cmd/mediaplayer wiring and all test helpers
- All tests pass: go test ./... -race -cover
|
|
- Protect adminService scan state (cancel func + progress pointer) with sync.Mutex.
- Allocate fresh ScanProgress per trigger and pass it to the scanner,
eliminating races on the previously shared progress struct.
- Cancel previous scan context before starting a new one.
- Add tests for cancellation, fresh progress per scan, concurrent triggers,
and empty progress when never started.
- Fix race-prone tests by polling Running==true before waiting for completion.
|
|
|
|
|
|
Split internal/api/handlers.go (1045 lines) to improve KISS/SRP:
- handlers_auth.go – bootstrap, login, logout, health, session cookies
- handlers_media.go – sets, media CRUD, tags, favorites, notes, progress
- handlers_share.go – create/list/revoke shares, share page, share stream
- handlers_admin.go – trash, rescan, users, permissions
- handlers_file.go – stream, download, thumbnail, regenerate thumbnail
Shared helpers (writeJSON, readJSON, pathID, serveFileResult,
mimeTypeForFilename, etc.) remain in handlers.go.
All tests pass: go test ./... -race -cover.
|
|
content-type fixes, thumbnail refresh, and verbose logging
|
|
|
|
|
|
- Add SecureCookies bool to internal.Config (default true)
- Update LoadConfig in internal/config.go to parse SECURE_COOKIES env var
- Update setSessionCookie and clearSessionCookie in internal/api/handlers.go to read cfg.SecureCookies
- Add tests verifying Secure=true/false and logout clears cookie accordingly
- Update AGENTS.md and PLAN.md with new option documentation
|
|
filters, permission scoping)
|
|
- handlers.go: enforce MAX_UPLOAD_SIZE_MB via http.MaxBytesReader and
http.MaxBytesError mapping to 413.
- service/media.go: UploadMedia now verifies owner/admin, rejects unsupported
extensions, probes metadata with ffprobe, generates video thumbnails,
enforces unique filenames, and cleans up temp files + hard-deletes DB row
on any failure.
- Reconcile PLAN.md 500MB -> 100MB default to match AGENTS.md/config.
- Add service and API tests for max-size rejection, unsupported extension,
missing role, probe failure, thumbnail failure, cleanup, and success paths.
|
|
- mediaService: implement RegenerateThumbnail and RegenerateSetCover
- Inject thumb.Generator and probe.Prober into MediaService
- Update NewMediaService constructor and all call sites
- Add service tests for success, failure, permission denied, and not-found
- Add API tests for cover regeneration and thumbnail error mapping
- All tests pass
|
|
- Add web/share.html with a minimal HTML5 video player, theme variables,
centered layout, play overlay, and Back to Home link.
- Update handleSharePage to return HTML for browser Accept headers
(text/html or empty) and JSON for application/json. Return 410 Gone
for expired shares.
- Update handleShareStream to map service errors to distinct HTTP codes:
ErrShareExpired -> 410, ErrShareNotFound/ErrMediaNotFound -> 404.
- Improve ValidateShareToken and StreamSharedMedia to return sentinel
errors (ErrShareNotFound, ErrShareExpired, ErrMediaNotFound) instead
of generic string errors.
- Update and add tests for share page HTML/JSON negotiation and share
stream 404/410 responses.
|
|
Changes:
- MediaService.ListMedia now accepts userID and filters by allowed sets
for non-admins via AllowedSetIDs in repository.MediaFilter.
- Handlers pass userID into ListMedia; API returns 403 for forbidden.
- Added verifyModifyAccess and verifySetModifyAccess helpers so only
owners/admins can upload, soft-delete, restore, and regenerate
thumbnails/covers; viewers are blocked.
- GetMediaDetail, ToggleFavorite, AssignTag, RemoveTag, notes, and
shares now consistently verifyAccess before proceeding.
- Handlers handle ErrForbidden with 403 for soft-delete and restore.
- Added negative tests proving viewers cannot mutate and unauthorized
users cannot access/detail/tag/note/favorite/share inaccessible media.
|
|
- Update go.mod module path
- Replace all internal imports from github.com/paul/kiss-media-player to codeberg.org/snonux/play
- Run go mod tidy and gofmt -w .
|
|
|
|
|
|
|
|
progress, admin routes
|
|
handlers, and bootstrap flow (m9)
|