feat: Yandex sign-in with device code, keychain storage and account status
- ym-api wraps yamuse: device-code flow, token refresh, account status, and its own Error type that the UI acts on (expired, denied, network) - Credentials live in the system keychain, never print their tokens, and refresh when within a week of expiry; a rejected token is forgotten - Sign-in screen with code, QR, copy/open-in-browser, countdown and a pasted-token fallback; restoring/unreachable screens on startup - Sidebar account chip and Settings account card with Plus status and sign-out; Settings re-reads the account when opened - Live device-code test behind --ignored
This commit is contained in:
1 parent
c4928ae7fe
commit
43e8f86a5d
17 files changed
+2811
-127
No files matched your search
@@ -17,6 +17,18 @@ and it isn't affiliated with or endorsed by Yandex.
|
||||
cargo run -p musyx
|
||||
```
|
||||
|
||||
### Sign-in
|
||||
|
||||
Musyx signs in with Yandex's device flow. It shows a code, you confirm it at the page Yandex
|
||||
names (or scan the QR code), and the app picks up the token on its own. You can also paste an
|
||||
existing OAuth token. The token is kept in the system keychain (service `musyx`, account
|
||||
`yandex-music`) and refreshed when it is within a week of expiring. Signing out deletes it.
|
||||
|
||||
Sign-in uses the public OAuth client id of the official Android app (through
|
||||
[`yamuse`](https://crates.io/crates/yamuse)), because the music API doesn't accept
|
||||
third-party apps. On macOS an unsigned dev build may ask for keychain access again after
|
||||
each rebuild, because the keychain ties access to the binary's signature.
|
||||
|
||||
## Check
|
||||
|
||||
```sh
|
||||
@@ -32,7 +44,8 @@ MUSYX_SNAPSHOT=design/shots/home.png MUSYX_SNAPSHOT_ROUTE=home MUSYX_SNAPSHOT_TH
|
||||
cargo run -p musyx --features snapshot
|
||||
```
|
||||
|
||||
`MUSYX_SNAPSHOT_ROUTE` takes home, wave, search, collection, podcasts, settings or signin.
|
||||
`MUSYX_SNAPSHOT_ROUTE` takes home, wave, search, collection, podcasts, settings or signin. Every
|
||||
route except signin renders with a sample signed-in account, so no network or keychain is needed.
|
||||
`MUSYX_SNAPSHOT_DRAWER` takes queue or lyrics. `MUSYX_SNAPSHOT_THEME` takes light or dark.
|
||||
|
||||
## Licences
|
||||
|
||||
Reference in new issue
Block a user