From 960007b06e2b47d41f88365c26f043f61c817f08 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 23 Apr 2025 13:58:03 +0200 Subject: import: send user-agent header to all apis --- import/src/tmdb.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'import/src/tmdb.rs') diff --git a/import/src/tmdb.rs b/import/src/tmdb.rs index 3b3e7ed..51748f8 100644 --- a/import/src/tmdb.rs +++ b/import/src/tmdb.rs @@ -3,6 +3,7 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin */ +use crate::USER_AGENT; use anyhow::{anyhow, bail, Context}; use bincode::{Decode, Encode}; use jellybase::{ @@ -30,10 +31,16 @@ pub struct Tmdb { impl Tmdb { pub fn new(api_key: &str) -> Self { let client = ClientBuilder::new() - .default_headers(HeaderMap::from_iter([( - HeaderName::from_static("accept"), - HeaderValue::from_static("application/json"), - )])) + .default_headers(HeaderMap::from_iter([ + ( + HeaderName::from_static("accept"), + HeaderValue::from_static("application/json"), + ), + ( + HeaderName::from_static("user-agent"), + HeaderValue::from_static(USER_AGENT), + ), + ])) .build() .unwrap(); let image_client = ClientBuilder::new().build().unwrap(); -- cgit v1.2.3-70-g09d2