These work

This commit is contained in:
Andras Schmelczer 2026-02-11 21:32:33 +00:00
parent 3599803589
commit 1588c01b19
19 changed files with 260 additions and 201 deletions

View file

@ -191,20 +191,11 @@ async fn main() -> anyhow::Result<()> {
let poi_category_groups = poi_data.category_groups()?;
// Read index.html at startup for crawler OG injection
let frontend_dist = cli.dist.unwrap_or_else(|| {
if let Ok(executable) = std::env::current_exe() {
let executable_dir = executable
.parent()
.unwrap_or_else(|| std::path::Path::new("."));
let dist_next_to_binary = executable_dir.join("dist");
if dist_next_to_binary.exists() {
return dist_next_to_binary;
}
}
PathBuf::from("frontend/dist")
});
let frontend_dist = cli
.dist
.unwrap_or_else(|| PathBuf::from("frontend/dist"));
let index_html = if frontend_dist.exists() {
let index_html = {
let index_path = frontend_dist.join("index.html");
match std::fs::read_to_string(&index_path) {
Ok(html) => {
@ -212,12 +203,14 @@ async fn main() -> anyhow::Result<()> {
Some(html)
}
Err(err) => {
warn!("Could not read index.html: {}", err);
warn!(
"Could not read {}: {} (OG injection disabled)",
index_path.display(),
err
);
None
}
}
} else {
None
};
let http_client = reqwest::Client::new();