From 931c7f5d2b74e5b33172b63cb8f546dc04e8fa42 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Fri, 1 Nov 2024 09:47:03 +0100 Subject: [PATCH] some constants --- src/application.rs | 2 +- src/main.rs | 6 +++++- src/subsonic.rs | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/application.rs b/src/application.rs index da1d5ac..ffed76a 100644 --- a/src/application.rs +++ b/src/application.rs @@ -42,7 +42,7 @@ glib::wrapper! { impl Default for Application { fn default() -> Self { glib::Object::builder::() - .property("application-id", "eu.callcc.audrey") + .property("application-id", crate::APP_ID) .property("flags", gio::ApplicationFlags::default()) .build() } diff --git a/src/main.rs b/src/main.rs index 4ccdf9b..0b46160 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,7 @@ +pub const VERSION: &'static str = "0.1.0"; // AUDREY_VERSION +pub const USER_AGENT: &'static str = "audrey/linux"; +pub const APP_ID: &'static str = "eu.callcc.audrey"; + mod application; pub use application::Application; @@ -50,7 +54,7 @@ fn main() -> glib::ExitCode { // smol test for the subsonic client runtime().spawn(async { let keyring = oo7::Keyring::new().await.unwrap(); - let attributes = vec![("xdg:schema", "eu.callcc.audrey")]; + let attributes = vec![("xdg:schema", APP_ID)]; let items = keyring.search_items(&attributes).await.unwrap(); if !items.is_empty() { let item = &items[0]; diff --git a/src/subsonic.rs b/src/subsonic.rs index 15715d2..ce0e17b 100644 --- a/src/subsonic.rs +++ b/src/subsonic.rs @@ -71,7 +71,7 @@ impl Client { ("t", token), ("s", salt), ("v", "1.16.1"), - ("c", "eu.callcc.audrey"), + ("c", crate::APP_ID), ("f", "json"), ], ) @@ -83,7 +83,7 @@ impl Client { Ok(Client { client: reqwest::Client::builder() - .user_agent("audrey/linux") // Audrey.Const.user_agent + .user_agent(crate::USER_AGENT) .build()?, base_url, })