Media build part 2 (unreleased): drive wiring in every app (R-1024/R-1037), old-install repair (R-1047), drive events notice + real restart now/later + stream check, file browser lets go of dead/removed drives and recreates on return (R-1038), safe removal keeps the drive (R-1044), Plex claim on the running server + probe accept (R-1028/R-1045)
gates / gates (push) Successful in 45s

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-10-15 09:54:49 +02:00
parent 78c894234c
commit f580d88a14
46 changed files with 3700 additions and 8 deletions
+17 -3
View File
@@ -29,6 +29,7 @@ import (
"gitea.dooplex.hu/admin/felhom-controller/internal/config"
"gitea.dooplex.hu/admin/felhom-controller/internal/i18n"
"gitea.dooplex.hu/admin/felhom-controller/internal/integrations"
"gitea.dooplex.hu/admin/felhom-controller/internal/mediawire"
"gitea.dooplex.hu/admin/felhom-controller/internal/notify"
"gitea.dooplex.hu/admin/felhom-controller/internal/scheduler"
"gitea.dooplex.hu/admin/felhom-controller/internal/selfupdate"
@@ -91,9 +92,20 @@ type Server struct {
fileBrowserMu sync.Mutex
// fbReqMu guards the file-browser sync's single-flight counters (R-695, v0.275.0): fbReqGen counts
// requests, fbDoneGen is the newest request a finished sync is known to have covered.
fbReqMu sync.Mutex
fbReqGen uint64
fbDoneGen uint64
fbReqMu sync.Mutex
// fbForce (R-1038): the next FileBrowser sync recreates even when nothing changed (a drive came back).
fbForceMu sync.Mutex
fbForce bool
// media drive events (v0.313.0): the wiring (R-1024) and the „restart later" timer.
mediaMu sync.Mutex
mediaWiring []mediawire.Result
mediaWiredAt time.Time
mediaLaterAt time.Time
mediaLaterTmr *time.Timer
mediaWirer *mediawire.Wirer
mediaSoonTmr *time.Timer
fbReqGen uint64
fbDoneGen uint64
// syncFileBrowserHook replaces the sync's body in tests (the single-flight is the unit under test).
syncFileBrowserHook func()
// langSwitchSync replaces the language switch's file-browser sync in tests (R-691).
@@ -850,6 +862,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// path wins. POST (not GET) so CsrfProtect covers it and it is not cacheable — see the handler.
// v0.280.0: the household's two presses on the app page — "Done, I set it up" (decision 46) and "I changed
// it" under a known default login (R-710). POST, so CsrfProtect covers them.
case path == "/apps/plex/plex-claim" && r.Method == http.MethodPost:
s.appPlexClaimHandler(w, r)
case strings.HasPrefix(path, "/apps/") && strings.HasSuffix(path, "/setup-gate/open") && r.Method == http.MethodPost:
s.appSetupGateOpenHandler(w, r, strings.TrimSuffix(strings.TrimPrefix(path, "/apps/"), "/setup-gate/open"))
// R-1007: the household dismisses the lost-files note. POST, so CsrfProtect covers it.