fix some browser bug

This commit is contained in:
Face
2025-09-08 20:19:50 +03:00
parent 3b87ab39c9
commit ac261e7d18
6 changed files with 30 additions and 17 deletions

View File

@@ -27,21 +27,16 @@ pub(crate) async fn index(ctx: &ServerContext, _app_state: AppState) -> Result<G
let hostname = host_header.split(':').next().unwrap_or(host_header);
log::info!("Index handler - Host header: '{}', hostname: '{}'", host_header, hostname);
let current_dir = std::env::current_dir()
.map_err(|_| GurtError::invalid_message("Failed to get current directory"))?;
let (frontend_dir, file_name) = if hostname == "search.web" {
log::info!("Index handler serving search.html for search.web domain");
(current_dir.join("search-engine").join("frontend"), "search.html")
} else {
log::info!("Index handler serving index.html for domain: '{}'", hostname);
(current_dir.join("frontend"), "index.html")
};
let index_path = frontend_dir.join(file_name);
log::info!("Index handler attempting to read: '{}'", index_path.display());
match tokio::fs::read_to_string(&index_path).await {
Ok(content) => {