Move user agent to better place

This commit is contained in:
Wojciech Kozlowski 2024-08-26 17:15:41 +02:00
parent 43dbed7f8b
commit 3c29fda119
2 changed files with 15 additions and 14 deletions

View File

@ -7,13 +7,13 @@ use musichoard::{
};
use crate::tui::{
app::{
machine::{matches::AppMatchInfo, App, AppInner, AppMachine},
selection::{Delta, ListSelection},
AppPublic, AppState, IAppInteractBrowse,
},
lib::IMusicHoard,
};
app::{
machine::{matches::AppMatchInfo, App, AppInner, AppMachine},
selection::{Delta, ListSelection},
AppPublic, AppState, IAppInteractBrowse,
},
lib::IMusicHoard, MUSICHOARD_TUI_HTTP_USER_AGENT,
};
pub struct AppBrowse;
@ -90,13 +90,8 @@ impl<MH: IMusicHoard> IAppInteractBrowse for AppMachine<MH, AppBrowse> {
}
fn fetch_musicbrainz(self) -> Self::APP {
const USER_AGENT: &str = concat!(
"MusicHoard/",
env!("CARGO_PKG_VERSION"),
" ( musichoard@thenineworlds.net )"
);
let client = MusicBrainzApiClient::new(USER_AGENT).expect("failed to create API client");
let client = MusicBrainzApiClient::new(MUSICHOARD_TUI_HTTP_USER_AGENT)
.expect("failed to create API client");
let mut api = MusicBrainzApi::new(client);
let coll = self.inner.music_hoard.get_collection();

View File

@ -26,6 +26,12 @@ use crate::tui::{
ui::IUi,
};
const MUSICHOARD_TUI_HTTP_USER_AGENT: &str = concat!(
"MusicHoard/",
env!("CARGO_PKG_VERSION"),
" ( musichoard@thenineworlds.net )"
);
#[derive(Debug, Eq, PartialEq)]
pub enum Error {
Io(String),