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:
2026-11-26 23:53:37 -05:00
co-authored by Claude Opus 5.5
parent 4c0bd9df04
commit 436a970f7b
6 changed files with 30 additions and 14 deletions
+1 -1
View File
@@ -72,5 +72,5 @@ func printRestored(w io.Writer, m backup.Manifest) {
m.CreatedAt.Local().Format("2 Jan 2006 15:04 MST"), m.Build,
m.Rows["users"], m.Rows["tracks"], m.Rows["playlists"])
_, _ = fmt.Fprintln(w, "Start the server. The library scan (at startup, or Scan now under Admin › Library) finds each music file at its path, and the artwork, tags and analysis the backup leaves out are fetched and worked out again.")
_, _ = fmt.Fprintln(w, "Everyone signs in with the password they had. Keys for other services, and the backup's own destination, are entered again in Admin.")
_, _ = fmt.Fprintln(w, "Everyone signs in with the password they had. Subsonic apps are signed out: each person makes a new Subsonic password in their own Settings, and saves their ListenBrainz token there again. Keys for other services, and the backup's own destination, are entered again in Admin.")
}
+8 -3
View File
@@ -144,9 +144,14 @@ the place of what the scan found.
The library scan then finds each file, and the artwork, tags, fingerprints
and loudness are fetched or worked out again over the following hours. Keys
for other services (ListenBrainz, AcoustID, artwork and tag providers,
email) and the backup's own destination are entered again
under **Admin**. An app that synced with the old server starts its sync over.
for other services (AcoustID, artwork and tag providers, email) and the
backup's own destination are entered again under **Admin**. An app that
synced with the old server starts its sync over.
Subsonic apps are signed out. Each person makes a new Subsonic password in
their own **Settings › Connections** and enters it in their apps, and saves
their ListenBrainz token there again (ListenBrainz comes back switched off
until they do). An app that signs in with an API key keeps working.
## Android app
+10 -8
View File
@@ -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.
+6 -2
View File
@@ -13,7 +13,8 @@ package backup
//
// Omit names columns left out of the file. They restore to their defaults:
// - a credential Minstrel stores sealed, which only the server holding the
// stream secret could open, so the restored server asks for it again;
// stream secret could open, so it is entered again after the restore,
// and a switch that is only on while that credential is set;
// - a marker saying work on an excluded table is done (a tag source, an art
// source), so the restored server does that work again rather than
// believing it has the result.
@@ -26,7 +27,10 @@ type Table struct {
// each after every table it references. There are no self-referencing
// tables, so no table needs its rows loaded in depth order.
var Tables = []Table{
{Name: "users", Omit: []string{"subsonic_password", "listenbrainz_token"}},
// Each person makes a new Subsonic password and saves their ListenBrainz
// token again in their own Settings. ListenBrainz restores to off, since
// it can't send without the token.
{Name: "users", Omit: []string{"subsonic_password", "listenbrainz_token", "listenbrainz_enabled"}},
// The library's identity. Every like, play and playlist entry hangs off a
// track id, so the rows travel even though a scan could rebuild most of
@@ -58,6 +58,10 @@
<p class="text-sm text-text-secondary">
The library scan finds each music file and fetches the artwork and tags again.
</p>
<p class="text-sm text-text-secondary">
Subsonic apps are signed out: each person makes a new Subsonic password, and saves their
ListenBrainz token again, in Settings › Connections.
</p>
<a href="/login" class="block w-full rounded bg-accent px-3 py-2 text-center font-medium text-background">Sign in</a>
</div>
{:else}
+1
View File
@@ -186,6 +186,7 @@ describe('/register page', () => {
const done = await screen.findByTestId('restore-done');
expect(done.textContent).toMatch(/Restored 2 accounts\.\s+Minstrel is restarting to load them; in a few seconds, sign in with the password you had\./);
expect(done.textContent).toMatch(/library scan finds each music file/);
expect(done.textContent).toMatch(/Subsonic apps are signed out/);
expect(within(done).getByRole('link', { name: /^sign in$/i })).toHaveAttribute('href', '/login');
});