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
gates / gates (push) Successful in 45s
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
78c894234c
commit
f580d88a14
46 files changed
+3700
-8
No files matched your search
@@ -782,6 +782,8 @@ func (s *Server) appDetailHandler(w http.ResponseWriter, r *http.Request, slug s
|
||||
// v0.280.0 (decision 46): the setup gate's card, while the gate stands.
|
||||
data["SetupGateClosed"] = found.Deployed && found.AppConfig != nil && found.AppConfig.SetupGate.Closed()
|
||||
data["SetupGateHasProbe"] = found.Meta.SetupDoneProbe != nil && found.Meta.SetupDoneProbe.URL != ""
|
||||
// R-1028 (v0.313.0): Plex is claimed on its running server — the household pastes the code here, after the install.
|
||||
data["PlexClaim"] = data["SetupGateClosed"] == true && found.Meta.Slug == "plex"
|
||||
// R-741: the install hold's card, while the app is held for its first-login change.
|
||||
data["InstallHoldClosed"] = found.Deployed && found.AppConfig != nil && found.AppConfig.InstallHold.Closed()
|
||||
// v0.282.0 (decision 49): "close sign-up now" on an app installed before the rule; the app's own switch.
|
||||
@@ -3478,6 +3480,7 @@ func (s *Server) settingsStorageAddHandler(w http.ResponseWriter, r *http.Reques
|
||||
|
||||
s.logger.Printf("[INFO] [web] Storage path added: %s (%s)", path, label)
|
||||
go s.SyncFileBrowserMounts()
|
||||
s.mediaDriveEvent(path, "added")
|
||||
http.Redirect(w, r, "/storage?storage_msg=success&storage_detail="+url.QueryEscape(s.msg(r, "storage.msg_added", path)), http.StatusFound)
|
||||
}
|
||||
|
||||
@@ -3596,6 +3599,14 @@ func (s *Server) SyncFileBrowserMounts() {
|
||||
s.syncFileBrowserMounts(false)
|
||||
}
|
||||
|
||||
// SyncFileBrowserMountsForce syncs AND recreates the file browser even when nothing changed (R-1038: a returned drive).
|
||||
func (s *Server) SyncFileBrowserMountsForce() {
|
||||
s.fbForceMu.Lock()
|
||||
s.fbForce = true
|
||||
s.fbForceMu.Unlock()
|
||||
s.syncFileBrowserMounts(false)
|
||||
}
|
||||
|
||||
// SyncFileBrowserMountsReset is like SyncFileBrowserMounts but resets the FileBrowser
|
||||
// database when sources change. Use only after restore — normal operations should use
|
||||
// SyncFileBrowserMounts to preserve user accounts, permissions, and share links.
|
||||
@@ -3673,6 +3684,7 @@ func (s *Server) syncFileBrowserMounts(resetDBOnChange bool) {
|
||||
// no mount behind it renders a broken sidebar entry).
|
||||
storageMounts, configPaths := buildFileBrowserPaths(paths, fbPathDeps{
|
||||
isMount: system.IsMountPoint,
|
||||
isDead: system.MountIsShutdown,
|
||||
classify: s.classifyFSPath,
|
||||
ensureSkeleton: s.ensureUserdataSkeleton,
|
||||
logger: s.logger,
|
||||
@@ -3748,6 +3760,16 @@ func (s *Server) syncFileBrowserMounts(resetDBOnChange bool) {
|
||||
finalConfig, _ := os.ReadFile(configPath)
|
||||
finalCompose, _ := os.ReadFile(composePath)
|
||||
changed := fbNeedsRecreate(oldConfig, finalConfig, oldCompose, finalCompose)
|
||||
// R-1038 (v0.313.0): a drive that CAME BACK at the same path changes neither file, yet the running file browser
|
||||
// still holds the dead mount (I/O error 4 minutes after the return, measured). A forced sync recreates it.
|
||||
s.fbForceMu.Lock()
|
||||
if s.fbForce {
|
||||
if !changed {
|
||||
s.logger.Printf("[INFO] [web] FileBrowser: recreating although nothing changed — a drive came back (R-1038)")
|
||||
}
|
||||
changed, s.fbForce = true, false
|
||||
}
|
||||
s.fbForceMu.Unlock()
|
||||
|
||||
// If sources changed and caller requested a DB reset (restore flow),
|
||||
// nuke the data volume so FileBrowser re-reads config.yaml from scratch.
|
||||
@@ -3791,6 +3813,7 @@ func (s *Server) syncFileBrowserMounts(resetDBOnChange bool) {
|
||||
// without a drive, a NAS or docker.
|
||||
type fbPathDeps struct {
|
||||
isMount func(string) bool // drive-absent gate probe (production: system.IsMountPoint)
|
||||
isDead func(string) bool // a dead filesystem at the path (production: system.MountIsShutdown); nil = never
|
||||
classify func(string) string // network stub gate (production: Server.classifyFSPath; nil → include, fail open)
|
||||
ensureSkeleton func(string) error // userdata skeleton (production: appbackup.EnsureUserdataSkeleton) — DRIVES ONLY
|
||||
// nsRootFor resolves a bare DRIVE path to its felhom-data namespace root (R-203). Injected rather
|
||||
@@ -3846,6 +3869,14 @@ func buildFileBrowserPaths(paths []settings.StoragePath, d fbPathDeps) (storageM
|
||||
}
|
||||
continue
|
||||
}
|
||||
// R-1038/R-1044 (v0.313.0): a DEAD drive (pulled: `shutdown` in mountinfo — no disk I/O) and a SAFELY REMOVED
|
||||
// one are not bound either: the file browser lets go of them, and binds the drive again when it is back.
|
||||
if sp.EjectedAt != "" || (d.isDead != nil && d.isDead(sp.Path)) {
|
||||
if d.logger != nil {
|
||||
d.logger.Printf("[INFO] [web] FileBrowser: drive %s is removed or dead — not bound this pass", sp.Path)
|
||||
}
|
||||
continue
|
||||
}
|
||||
// SCOPE to the drive's `userdata/` subtree (v0.66.0): the customer browses ONLY userdata —
|
||||
// app internals (appdata/) and the recovery units + Tier 2 copies (backups/) are NOT mounted
|
||||
// into FileBrowser. userdata is owned group 1000 mode 2775 (setgid), and FileBrowser runs as
|
||||
|
||||
Reference in new issue
Block a user