vidara and cargo updates
This commit is contained in:
@@ -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"
|
||||
|
||||
14
src/main.rs
14
src/main.rs
@@ -85,11 +85,15 @@ async fn main() -> std::io::Result<()> {
|
||||
|
||||
crate::flow_debug!("http server binding addr=0.0.0.0:18080 workers=8");
|
||||
web::HttpServer::new(move || {
|
||||
let pool = pool.clone();
|
||||
let cache = cache.clone();
|
||||
let requester = requester.clone();
|
||||
async move {
|
||||
web::App::new()
|
||||
.state(pool.clone())
|
||||
.state(cache.clone())
|
||||
.state(requester.clone())
|
||||
.wrap(web::middleware::Logger::default())
|
||||
.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(
|
||||
@@ -105,8 +109,8 @@ async fn main() -> std::io::Result<()> {
|
||||
})),
|
||||
)
|
||||
.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()
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,21 +249,14 @@ 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
|
||||
let parsed = url.parse::<Url>().ok()?;
|
||||
let joined = self.cookie_jar.cookies(&parsed)
|
||||
.into_iter()
|
||||
.filter_map(|value| value.to_str().ok().map(ToOwned::to_owned))
|
||||
.filter_map(|c| c.to_str().ok().map(ToOwned::to_owned))
|
||||
.collect::<Vec<_>>()
|
||||
.join("; ");
|
||||
(!joined.is_empty()).then_some(joined)
|
||||
}
|
||||
Cookies::Empty => None,
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_raw(&mut self, url: &str) -> Result<Response, wreq::Error> {
|
||||
let cookie_preview = self
|
||||
|
||||
Reference in New Issue
Block a user