fix: address code review findings

- Preserve MBID and last_synced across periodic artist syncs (INSERT OR
  REPLACE was wiping them, forcing MusicBrainz re-resolution every cycle)
- Exclude unmonitored artists from unnotified-release digest query
- Require telegram.cron_schedule when telegram.enabled is true
- Add same-origin CSRF defense to state-changing web POST routes
- Skip WAL/busy_timeout pragmas for :memory: databases (no-op there)
- Scan mbid as sql.NullString in GetAllArtistSettings to tolerate NULLs
This commit is contained in:
2026-07-19 23:51:15 +03:00
parent 7cdb473d9c
commit ce1c39e14b
7 changed files with 90 additions and 18 deletions

View File

@@ -214,6 +214,10 @@ func (s *Server) ignoreOrRestore(w http.ResponseWriter, r *http.Request) {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
if !s.sameOrigin(r) {
http.Error(w, "forbidden: cross-origin request", http.StatusForbidden)
return
}
id := r.PathValue("id")
if id == "" {
http.NotFound(w, r)
@@ -261,6 +265,10 @@ func (s *Server) toggleIgnoreSingles(w http.ResponseWriter, r *http.Request) {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
if !s.sameOrigin(r) {
http.Error(w, "forbidden: cross-origin request", http.StatusForbidden)
return
}
id := r.PathValue("id")
if id == "" {
http.NotFound(w, r)