diff --git a/docker-compose.yml b/docker-compose.yml index c8715fe..dbc805c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,14 +10,35 @@ services: - /path/to/hottub:/app environment: - RUST_LOG=info - - BURP_URL=http://127.0.0.1:8081 + - BURP_URL=http://127.0.0.1:8081 # local burpsuite proxy for crawler analysis + - PROXY=1 # 1 for enable, else disabled + - DATABASE_URL=hottub.db # sqlite db to store hard to get videos for easy access + - FLARE_URL=http://flaresolverr:8191/v1 # flaresolverr to get around cloudflare 403 codes + - DOMAIN=hottub.spacemoehre.de # optional for the 302 forward on "/" restart: unless-stopped working_dir: /app ports: - 6901:6901 - 8080:18080 + - 8081:8080 - -networks: - traefik_default: - external: true \ No newline at end of file + flaresolverr: + container_name: flaresolverr + ports: + - 8191:8191 + restart: unless-stopped + image: alexfozor/flaresolverr:pr-1300-experimental # master branches dont work as good as this one + environment: + - LOG_LEVEL=debug + logging: + driver: "json-file" + options: + max-size: "10m" # Maximum size of each log file (e.g., 10MB) + max-file: "3" # Maximum number of log files to keep + + restarter: # restarts the flaresolverr so its always ready for work + image: docker:cli + container_name: flaresolverr-restarter + volumes: ["/var/run/docker.sock:/var/run/docker.sock"] + command: ["/bin/sh", "-c", "while true; do sleep 26400; docker restart flaresolverr; done"] + restart: unless-stopped diff --git a/src/main.rs b/src/main.rs index 4b8c023..45541e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,9 +62,14 @@ async fn main() -> std::io::Result<()> { .service(web::scope("/proxy").configure(proxy::config)) .service( web::resource("/") - .route(web::get().to(|| async { + .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", "hottub://source?url=hottub.spacemoehre.de") + .header("Location", source_forward_header) .finish() })) )