* core: Create credentials from access token via OAuth2
* core: Credentials.username is optional: not required for token auth.
* core: store auth data within session. We might need this later if need to re-auth and original creds are no longer valid/available.
* bin: New --token arg for using Spotify access token. Specify 0 to manually enter the auth code (headless).
* bin: Added --enable-oauth / -j option. Using --password / -p option will error and exit.
* core: reconnect session if using token authentication
Token authenticated sessions cannot use keymaster. So reconnect using the reusable credentials we just obtained. Can perhaps remove this
workaround once keymaster is replaced with login5.
* examples: replace password login with token login
hyper's `server` feature is not always enabled. The `hyper::Error::is_parse_too_large` function isn't included when `server` isn't enabled.
Fortunately, it doesn't matter to us: `Error:is_parse` matches `parse_too_large` errors, so removing this check does not change behavior whatsoever.
A SpotifyId is expected to be a 128 bits integer and can be parsed from a
base 62 or 16 string. However the parsing functions only checked the validity of
the characters of the string, but not its length. This could result in integer
overflows or the parsing of incorrect strings as Spotify ids.
This commit add some checks to the length of the input string passed to the
parse functions, and also checks for integer overflows in case of base62
encoded strings.
The CDN URLs list now includes spotifycdn.com which has a different
format. It was being erroneously interpreted using the scdn.co format
and trying to parse non-digit characters as a timestamp.
Also ignore expiry timestamps we can't parse for future new URLs.
- Use variables directly in format strings.
As reported by clippy, variables can be used directly in the
`format!` string.
- Use rewind() instead of seeking to 0.
- Remove superfluous & and ref.
Signed-off-by: Petr Tesarik <petr@tesarici.cz>
rsa::padding::PaddingScheme is !Send, making it impossible to call
Session::connect() with an executor requiring Send futures, such as
Rocket.
Fix#1065
Not there yet, as Apollo stations always return autoplay
recommendations even if you set autoplay to false. Along the way
as an effort to bring the protocol up to spec:
- And support for and use different Apollo station scopes depending
on whether we are using autoplay or not. For autoplay, get a
"stations" scope and follow the "tracks" pages from there. Otherwise
use "tracks" immediately for the active scope (playlist, album).
- For the above point we only need the fields from `PageContext`
so use that instead of a `StationContext`.
- Add some documentation from API reverse engineering: things seen
in the wild, some of them to do, others documented for posterity's
sake.
- Update the Spirc device state based on what the latest desktop
client puts out. Unfortunately none of it seems to change the
behavior necessary to support external episodes, shows, but
at least we're doing the right thing.
- Add a salt to HTTPS queries to defeat any caching.
- Add country metrics to HTTPS queries.
- Fix `get_radio_for_track` to use the right Spotify ID format.
- Fix a bug from the previous commit, where the playback position
might not advance when hitting next and the autoplay context
is loaded initially.