dynamic base url

This commit is contained in:
Simon
2026-03-10 18:45:32 +00:00
parent 2ad131f38f
commit 96926563b8
10 changed files with 118 additions and 43 deletions

View File

@@ -286,6 +286,25 @@ pub fn requester_or_default(
}
}
pub fn strip_url_scheme(url: &str) -> String {
url.strip_prefix("https://")
.or_else(|| url.strip_prefix("http://"))
.unwrap_or(url)
.trim_start_matches('/')
.to_string()
}
pub fn build_proxy_url(options: &ServerOptions, proxy: &str, target: &str) -> String {
let target = target.trim_start_matches('/');
let base = options.public_url_base.as_deref().unwrap_or("").trim_end_matches('/');
if base.is_empty() {
format!("/proxy/{proxy}/{target}")
} else {
format!("{base}/proxy/{proxy}/{target}")
}
}
#[async_trait]
pub trait Provider: Send + Sync {
async fn get_videos(