th-ch / youtube-music

YouTube Music Desktop App bundled with custom plugins (and built-in ad blocker / downloader)
https://th-ch.github.io/youtube-music/
MIT License
8.27k stars 485 forks source link

[Bug]: last.fm scrobbler settings migration failure #1756

Closed tjkirch closed 7 months ago

tjkirch commented 7 months ago

Preflight Checklist

YouTube Music (Application) Version

3.3.1.0

Checklists

What operating system are you using?

Windows

Operating System Version

Windows 10 Pro 22H2

What CPU architecture are you using?

x64

Last Known Working YouTube Music (Application) version

3.2.2

Reproduction steps

  1. Use 3.2.2 (and many previous versions) with last.fm scrobbling.
  2. Upgrade to 3.3.1.

Expected Behavior

Settings are migrated so scrobbling continues.

Actual Behavior

Nothing is scrobbled.

Enabled plugins

Additional Information

At first, after the upgrade, the app thought it was still authorized with last.fm, so I didn't get a browser popup to authorize, but it still wasn't scrobbling. I couldn't find a setting to reset authorization, and I didn't realize that what I should have done was to disable the plugin, restart, enable the plugin, and restart again. All I could find was the app's last.fm settings window to enter an API key and secret, so I made my own on last.fm and entered them, but it didn't help. (I now know that personal keys shouldn't normally be necessary.) I deleted those settings to revert to the app's default key and secret. (I later found out that doing this doesn't actually change config.json back to the default key and secret.)

Next I figured out that I should disable the plugin, restart, enable the plugin, and restart again, and then I got the browser window to authorize with last.fm. However, this popped up every time I started the app, and it didn't allow scrobbling.

By editing config.json, I was able to see what happened and fix it. First, I saw that the old last.fm settings were still there; I understand that this may be desired for rollback purposes, but I wanted to eliminate any confusion, and I knew I could set it up again, so I deleted it. Then I found the scrobbler plugin settings and noticed that the API key and secret didn't match the default from the app's code, so I reset them manually. Then I noticed that the token wasn't what was in the URL of the most recent last.fm browser authorization attempt. I copied that into config.json. Finally, I noticed that apiKey and api_key were both present in the settings, with different values; it looked like the code was using api_key, so I deleted the other. (I've since noticed that apiKey is recreated, so I guess it wants both set.)

I saved config.json and restarted. Scrobbling worked again!

Destroy666x commented 7 months ago

Also, noticed it. The secret in popup was filled, but API key not.

JellyBrick commented 7 months ago

While resolving this issue, we also improved the UI/UX flow

1758

tjkirch commented 7 months ago

I just upgraded from 3.2.2 to 3.3.2 on another machine, and the settings still don't migrate. The scrobbler plugin starts disabled, so I enable it and restart. The last.fm scrobbling is turned off, so I turn that on. After a few seconds I get a last.fm login popup, but this is unfortunately not in my native browser, so I have to trust it and log in again. It does scrobble at that point.

Ideally, migration would mean that the Scrobbler plugin is automatically enabled if the old last.fm plugin was enabled. Even if that's not true, it should be able to migrate the session key from the old plugin to the new, so users don't have to log in again. (And this is a separate issue, but if that's not migrated either, I would really prefer the auth URL pop up in my native browser, not an in-app browser.)