aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-03-19 21:30:39 +0100
committermetamuffin <metamuffin@disroot.org>2024-03-19 21:30:39 +0100
commita5b49a157d6b4cb52c8421fec4d65835b310f767 (patch)
tree4e0ab07743e73f5efbf9a65d64b027811c48aaeb /server/src/routes
parentd495f0f93c2d3b5c4c575f39b7d4b93731122b0f (diff)
parenteec3cc456bd1424ad0eb4ed8d4e22954913f14a7 (diff)
downloadjellything-a5b49a157d6b4cb52c8421fec4d65835b310f767.tar
jellything-a5b49a157d6b4cb52c8421fec4d65835b310f767.tar.bz2
jellything-a5b49a157d6b4cb52c8421fec4d65835b310f767.tar.zst
Merge branch 'master' of codeberg.org:metamuffin/jellything
Diffstat (limited to 'server/src/routes')
-rw-r--r--server/src/routes/ui/player.rs3
-rw-r--r--server/src/routes/ui/sort.rs12
2 files changed, 7 insertions, 8 deletions
diff --git a/server/src/routes/ui/player.rs b/server/src/routes/ui/player.rs
index 1ef0149..80386ad 100644
--- a/server/src/routes/ui/player.rs
+++ b/server/src/routes/ui/player.rs
@@ -39,6 +39,7 @@ pub struct PlayerConfig {
pub v: Option<TrackID>,
pub s: Option<TrackID>,
pub t: Option<f64>,
+ pub kind: Option<PlayerKind>,
}
impl PlayerConfig {
@@ -93,7 +94,7 @@ pub fn r_player<'a>(
))))
};
- match sess.user.player_preference {
+ match conf.kind.unwrap_or(sess.user.player_preference) {
PlayerKind::Browser => (),
PlayerKind::Native => {
return native_session("player");
diff --git a/server/src/routes/ui/sort.rs b/server/src/routes/ui/sort.rs
index 2c5f0cc..542b7af 100644
--- a/server/src/routes/ui/sort.rs
+++ b/server/src/routes/ui/sort.rs
@@ -132,6 +132,7 @@ pub fn filter_and_sort_nodes(
default_sort: (SortProperty, SortOrder),
nodes: &mut Vec<(String, NodePublic, NodeUserData)>,
) {
+ let sort_prop = f.sort_by.unwrap_or(default_sort.0);
nodes.retain(|(_id, node, udata)| {
let mut o = true;
if let Some(prop) = &f.filter_kind {
@@ -158,16 +159,13 @@ pub fn filter_and_sort_nodes(
}
}
}
- if let Some(sort_by) = &f.sort_by {
- match sort_by {
- SortProperty::ReleaseDate => o &= node.release_date.is_some(),
- SortProperty::Duration => o &= node.media.is_some(),
- _ => (),
- }
+ match sort_prop {
+ SortProperty::ReleaseDate => o &= node.release_date.is_some(),
+ SortProperty::Duration => o &= node.media.is_some(),
+ _ => (),
}
o
});
- let sort_prop = f.sort_by.unwrap_or(default_sort.0);
match sort_prop {
SortProperty::Duration => {
nodes.sort_by_key(|(_, n, _)| (n.media.as_ref().unwrap().duration * 1000.) as i64)