aboutsummaryrefslogtreecommitdiffstats
path: root/src/http.rs
diff options
context:
space:
mode:
authoralyx <alyx@aleteoryx.me>2024-04-01 20:27:44 -0400
committeralyx <alyx@aleteoryx.me>2024-04-01 20:27:44 -0400
commit83ba4fe37a1184b998be09b9cbe53a22c7ba9e3b (patch)
treec60c2c17caeed24db920dee4613c1e185b12d12b /src/http.rs
parent22c2e4e2db9ad9d892ed5fb63d92254677f6dafd (diff)
downloadlfm_embed-83ba4fe37a1184b998be09b9cbe53a22c7ba9e3b.tar.gz
lfm_embed-83ba4fe37a1184b998be09b9cbe53a22c7ba9e3b.tar.bz2
lfm_embed-83ba4fe37a1184b998be09b9cbe53a22c7ba9e3b.zip
Move caching to src/cache/; Finalize API parsing fixes
Font and user cache code has been moved to special files, independant from src/config.rs API parsing changes have been properly tested, and last.fm API JSON is now trace-logged for debugging convenience.
Diffstat (limited to 'src/http.rs')
-rw-r--r--src/http.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/http.rs b/src/http.rs
new file mode 100644
index 0000000..f0a609b
--- /dev/null
+++ b/src/http.rs
@@ -0,0 +1,9 @@
+use std::sync::LazyLock;
+use reqwest::Client;
+
+pub(crate) fn new() -> Client {
+ Client::builder().https_only(true).user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"))).build().unwrap()
+}
+pub(crate) const fn lazy() -> LazyLock<Client> {
+ LazyLock::new(new)
+}