fix(backup): a restore says Subsonic apps are signed out, and restores ListenBrainz switched off (#8104)
The backup leaves out each person's Subsonic password and ListenBrainz token, which are sealed under the stream secret, but no restore message said so. The CLI and docs sent people to Admin for keys that live in each person's own Settings, and the web said nothing. All three now say that Subsonic apps are signed out and where to make a new Subsonic password and save the ListenBrainz token. listenbrainz_enabled travelled without the token, so a restored account read as on but unable to send. It is now left out too and restores off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -115,8 +115,8 @@ func TestARestoredInstanceHoldsWhatTheBackupHeld_Integration(t *testing.T) {
|
||||
pool := dbtest.Pool(t)
|
||||
ctx := context.Background()
|
||||
|
||||
user := mustID(t, pool, `INSERT INTO users (username, password_hash, api_token_hash, listenbrainz_token)
|
||||
VALUES ($1, 'hash', 'backup-token', 'lb-token') RETURNING id::text`, dbtest.TestUserPrefix+"backup")
|
||||
user := mustID(t, pool, `INSERT INTO users (username, password_hash, api_token_hash, listenbrainz_token, listenbrainz_enabled)
|
||||
VALUES ($1, 'hash', 'backup-token', 'lb-token', true) RETURNING id::text`, dbtest.TestUserPrefix+"backup")
|
||||
artist := mustID(t, pool, `INSERT INTO artists (name, sort_name, artist_art_source) VALUES ('Artist', 'artist', 'none') RETURNING id::text`)
|
||||
album := mustID(t, pool, `INSERT INTO albums (title, sort_title, artist_id, cover_art_source, cover_art_path)
|
||||
VALUES ('Album', 'album', $1, 'mbcaa', '/data/covers/a.jpg') RETURNING id::text`, artist)
|
||||
@@ -195,16 +195,18 @@ func TestARestoredInstanceHoldsWhatTheBackupHeld_Integration(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// What the backup leaves out comes back unset, so the server asks for the
|
||||
// credential again and redoes the art and tags.
|
||||
// What the backup leaves out comes back unset, so the credential is
|
||||
// entered again and the art and tags are redone. ListenBrainz comes back
|
||||
// off, since it can't send until its token is saved again.
|
||||
var lbToken, coverSource, tagSource *string
|
||||
if err := pool.QueryRow(ctx, `SELECT u.listenbrainz_token, al.cover_art_source, tr.tag_source
|
||||
var lbEnabled bool
|
||||
if err := pool.QueryRow(ctx, `SELECT u.listenbrainz_token, u.listenbrainz_enabled, al.cover_art_source, tr.tag_source
|
||||
FROM users u, albums al, tracks tr WHERE u.id = $1 AND al.id = $2 AND tr.id = $3`,
|
||||
user, album, track).Scan(&lbToken, &coverSource, &tagSource); err != nil {
|
||||
user, album, track).Scan(&lbToken, &lbEnabled, &coverSource, &tagSource); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if lbToken != nil || coverSource != nil || tagSource != nil {
|
||||
t.Errorf("token %v, cover source %v, tag source %v; want all unset", lbToken, coverSource, tagSource)
|
||||
if lbToken != nil || lbEnabled || coverSource != nil || tagSource != nil {
|
||||
t.Errorf("token %v, enabled %v, cover source %v, tag source %v; want all unset", lbToken, lbEnabled, coverSource, tagSource)
|
||||
}
|
||||
|
||||
// The change feed carries on after the restored ids.
|
||||
|
||||
Reference in New Issue
Block a user