0.2.64 update

This commit is contained in:
ponzischeme89
2026-08-15 09:23:26 +12:00
parent a2ca7e8061
commit d5d47473a2
90 changed files with 9188 additions and 451 deletions
+23 -3
View File
@@ -148,11 +148,24 @@ func (s *Server) requireSupportedClient(next http.HandlerFunc) http.HandlerFunc
// handleUpdate answers the client's version check.
//
// Its own public endpoint rather than a field on /v1/home: update policy belongs to the
// app build, not a viewer or login. The verdict comes from memory; when a bearer token is
// present the route resolves it only to attribute an offered update to the affected viewer.
// Its own public endpoint rather than a field on /v1/home: compatibility belongs to the
// app build, not a viewer or login. The verdict comes from memory; a valid bearer token
// also lets one viewer mute an optional prompt, but never a mandatory update.
func (s *Server) handleUpdate(w http.ResponseWriter, r *http.Request) {
decision := s.updateDecision(r)
// A signed-in viewer may decline optional update prompts. Mandatory decisions remain
// authoritative: this preference is about notifications, not compatibility or the
// operator's ability to retire an unsafe build. Signed-out checks have no person to
// consult and retain the ordinary app-scoped policy.
if decision.Status == appupdate.StatusOptional {
if identity := identityFrom(r.Context()); identity != nil && identity.userID != "" {
if prefs, err := s.notificationPreferencesFor(r.Context(), identity.userID); err != nil {
s.loggerFor(r.Context()).Warn("update notification preferences unavailable", "error", err)
} else {
decision = updateDecisionForPreferences(decision, prefs.Enabled && prefs.UpdateAlerts)
}
}
}
// Only a verdict that asks a television to do something is worth a line. Every TV
// checks on every launch, and "nothing to say" logged each time would bury the
// launch where an update was actually offered — or forced.
@@ -165,3 +178,10 @@ func (s *Server) handleUpdate(w http.ResponseWriter, r *http.Request) {
}
writeJSON(w, http.StatusOK, decision)
}
func updateDecisionForPreferences(decision appupdate.Decision, updateAlerts bool) appupdate.Decision {
if decision.Status == appupdate.StatusOptional && !updateAlerts {
return appupdate.Decision{Status: appupdate.StatusNone}
}
return decision
}