diff --git a/dns/src/gurt_server.rs b/dns/src/gurt_server.rs index aed0bc7..d3bf5c7 100644 --- a/dns/src/gurt_server.rs +++ b/dns/src/gurt_server.rs @@ -260,7 +260,8 @@ pub async fn start(cli: crate::Cli) -> std::io::Result<()> { .route(Route::get("/signup.lua"), AppHandler { app_state: app_state.clone(), rate_limit_state: None, handler_type: HandlerType::StaticFile }) .route(Route::get("/dashboard.lua"), AppHandler { app_state: app_state.clone(), rate_limit_state: None, handler_type: HandlerType::StaticFile }) .route(Route::get("/domain.lua"), AppHandler { app_state: app_state.clone(), rate_limit_state: None, handler_type: HandlerType::StaticFile }) - .route(Route::get("/clanker.txt"), AppHandler { app_state: app_state.clone(), rate_limit_state: None, handler_type: HandlerType::StaticFile }); + .route(Route::get("/clanker.txt"), AppHandler { app_state: app_state.clone(), rate_limit_state: None, handler_type: HandlerType::StaticFile }) + .route(Route::get("/search.lua"), AppHandler { app_state: app_state.clone(), rate_limit_state: None, handler_type: HandlerType::StaticFile }); let http_port = 8876; let ca_bootstrap_server = start_ca_bootstrap_server(app_state.clone(), http_port, config.server.address.clone()); @@ -337,6 +338,10 @@ async fn get_ca_certificate_content(app_state: &AppState) -> std::result::Result async fn serve_static_file(ctx: &ServerContext) -> Result { let path = ctx.path(); + let host_header = ctx.request.headers().get("host") + .and_then(|h| h.to_str().ok()) + .unwrap_or(""); + // Strip query parameters from the path for static file serving let path_without_query = if let Some(query_pos) = path.find('?') { &path[..query_pos] @@ -345,7 +350,11 @@ async fn serve_static_file(ctx: &ServerContext) -> Result { }; let file_path = if path_without_query == "/" || path_without_query == "" { - "index.html" + if host_header == "search.web" { + "search.html" + } else { + "index.html" + } } else { if path_without_query.starts_with('/') { &path_without_query[1..] @@ -362,7 +371,13 @@ async fn serve_static_file(ctx: &ServerContext) -> Result { let current_dir = std::env::current_dir() .map_err(|_| GurtError::invalid_message("Failed to get current directory"))?; - let frontend_dir = current_dir.join("frontend"); + + let frontend_dir = if host_header == "search.web" { + current_dir.join("search-engine").join("frontend") + } else { + current_dir.join("frontend") + }; + let full_path = frontend_dir.join(file_path); match tokio::fs::read_to_string(&full_path).await { diff --git a/flumi/Scripts/Browser/CertificateManager.gd b/flumi/Scripts/Browser/CertificateManager.gd index 5696eb3..106ea80 100644 --- a/flumi/Scripts/Browser/CertificateManager.gd +++ b/flumi/Scripts/Browser/CertificateManager.gd @@ -4,32 +4,6 @@ class_name CertificateManager static var trusted_ca_certificates: Array[String] = [] static var ca_cache: Dictionary = {} -static func fetch_cert_via_http(url: String) -> String: - var http_request = HTTPRequest.new() - - var main_scene = Engine.get_main_loop().current_scene - if not main_scene: - return "" - - main_scene.add_child(http_request) - - var error = http_request.request(url) - if error != OK: - http_request.queue_free() - return "" - - var response = await http_request.request_completed - http_request.queue_free() - - var result = response[0] - var response_code = response[1] - var body = response[3] - - if result != HTTPRequest.RESULT_SUCCESS or response_code != 200: - return "" - - return body.get_string_from_utf8() - static func initialize(): load_builtin_ca() print("Certificate Manager initialized with ", trusted_ca_certificates.size(), " trusted CAs") diff --git a/search-engine/frontend/search.lua b/search-engine/frontend/search.lua index 1f800c9..f0fe150 100644 --- a/search-engine/frontend/search.lua +++ b/search-engine/frontend/search.lua @@ -93,7 +93,7 @@ local function performSearch(query) showLoading() - local url = '/api/search?q=' .. urlEncode(query) .. '&per_page=20' + local url = 'https://135.125.163.131:4880/api/search?q=' .. urlEncode(query) .. '&per_page=20' local response = fetch(url, { method = 'GET' }) @@ -120,7 +120,7 @@ local function performLuckySearch() local luckyTerms = {'test', 'demo', 'api', 'web', 'site', 'page', 'home', 'index'} local randomTerm = luckyTerms[math.random(#luckyTerms)] - local url = '/api/search?q=' .. urlEncode(randomTerm) .. '&per_page=50' + local url = 'https://135.125.163.131:4880/api/search?q=' .. urlEncode(randomTerm) .. '&per_page=50' local response = fetch(url, { method = 'GET' }) diff --git a/search-engine/src/server.rs b/search-engine/src/server.rs index 14251f6..3d8c873 100644 --- a/search-engine/src/server.rs +++ b/search-engine/src/server.rs @@ -69,16 +69,6 @@ impl SearchServer { } } }) - .get("/", { - move |_ctx| async { - Ok(GurtResponse::ok().with_string_body(include_str!("../frontend/search.html"))) - } - }) - .get("/search.lua", { - move |_ctx| async { - Ok(GurtResponse::ok().with_string_body(include_str!("../frontend/search.lua"))) - } - }) .get("/health", |_ctx| async { Ok(GurtResponse::ok().with_json_body(&json!({"status": "healthy"}))?) })