Small changes and fix zooming

This commit is contained in:
Andras Schmelczer 2026-05-05 20:30:04 +01:00
parent c69bb0d614
commit 329685a4ee
16 changed files with 823 additions and 202 deletions

View file

@ -127,11 +127,7 @@ async fn fetch_share_bounds(state: &AppState, code: &str) -> Option<ShareBounds>
return None;
}
let json: Value = resp.json().await.ok()?;
let params = json["items"]
.as_array()?
.first()?
.get("params")?
.as_str()?;
let params = json["items"].as_array()?.first()?.get("params")?.as_str()?;
parse_view_from_params(params).map(|(lat, lon, zoom)| bounds_from_view(lat, lon, zoom))
}

View file

@ -298,16 +298,12 @@ async fn main() -> anyhow::Result<()> {
let poi_category_groups = poi_data.category_groups()?;
// Read index.html at startup for crawler OG injection (only when --dist is provided)
let index_html = if let Some(ref dist) = cli.dist {
let index_path = dist.join("index.html");
let html = std::fs::read_to_string(&index_path)
.with_context(|| format!("Failed to read {}", index_path.display()))?;
info!("Loaded index.html for OG injection");
Some(html)
let is_dev = if cli.dist.is_some() {
info!("Static frontend serving enabled");
false
} else {
info!("No --dist provided; static serving and OG injection disabled");
None
info!("No --dist provided; static serving disabled");
true
};
let http_client = reqwest::Client::builder()
@ -406,8 +402,7 @@ async fn main() -> anyhow::Result<()> {
features_response,
screenshot_url: cli.screenshot_url,
public_url: cli.public_url,
is_dev: index_html.is_none(),
index_html,
is_dev,
http_client,
pocketbase_url: cli.pocketbase_url,
pocketbase_admin_email: cli.pocketbase_admin_email,

View file

@ -57,8 +57,6 @@ pub struct AppState {
pub public_url: String,
/// True when --dist is not provided (no static serving, relaxed auth checks)
pub is_dev: bool,
/// Contents of index.html read at startup, used for crawler OG injection (None when --dist omitted)
pub index_html: Option<String>,
/// Shared HTTP client for proxying to the screenshot service and PocketBase
pub http_client: reqwest::Client,
/// PocketBase server URL for authentication (e.g. http://localhost:8090)