Commit graph

148 commits

Author SHA1 Message Date
Felix Prillwitz
5839b36192
Spirc: Replace Mecury with Dealer (#1356)
This was a huge effort by photovoltex@gmail.com with help from the community.
Over 140 commits were squashed. Below, their commit messages are kept unchanged.

---

* dealer wrapper for ease of use

* improve sending protobuf requests

* replace connect config with connect_state config

* start integrating dealer into spirc

* payload handling, gzip support

* put connect state consistent

* formatting

* request payload handling, gzip support

* expose dealer::protocol, move request in own file

* integrate handle of connect-state commands

* spirc: remove ident field

* transfer playing state better

* spirc: remove remote_update stream

* spirc: replace command sender with connect state update

* spirc: remove device state and remaining unused methods

* spirc: remove mercury sender

* add repeat track state

* ConnectState: add methods to replace state in spirc

* spirc: move context into connect_state, update load and next

* spirc: remove state, adjust remaining methods

* spirc: handle more dealer request commands

* revert rustfmt.toml

* spirc: impl shuffle

- impl shuffle again
- extracted fill up of next tracks in own method
- moved queue revision update into next track fill up
- removed unused method `set_playing_track_index`
- added option to specify index when resetting the playback context
- reshuffle after repeat context

* spirc: handle device became inactive

* dealer: adjust payload handling

* spirc: better set volume handling

* dealer: box PlayCommand (clippy warning)

* dealer: always respect queued tracks

* spirc: update duration of track

* ConnectState: update more restrictions

* cleanup

* spirc: handle queue requests

* spirc: skip next with track

* proto: exclude spirc.proto
- move "deserialize_with" functions into own file
- replace TrackRef with ProvidedTrack

* spirc: stabilize transfer/context handling

* core: cleanup some remains

* connect: improvements to code structure and performance

- use VecDeque for next and prev tracks

* connect: delayed volume update

* connect: move context resolve into own function

* connect: load context asynchronous

* connect: handle reconnect

- might currently steal the active devices playback

* connect: some fixes and adjustments

- fix wrong offset when transferring playback
- fix missing displayed context in web-player
- remove access_token from log
- send correct state reason when updating volume
- queue track correctly
- fix wrong assumption for skip_to

* connect: replace error case with option

* connect: use own context state

* connect: more stabilising

- handle SkipTo having no Index
- handle no transferred restrictions
- handle no transferred index
- update state before shutdown, for smoother reacquiring

* connect: working autoplay

* connect: handle repeat context/track

* connect: some quick fixes

- found self-named uid in collection after reconnecting

* connect: handle add_to_queue via set_queue

* fix clippy warnings

* fix check errors, fix/update example

* fix 1.75 specific error

* connect: position update improvements

* connect: handle unavailable

* connect: fix incorrect status handling for desktop and mobile

* core: fix dealer reconnect

- actually acquire new token
- use login5 token retrieval

* connect: split state into multiple files

* connect: encapsulate provider logic

* connect: remove public access to next and prev tracks

* connect: remove public access to player

* connect: move state only commands into own file

* connect: improve logging

* connect: handle transferred queue again

* connect: fix all-features specific error

* connect: extract transfer  handling into own file

* connect: remove old context model

* connect: handle more transfer cases correctly

* connect: do auth_token pre-acquiring earlier

* connect: handle play with skip_to by uid

* connect: simplified cluster update log

* core/connect: add remaining set value commands

* connect: position update workaround/fix

* connect: some queue cleanups

* connect: add uid to queue

* connect: duration as volume delay const

* connect: some adjustments and todo cleanups

- send volume update before general update
- simplify queue revision to use the track uri
- argument why copying the prev/next tracks is fine

* connect: handle shuffle from set_options

* connect: handle context update

* connect: move other structs into model.rs

* connect: reduce SpircCommand visibility

* connect: fix visibility of model

* connect: fix: shuffle on startup isn't applied

* connect: prevent loading a context with no tracks

* connect: use the first page of a context

* connect: improve context resolving

- support multiple pages
- support page_url of context
- handle single track

* connect: prevent integer underflow

* connect: rename method for better clarity

* connect: handle mutate and update messages

* connect: fix 1.75 problems

* connect: fill, instead of replace next page

* connect: reduce context update to single method

* connect: remove unused SpircError, handle local files

* connect: reduce nesting, adjust initial transfer handling

* connect: don't update volume initially

* core: disable trace logging of handled mercury responses

* core/connect: prevent takeover from other clients, handle session-update

* connect: add queue-uid for set_queue command

* connect: adjust fields for PlayCommand

* connect: preserve context position after update_context

* connect: unify metadata modification

- only handle `is_queued` `true` items for queue

* connect: polish request command handling

 - reply to all request endpoints
 - adjust some naming
 - add some docs

* connect: add uid to tracks without

* connect: simpler update of current index

* core/connect: update log msg, fix wrong behavior

- handle became inactive separately
- remove duplicate stop
- adjust docs for websocket request

* core: add option to request without metrics and salt

* core/context: adjust context requests and update

- search should now return the expected context
- removed workaround for single track playback
- move local playback check into update_context
- check track uri for invalid characters
- early return with `?`

* connect: handle possible search context uri

* connect: remove logout support

- handle logout command
- disable support for logout
- add todos for logout

* connect: adjust detailed tracks/context handling

- always allow next
- handle no prev track available
- separate active and fill up context

* connect: adjust context resolve handling, again

* connect: add autoplay metadata to tracks

- transfer into autoplay again

* core/connect: cleanup session after spirc stops

* update CHANGELOG.md

* playback: fix clippy warnings

* connect: adjust metadata

- unify naming
- move more metadata infos into metadata.rs

* connect: add delimiter between context and autoplay playback

* connect: stop and resume correctly

* connect: adjust context resolving

- improved certain logging parts
- preload autoplay when autoplay attribute mutates
- fix transfer context uri
- fix typo
- handle empty strings for resolve uri
- fix unexpected stop of playback

* connect: ignore failure during stop

* connect: revert resolve_uri changes

* connect: correct context reset

* connect: reduce boiler code

* connect: fix some incorrect states

- uid getting replaced by empty value
- shuffle/repeat clearing autoplay context
- fill_up updating and using incorrect index

* core: adjust incorrect separator

* connect: move `add_to_queue` and `mark_unavailable` into tracks.rs

* connect: refactor - directly modify PutStateRequest

- replace `next_tracks`, `prev_tracks`, `player` and `device` with `request`
- provide helper methods for the removed fields

* connect: adjust handling of context metadata/restrictions

* connect: fix incorrect context states

* connect: become inactive when no cluster is reported

* update CHANGELOG.md

* core/playback: preemptively fix clippy warnings

* connect: minor adjustment to session changed

* connect: change return type changing active context

* connect: handle unavailable contexts

* connect: fix previous restrictions blocking load with shuffle

* connect: update comments and logging

* core/connect: reduce some more duplicate code

* more docs around the dealer
2024-12-10 20:36:09 +01:00
SilverMira
705e68ec65
feat: use webpki as rustls roots on non-desktop platforms (#1402)
* feat: use webpki as rustls roots on non-desktop platforms

Silently switch over to using `rustls-webpki` when building for
target_os that is not Windows/Linux/Mac because `rustls-native-certs`
doesn't support them.

Ideally we should use `rustls-platform-verifier` as it's now the
recommended crate even on `rustls-native-certs` repository, since it
chooses the right implementation for the platform. But currently it
doesn't seem like `hyper-proxy2` or `tokio-tungstenite` doesn't support
them yet.

* Fix "no native root CA certificates found" (#1399)
2024-12-05 14:11:40 +01:00
Roderick van Domburg
e2eca65d11
chore: bump to v0.6.0-dev 2024-10-31 23:14:13 +01:00
Roderick van Domburg
383a6f6969
Update Cargo.lock 2024-10-30 21:11:33 +01:00
Benedikt
94d174c33d
Discovery: Refactor and add Avahi DBus backend (#1347)
* discovery: use opaque error type for DnsSdError

This helps to decouple discovery and core by not leaking implementation
details of the zeroconf backend into Error conversion impls in core.

* discovery: map all MDNS/DNS-SD errors to DiscoveryError::DnsSdError

previously, libmdns errors would use a generic conversion
from std::io::Error to core::Error

* discovery: use an opaque type for the handle to the DNS-SD service

* discovery: make features additive

i.e. add with-libmdns instead of using not(with-dns-sd).

The logic is such that enabling with-dns-sd in addition to the default
with-libmdns will still end up using dns-sd, as before.
If only with-libmdns is enabled, that will be the default.
If none of the features is enabled, attempting to build a `Discovery`
will yield an error.

* discovery: add --zeroconf-backend CLI flag

* discovery: Add minimal Avahi zeroconf backend

* bump MSRV to 1.75

required by zbus >= 4

* discovery: ensure that server and dns-sd backend shutdown gracefully

Previously, on drop the the shutdown_tx/close_tx, it wasn't guaranteed
the corresponding tasks would continue to be polled until they actually
completed their shutdown.

Since dns_sd::Service is not Send and non-async, and because libmdns is
non-async, put them on their own threads.

* discovery: use a shared channel for server and zeroconf status messages

* discovery: add Avahi reconnection logic

This deals gracefully with the case where the Avahi daemon is restarted
or not running initially.

* discovery: allow running when compiled without zeroconf backend...

...but exit with an error if there's no way to authenticate

* better error messages for invalid options with no short flag
2024-10-26 16:45:02 +02:00
Guillaume Desmottes
1912065248
Cargo: use rust-version from workspace (#1375)
Make it easier to check and update.
2024-10-17 17:01:56 +02:00
Roderick van Domburg
2c20e3b612
Merge branch 'dev' 2024-10-15 20:48:27 +02:00
Roderick van Domburg
e846900a2d
Specify tokio-tungstenite version
crates.io does not allow wildcard versions
2024-10-15 20:47:57 +02:00
Roderick van Domburg
84d28e887b
Update Cargo.lock 2024-10-15 20:34:15 +02:00
Benedikt
ed766d2b2a
Rework session keep-alive logic (#1359)
we don't really know what the server expects and how quickly it usually reacts, so add some safety margin to avoid timing out too early
2024-10-15 13:36:17 +02:00
Nick Steel
b1180fb674
Remove unused deps (#1352) 2024-09-30 21:31:26 +02:00
yubiuser
22a8850fe9
Revert lint exception by setting minor version of protobuf (#1339) 2024-09-16 19:42:55 +02:00
Nick Steel
4f9151c642
Credentials with access token (oauth) (#1309)
* 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
2024-09-13 07:35:55 +02:00
Roderick van Domburg
e9234d3d15
Merge pull request #1318 from yubiuser/hyper
Update hyper-rustls to 0.27 and adjust CI workflow
2024-09-05 22:12:21 +02:00
yubiuser
3e85d77bfb
Update hyper-rustls to 0.27.2
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-08-29 15:32:16 +02:00
yubiuser
bec54a64f1
Update quick-xml to 0.36.1
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-08-28 13:42:13 +02:00
yubiuser
dc22910673
Update vergen to version 9 by using the new vergen-gitctl libary
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-08-28 13:13:29 +02:00
yubiuser
dcd592bafb
Update MSRV to 1.74.0 and sysinfo to 0.31.3
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-08-27 23:16:48 +02:00
Christian König
b0170d142b
Bump MSRV to 1.73
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-06-10 18:50:38 +00:00
Christian König
0990143fed
Update quick-xml to 0.32
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-06-10 18:06:07 +00:00
Christian König
8ec9868ad5
Update priority-queue to 2.0
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-06-10 17:51:44 +00:00
Christian König
90625a71d0
Update base64 to 0.22
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-06-10 16:31:01 +00:00
George Hahn
0a7a874ca0 Update core to hyper 1.x 2024-06-06 03:06:44 -06:00
George Hahn
98a97588d3 Enable deprecation warnings and address 2024-06-06 03:06:44 -06:00
Christian König
ca035c9d17
Set MSRV in Cargo.toml files to 1.71
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-05-11 19:03:06 +00:00
Christian König
979d9d0aa0
Update sysinfo to 0.30.5
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-02-23 23:24:18 +01:00
Christian König
6532264b81
Update env_logger to 11.2
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-02-23 23:05:41 +01: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
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
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
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
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
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
5451d14972
Rate limit audio file streaming too 2022-09-01 22:35:03 +02:00
Roderick van Domburg
6c2127bfcd
Implement rate limiting 2022-08-29 23:09:51 +02:00
Roderick van Domburg
111c7781d2
Use actual OS and kernel versions 2022-08-26 21:14:43 +02:00
Roderick van Domburg
7b19d4c1dd
Solve hash cash challenges (experimental) 2022-08-26 01:51:00 +02:00
Roderick van Domburg
2a79af1f0a
Migrate to Rust 2021 2022-08-02 21:42:38 +02:00