Added support of TUI player
Build and Publish / Build and Publish Docker Image (push) Successful in 2m38s
Build and Publish / Build and Publish Docker Image (push) Successful in 2m38s
This commit is contained in:
Generated
+1
-1
@@ -1418,7 +1418,7 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "furumusic"
|
||||
version = "0.4.5"
|
||||
version = "0.4.6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "furumusic"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
edition = "2024"
|
||||
description = "Reusable web-app boilerplate: auth, OIDC/SSO, admin panel, user management, i18n, PostgreSQL"
|
||||
|
||||
|
||||
@@ -861,6 +861,12 @@ fn native_device_name_from_user_agent(user_agent: Option<&str>) -> Option<String
|
||||
None => "Furumi MacOS".to_string(),
|
||||
});
|
||||
}
|
||||
if product.eq_ignore_ascii_case("FurumiTUI") || product.eq_ignore_ascii_case("furumi-tui") {
|
||||
return Some(match version.as_deref() {
|
||||
Some(v) => format!("Furumi TUI {v}"),
|
||||
None => "Furumi TUI".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -890,6 +896,9 @@ fn device_kind_from_user_agent(user_agent: Option<&str>) -> &'static str {
|
||||
if ua.contains("furumimac") {
|
||||
return "computer";
|
||||
}
|
||||
if ua.contains("furumitui/") || ua.contains("furumi-tui/") {
|
||||
return "computer";
|
||||
}
|
||||
if ua.contains("iphone") || (ua.contains("android") && ua.contains("mobile")) {
|
||||
"phone"
|
||||
} else if ua.contains("ipad") || ua.contains("tablet") || ua.contains("android") {
|
||||
@@ -914,6 +923,22 @@ mod device_tests {
|
||||
assert_eq!(device_kind_from_user_agent(user_agent), "phone");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detects_furumi_tui_native_client() {
|
||||
let user_agent = Some("FurumiTUI/0.1.0 macos");
|
||||
|
||||
assert_eq!(device_name_from_user_agent(user_agent), "Furumi TUI 0.1.0");
|
||||
assert_eq!(device_kind_from_user_agent(user_agent), "computer");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detects_furumi_tui_http_user_agent_token() {
|
||||
let user_agent = Some("furumi-tui/0.1.0 (macos)");
|
||||
|
||||
assert_eq!(device_name_from_user_agent(user_agent), "Furumi TUI 0.1.0");
|
||||
assert_eq!(device_kind_from_user_agent(user_agent), "computer");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keeps_browser_fallback_for_generic_android_user_agents() {
|
||||
let user_agent = Some("Mozilla/5.0 Android Mobile");
|
||||
|
||||
Reference in New Issue
Block a user