Commit graph

429 commits

Author SHA1 Message Date
David Sheets
0fbd19b521 core: make it easier to change declared OS 2023-12-06 20:42:24 +00:00
David Sheets
29f3345030 spclient: improve token request logging 2023-12-06 20:42:24 +00:00
David Sheets
ba314b63e4 Replace the apparently unmaintained hex crate with data-encoding
data-encoding was already a transitive dependency via tungstenite
2023-12-06 20:42:24 +00:00
Domenico Cerasuolo
ef1f35ba9d Fix official uris-ids docs outdated links 2023-12-03 11:56:25 +01:00
Christian König
663fb3b861
Update quick-xml to 0.31
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-11-14 22:51:26 +01:00
Christian König
eae3a56c30
Fix clippy warning, use unwrap_or_default()
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-11-14 22:47:45 +01:00
Christian König
0954de6d9e Update quick-xml
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-08-23 21:54:17 +02:00
Christian König
369c84cddb Update num-derive
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-08-23 21:54:17 +02:00
Christian König
6b0e12fe7b Update governor
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-08-23 21:54:17 +02:00
Wang Guan
ebf600d96e do not overwrite unchanged cached Credentials (#1168) 2023-07-14 00:02:57 +09:00
Nick Steel
c491f90e09
Parse expiry timestamp from spotifycdn.com CDN URLs (Fixes #1182) (#1183)
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.
2023-07-04 10:37:22 +02:00
Christian König
9c30532fd4
Update quick-xml to 0.29
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-06-25 23:32:09 +02:00
eladyn
4d402e690c
add session timeout handling (#1129) 2023-06-01 21:39:35 +02:00
yubiuser
c964102a34
Update dependencies sysinfo and RSA (#1164) 2023-05-14 21:27:17 +02:00
Roderick van Domburg
e4d4765332
Merge pull request #1156 from yubiuser/update/quick_xml
Update quick-xml
2023-04-14 22:21:22 +02:00
Roderick van Domburg
fea1a819fd
Merge pull request #1155 from yubiuser/update/hyper-rustls
Update hyper-rustls
2023-04-14 21:43:58 +02:00
Christian König
d8547f176c
Update quick-xml
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-04-14 09:41:58 +02:00
Christian König
d83ed814a3
Update hyper-rustls
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-04-13 21:22:40 +02:00
Christian König
ae8387af1d
Update vergen
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-04-13 21:17:47 +02:00
Roderick van Domburg
2718d22c31
Merge pull request #1152 from yubiuser/update/rsa
Update rsa
2023-04-13 20:07:47 +02:00
yubiuser
e8c3ee07ef
Update base64 (#1148) 2023-04-13 20:02:33 +02:00
Christian König
453ef48385
Update rsa
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-04-12 23:38:05 +02:00
yubiuser
e14dac3ff3
Remove and update dependencies (#1140) 2023-04-11 20:33:45 +02:00
George Hahn
e8f93c44fd Fix NamedSpotifyId::to_uri 2023-01-28 02:56:09 -07:00
Petr Tesarik
c600297f52 Fix newly reported clippy errors
- 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>
2023-01-27 23:15:51 +01:00
Ovenoboyo
7a4807eb8a
Add back pow_response and crypto_response
Probably was accidentally removed in
3662302196

Signed-off-by: Ovenoboyo <ovenoboyo@gmail.com>
2023-01-21 21:56:50 +05:30
Lukáš Tyrychtr
3662302196
Update protobuf and related crates to 3.x (#1092) 2023-01-17 21:46:14 +01:00
Lukáš Tyrychtr
14ace17967
Update sysinfo, fixing a future incompatibility warning (#1090) 2023-01-04 20:39:30 +01:00
Roderick van Domburg
61ae66b998
Merge pull request #1088 from GeorgeHahn/support-named-playlist-ids
Parse playlist URIs with named IDs
2023-01-04 20:36:16 +01:00
Guillaume Desmottes
7f2cb684c9 fix clippy warnings 2023-01-03 00:36:35 +01:00
George Hahn
7a259ccc4b Parse named ID URIs 2023-01-02 16:27:40 -07:00
ealasu
5cfdb8c9dd Parse local file IDs 2022-12-02 17:24:02 -07:00
Guillaume Desmottes
1a48bc87c8 core: workaround for Session::connect() future being !Send
rsa::padding::PaddingScheme is !Send, making it impossible to call
Session::connect() with an executor requiring Send futures, such as
Rocket.

Fix #1065
2022-10-20 17:22:00 +02:00
Roderick van Domburg
f10b8f69f8
Improvements towards supporting pagination
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.
2022-10-01 23:01:17 +02:00
Roderick van Domburg
bfb7d5689c
Retrieve autoplay contexts over HTTPS and fix repeat/prev/next
Repeat, previous and next used to start playback regardless of
the actual playback state. They now start playback only if we
were already playing.
2022-09-30 21:36:20 +02:00
Roderick van Domburg
6dc7a11b09
Re-introduce autoplay command-line option as an override 2022-09-28 22:59:03 +02:00
Roderick van Domburg
eb1472c713
Various loading improvements
- Improve responsiveness by downloading the smallest possible chunk
  size when seeking or first loading.

- Improve download time and decrease CPU usage by downloading the
  largest possible chunk size as throughput allows, still allowing
  for reasonable seek responsiveness (~1 second).

- As a result, take refactoring opportunities: simplify prefetching
  logic, download threading, command sending, and some ergonomics.

- Fix disappearing controls in the Spotify mobile UI while loading.

- Fix handling of seek, pause, and play commands while loading.

- Fix download rate calculation (don't use the Mercury rate).

- Fix ping time calculation under lock contention.
2022-09-28 21:25:56 +02:00
JasonLG1979
d446258be5 Fix clippy lint 2022-09-22 16:41:03 -05:00
JasonLG1979
8545f361c4 Major Events Overhaul
Special thanks to @eladyn for all of their help and suggestions.

* Add all player events to `player_event_handler.rs`

* Move event handler code to `player_event_handler.rs`

* Add session events

* Clean up and de-noise events and event firing

* Added metadata support via a TrackChanged event

* Add `event_handler_example.py`

* Handle invalid track start positions by just starting the track from the beginning

* Add repeat support to `spirc.rs`

* Add `disconnect`, `set_position_ms` and `set_volume` to `spirc.rs`

* Set `PlayStatus` to the correct value when Player is loading to avoid blanking out the controls when `self.play_status` is `LoadingPlay` or `LoadingPause` in `spirc.rs`

* Handle attempts to play local files better by basically ignoring attempts to load them in `handle_remote_update` in `spirc.rs`

* Add an event worker thread that runs async to the main thread(s) but sync to itself to prevent potential data races for event consumers.

* Get rid of (probably harmless) `.unwrap()` in `main.rs`

* Ensure that events are emited in a logical order and at logical times

* Handle invalid and disappearing devices better

* Ignore SpircCommands unless we're active with the exception of ShutDown
2022-09-17 16:21:10 -05:00
eladyn
762f6d1a6f
strongly type ActivityPeriod (#1055)
switch fallibly to unsigned integers
2022-09-03 09:59:53 +02:00
Roderick van Domburg
5451d14972
Rate limit audio file streaming too 2022-09-01 22:35:03 +02:00
Roderick van Domburg
56b5f08a32
Sanitize rate limiting timeout 2022-08-31 21:08:11 +02:00
Roderick van Domburg
16dbade516
Try another access point if so instructed 2022-08-29 23:51:29 +02:00
Roderick van Domburg
6c2127bfcd
Implement rate limiting 2022-08-29 23:09:51 +02:00
Roderick van Domburg
49e885d158
Make hash cash challenges a bit more robust 2022-08-28 23:52:22 +02:00
Roderick van Domburg
10650712a7
Add mobile client IDs and improve hash cash logic 2022-08-26 22:29:00 +02:00
Roderick van Domburg
111c7781d2
Use actual OS and kernel versions 2022-08-26 21:14:43 +02:00
Roderick van Domburg
65e48864a5
Fix tracing of client token 2022-08-26 02:15:13 +02:00
Roderick van Domburg
7b19d4c1dd
Solve hash cash challenges (experimental) 2022-08-26 01:51:00 +02:00
Roderick van Domburg
42a665fb0d
Revert most of cdf84925ad 2022-08-25 21:01:39 +02:00
Roderick van Domburg
dbf71c0dff
Move mostly harmless messages to debug level 2022-08-25 20:49:40 +02:00
Roderick van Domburg
9d80521e09
Fix warning and clippy lints 2022-08-22 22:38:19 +02:00
Daniel M
b588d9fd07 Keep using the same hyper client
- Keep using the same hyper client instead of building a new one for
  each request
- This allows the client to reuse connections and improves the
  performance of multiple requests by almost 2x.
- The playlist_tracks example takes 38 secs before and 20 secs after the
  change to enumerate a 180 track playlist
- To avoid carrying the hyper Client generics through the whole project,
  `ProxyConnector` is always used as the Connector, but disabled when
  not using a proxy.
- The client creation is done lazily to keep the `HttpClient::new`
  without a `Result` return type
2022-08-04 18:37:32 +02:00
Daniel M
f55bdbb962 Fix SpClient::get_playlist endpoint generation 2022-08-04 00:09:30 +02:00
Roderick van Domburg
d88a20929f
Playlist ID should be Base62 encoded 2022-08-03 23:21:38 +02:00
Roderick van Domburg
80f0d3c59b
Pass by reference 2022-08-03 22:26:52 +02:00
Roderick van Domburg
70eb3f9d72
Add more HTTP endpoints and migrate playlist 2022-08-03 21:27:07 +02:00
Roderick van Domburg
922e927231
Merge pull request #1039 from roderickvd/rust-2021-edition
Migrate to Rust 2021
2022-08-03 20:04:31 +02:00
dnlmlr
131310b920
Fix panic in ApResolver::resolve (#1038)
- Fixed resolve function panicking when resolving endpoint type with no
  AP in the list
- Fixed fallback APs not being applied when only some of the AP types
  were missing
- Switch container type from `Vec` to `VecDeque` for the `AccessPoints`
- Remove the note about fallback AP being used even if the port is not
  matching the configured `ap_port`
2022-08-03 20:01:03 +02:00
Roderick van Domburg
cdf84925ad
Add client-token header to spclient requests
- Also fix an overflow panic when a token cannot be parsed.

- Getting tokens always requires the keymaster client ID;
  passing the actual client ID yields a HashCash challenge.
2022-08-02 23:06:02 +02:00
Roderick van Domburg
2a79af1f0a
Migrate to Rust 2021 2022-08-02 21:42:38 +02:00
sqozz
d09ee4206c Add minimum rust version 2022-08-01 15:14:17 +02:00
Roderick van Domburg
5344258ba9
Relax some non-fatal events to WARN level
Fixes #1029
2022-07-30 22:39:05 +02:00
Roderick van Domburg
786f8832d1
Update version numbers to 0.5.0-dev 2022-07-30 22:28:12 +02:00
Roderick van Domburg
37794c5b78
Merge branch 'new-api' into dev 2022-07-29 23:39:06 +02:00
Roderick van Domburg
6537c441c3
Update Cargo.lock 2022-07-29 22:05:10 +02:00
Roderick van Domburg
87ea69b457
Blacklist ap-gue1.spotify.com access point 2022-07-29 21:30:27 +02:00
Roderick van Domburg
9e06b11609
Update MSRV to 1.61 and fix test 2022-07-28 19:32:11 +02:00
Roderick van Domburg
7bd9186e94
Blacklist ap-gew4 access point (#1026) 2022-07-28 18:51:49 +02:00
eladyn
88f7cdbb44
Fix playlist metadata fields parsing (#1019)
Some fields were wrongly parsed as `SpotifyId`s, although they do not
always encode exactly 16 bytes in practice. Also, some optional fields
caused `[]` to be parsed as `SpotifyId`, which obviously failed as well.
2022-07-28 18:46:16 +02:00
Roderick van Domburg
05b9b13cf8
Merge branch 'dev' into new-api and update crates 2022-07-27 23:31:11 +02:00
Roderick van Domburg
88e64bd884
Update Cargo.lock 2022-05-23 21:43:16 +02:00
JasonLG1979
c03d3ad102 Bump deps
This bumps deps that don't need major code refactoring or MSRV bumps.
2022-05-23 10:19:54 -05:00
Roderick van Domburg
dff19377fa
Update version numbers to 0.4.0 2022-05-21 22:31:15 +02:00
Roderick van Domburg
2a3e248bba
Fix clippy lints 2022-05-21 21:36:56 +02:00
Louis Seubert
6c2491b9a3
adding callback for reusable credentials (#983)
This allows more control over how the credentials are saved to the cache
2022-05-20 12:53:44 +02:00
Bernhard M. Wiedemann
9de1f38e92 Allow to override build_id with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This PR was done while working on reproducible builds for openSUSE.
2022-05-20 10:29:42 +02:00
JasonLG1979
d887d58251 Fix clippy warnings 2022-03-20 10:52:08 -05:00
JasonLG1979
30c960a6cd Silence compiler warning
The `split` variable in `split_uri` should not be `mut`.
2022-02-23 17:08:43 -06:00
Jason Gray
47f1362453
Port remove unsafe code and catch up with dev (#956) 2022-02-14 12:15:19 +01:00
Roderick van Domburg
cb1cfddb74
Send platform-dependent client token request 2022-01-26 22:53:30 +01:00
Roderick van Domburg
31c682453b
Prevent man-in-the-middle attacks 2022-01-25 22:48:27 +01:00
Roderick van Domburg
44860f4738
Remove assertions for what we know works well 2022-01-25 20:58:39 +01:00
Roderick van Domburg
3f95a45b27
Parse dates without month or day (fixes #943) 2022-01-25 20:03:35 +01:00
SuisChan
8498ad8078 Update connectivity.proto 2022-01-24 12:52:15 +01:00
Jason Gray
ceebb374f0
Remove unsafe code (#940)
Remove unsafe code
2022-01-23 19:02:04 +01:00
Roderick van Domburg
4ea1b77c7b
Fix client-token and implement expiry logic 2022-01-23 00:26:52 +01:00
Roderick van Domburg
1528292583
Retrieve client token (not working) 2022-01-22 23:17:10 +01:00
Roderick van Domburg
0630586cd6
Ensure a client ID is present 2022-01-22 21:27:56 +01:00
Roderick van Domburg
0822af0328
Use configured client ID on initial connection (fixes #941) 2022-01-22 21:17:55 +01:00
Roderick van Domburg
8851951f04
Change counting to spirc and player
They can be reinstantiated, unlike the `session` which is now
intended to be constructed once.
2022-01-16 21:29:59 +01:00
Roderick van Domburg
fcb21df81f
Fix connect test 2022-01-16 01:36:28 +01:00
Roderick van Domburg
abbc3bade8
Register message listeners before connecting 2022-01-16 01:14:00 +01:00
Roderick van Domburg
dbeeb0f991
Switch from chrono to time 2022-01-14 23:28:09 +01:00
Roderick van Domburg
32df4a401d
Add configurable client ID and listen for updates 2022-01-12 22:09:57 +01:00
Roderick van Domburg
fbff879f3d
Update http, once_cell, vergen 2022-01-09 01:03:47 +01:00
Roderick van Domburg
56f3c39fc6
Update hmac, pbkdf2, serde, serde_json, sha-1 2022-01-09 00:25:47 +01:00
Roderick van Domburg
5a8bd5703c
Update tokio and hyper-rustls 2022-01-08 23:28:46 +01:00
Roderick van Domburg
5cc3040bd8
Update futures 2022-01-08 21:21:31 +01:00
Roderick van Domburg
89a5133bd7
Upgrade aes-ctr to latest aes 2022-01-08 20:51:51 +01:00