dynamic base url
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user