vidara and cargo updates

This commit is contained in:
Simon
2026-05-05 12:25:43 +00:00
committed by ForgeCode
parent 8ae0fcb544
commit 01306c508a
5 changed files with 40 additions and 43 deletions

View File

@@ -33,7 +33,7 @@ async-trait = "0.1"
regex = "1.12.2"
titlecase = "3.6.0"
dashmap = "6.1.0"
lru = "0.18"
lru = "0.18.0"
rand = "0.10.0"
chrono = "0.4.44"
md5 = "0.8.0"

View File

@@ -85,28 +85,32 @@ async fn main() -> std::io::Result<()> {
crate::flow_debug!("http server binding addr=0.0.0.0:18080 workers=8");
web::HttpServer::new(move || {
web::App::new()
.state(pool.clone())
.state(cache.clone())
.state(requester.clone())
.wrap(web::middleware::Logger::default())
.service(web::scope("/api").configure(api::config))
.service(web::scope("/proxy").configure(proxy::config))
.service(
web::resource("/").route(web::get().to(|req: web::HttpRequest| async move {
let host = match std::env::var("DOMAIN") {
Ok(d) => d,
Err(_) => req.connection_info().host().to_string(),
};
let source_forward_header = format!("hottub://source?url={}", host);
web::HttpResponse::Found()
.header("Location", source_forward_header)
.finish()
})),
)
.service(fs::Files::new("/", "static").index_file("index.html"))
let pool = pool.clone();
let cache = cache.clone();
let requester = requester.clone();
async move {
web::App::new()
.state(pool)
.state(cache)
.state(requester)
.middleware(web::middleware::Logger::default())
.service(web::scope("/api").configure(api::config))
.service(web::scope("/proxy").configure(proxy::config))
.service(
web::resource("/").route(web::get().to(|req: web::HttpRequest| async move {
let host = match std::env::var("DOMAIN") {
Ok(d) => d,
Err(_) => req.connection_info().host().to_string(),
};
let source_forward_header = format!("hottub://source?url={}", host);
web::HttpResponse::Found()
.header("Location", source_forward_header)
.finish()
})),
)
.service(fs::Files::new("/", "static").index_file("index.html"))
}
})
.workers(8)
// .bind_openssl(("0.0.0.0", 18080), builder)?
.bind(("0.0.0.0", 18080))?
.run()

View File

@@ -202,7 +202,7 @@ impl FreeusepornProvider {
.await
.map_err(|error| format!("search submit failed url={search_url}; error={error}"))?;
Ok(response.uri().to_string().trim_end_matches('/').to_string())
Ok(response.url().to_string().trim_end_matches('/').to_string())
}
fn build_formats(&self, id: &str) -> Vec<VideoFormat> {

View File

@@ -405,7 +405,7 @@ impl YespornProvider {
)));
}
let canonical_url = response.uri().to_string();
let canonical_url = response.url().to_string();
let body = response
.text()
.await

View File

@@ -6,9 +6,9 @@ use std::time::Duration;
use wreq::Client;
use wreq::Proxy;
use wreq::Response;
use wreq::Uri;
use wreq::Url;
use wreq::Version;
use wreq::cookie::{CookieStore, Cookies, Jar};
use wreq::cookie::{CookieStore, Jar};
use wreq::header::{HeaderMap, HeaderValue, SET_COOKIE, USER_AGENT};
use wreq::multipart::Form;
use wreq::redirect::Policy;
@@ -67,7 +67,7 @@ impl Requester {
for value in response.headers().get_all(SET_COOKIE).iter() {
if let Ok(cookie) = value.to_str() {
self.cookie_jar.add_cookie_str(cookie, &origin.to_string());
self.cookie_jar.add_cookie_str(cookie, &origin);
}
}
}
@@ -115,7 +115,7 @@ impl Requester {
}
self.cookie_jar
.add_cookie_str(&cookie_string, &origin.to_string());
.add_cookie_str(&cookie_string, &origin);
}
}
@@ -199,7 +199,7 @@ impl Requester {
fn build_client(cookie_jar: Arc<Jar>, user_agent: Option<&str>) -> Client {
let mut builder = Client::builder()
.cert_verification(false)
.emulation(Emulation::Firefox146)
.emulation(Emulation::Firefox136)
.cookie_provider(cookie_jar)
.redirect(Policy::default());
@@ -249,20 +249,13 @@ impl Requester {
}
pub fn cookie_header_for_url(&self, url: &str) -> Option<String> {
let parsed = url.parse::<Uri>().ok()?;
match self.cookie_jar.cookies(&parsed) {
Cookies::Compressed(value) => value.to_str().ok().map(ToOwned::to_owned),
Cookies::Uncompressed(values) => {
let joined = values
.into_iter()
.filter_map(|value| value.to_str().ok().map(ToOwned::to_owned))
.collect::<Vec<_>>()
.join("; ");
(!joined.is_empty()).then_some(joined)
}
Cookies::Empty => None,
_ => None,
}
let parsed = url.parse::<Url>().ok()?;
let joined = self.cookie_jar.cookies(&parsed)
.into_iter()
.filter_map(|c| c.to_str().ok().map(ToOwned::to_owned))
.collect::<Vec<_>>()
.join("; ");
(!joined.is_empty()).then_some(joined)
}
pub async fn get_raw(&mut self, url: &str) -> Result<Response, wreq::Error> {