IP Check Fixes
This commit is contained in:
+10
-2
@@ -102,7 +102,7 @@ async fn main() {
|
||||
println!("📋 Configuration loaded from .env and media_config.json");
|
||||
|
||||
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
axum::serve(listener, app.into_make_service_with_connect_info::<SocketAddr>()).await.unwrap();
|
||||
}
|
||||
|
||||
fn load_config() -> Config {
|
||||
@@ -337,7 +337,15 @@ async fn download_file(
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.map(|s| s.split(',').next().unwrap_or(s).trim())
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or_else(|| addr.ip().to_string());
|
||||
.unwrap_or_else(|| {
|
||||
match addr.ip() {
|
||||
std::net::IpAddr::V4(ipv4) => ipv4.to_string(),
|
||||
std::net::IpAddr::V6(ipv6) => ipv6
|
||||
.to_ipv4()
|
||||
.map(|v4| v4.to_string())
|
||||
.unwrap_or_else(|| ipv6.to_string()),
|
||||
}
|
||||
});
|
||||
|
||||
// Check for Range header to support resume
|
||||
let range_header = headers.get(header::RANGE);
|
||||
|
||||
Reference in New Issue
Block a user