fix: default DEM URL to api.open-elevation.com
No configuration needed out of the box; --dem-url only required to override the default with a self-hosted or alternative endpoint.
This commit is contained in:
+2
-5
@@ -25,7 +25,7 @@ console = Console()
|
|||||||
@click.option("--strava-client-secret", default=None, envvar="STRAVA_CLIENT_SECRET",
|
@click.option("--strava-client-secret", default=None, envvar="STRAVA_CLIENT_SECRET",
|
||||||
help="Strava API client secret. Also reads STRAVA_CLIENT_SECRET env var.")
|
help="Strava API client secret. Also reads STRAVA_CLIENT_SECRET env var.")
|
||||||
@click.option("--dem-url", default=None, envvar="DEM_URL",
|
@click.option("--dem-url", default=None, envvar="DEM_URL",
|
||||||
help="Base URL of an Open-Elevation-compatible API (enables 'Recalculate elevation' button).")
|
help="Base URL of an Open-Elevation-compatible API (default: https://api.open-elevation.com).")
|
||||||
def edit(
|
def edit(
|
||||||
data_dir: Optional[str],
|
data_dir: Optional[str],
|
||||||
port: int,
|
port: int,
|
||||||
@@ -78,10 +78,7 @@ def edit(
|
|||||||
console.print(f"Strava sync: [green]enabled[/green] (client {strava_client_id})")
|
console.print(f"Strava sync: [green]enabled[/green] (client {strava_client_id})")
|
||||||
else:
|
else:
|
||||||
console.print("Strava sync: [yellow]disabled[/yellow] (pass --strava-client-id to enable)")
|
console.print("Strava sync: [yellow]disabled[/yellow] (pass --strava-client-id to enable)")
|
||||||
if dem_url:
|
console.print(f"DEM: [cyan]{srv.dem_url}[/cyan]")
|
||||||
console.print(f"DEM: [green]enabled[/green] ({dem_url})")
|
|
||||||
else:
|
|
||||||
console.print("DEM: [yellow]disabled[/yellow] (pass --dem-url to enable elevation recalculation)")
|
|
||||||
|
|
||||||
uvicorn.run(srv.app, host="127.0.0.1", port=port, log_level="warning")
|
uvicorn.run(srv.app, host="127.0.0.1", port=port, log_level="warning")
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ data_dir: Path | None = None
|
|||||||
site_url: str = "http://localhost:4321"
|
site_url: str = "http://localhost:4321"
|
||||||
strava_client_id: str = ""
|
strava_client_id: str = ""
|
||||||
strava_client_secret: str = ""
|
strava_client_secret: str = ""
|
||||||
dem_url: str = "" # Open-Elevation-compatible API base URL; empty = feature disabled
|
dem_url: str = "https://api.open-elevation.com" # Open-Elevation-compatible API base URL
|
||||||
|
|
||||||
# In-memory CSRF state tokens for OAuth flows (token → True); cleared after use
|
# In-memory CSRF state tokens for OAuth flows (token → True); cleared after use
|
||||||
_oauth_states: set[str] = set()
|
_oauth_states: set[str] = set()
|
||||||
@@ -435,11 +435,7 @@ async def recalculate_elevation_endpoint(activity_id: str) -> JSONResponse:
|
|||||||
Requires --dem-url to be set when starting bincio edit.
|
Requires --dem-url to be set when starting bincio edit.
|
||||||
"""
|
"""
|
||||||
if not dem_url:
|
if not dem_url:
|
||||||
raise HTTPException(
|
raise HTTPException(503, "DEM URL not configured.")
|
||||||
503,
|
|
||||||
"DEM URL not configured. "
|
|
||||||
"Pass --dem-url <api-url> to bincio edit (e.g. https://api.open-elevation.com).",
|
|
||||||
)
|
|
||||||
dd = _get_data_dir()
|
dd = _get_data_dir()
|
||||||
_check_id(activity_id)
|
_check_id(activity_id)
|
||||||
try:
|
try:
|
||||||
|
|||||||
+2
-3
@@ -21,7 +21,7 @@ console = Console()
|
|||||||
@click.option("--max-users", default=None, type=int, help="Override max users for this instance (0 = unlimited; updates the DB setting)")
|
@click.option("--max-users", default=None, type=int, help="Override max users for this instance (0 = unlimited; updates the DB setting)")
|
||||||
@click.option("--public-url", default=None, envvar="PUBLIC_URL", help="Public base URL (e.g. https://yourdomain.com). Required for Strava OAuth to work behind a reverse proxy.")
|
@click.option("--public-url", default=None, envvar="PUBLIC_URL", help="Public base URL (e.g. https://yourdomain.com). Required for Strava OAuth to work behind a reverse proxy.")
|
||||||
@click.option("--webroot", default=None, type=click.Path(), help="Nginx webroot (e.g. /var/www/bincio). When set, uploads trigger a full Astro build + rsync so new activity pages are immediately accessible without a git push.")
|
@click.option("--webroot", default=None, type=click.Path(), help="Nginx webroot (e.g. /var/www/bincio). When set, uploads trigger a full Astro build + rsync so new activity pages are immediately accessible without a git push.")
|
||||||
@click.option("--dem-url", default=None, envvar="DEM_URL", help="Base URL of an Open-Elevation-compatible API (enables 'Recalculate elevation' button in the edit drawer).")
|
@click.option("--dem-url", default=None, envvar="DEM_URL", help="Base URL of an Open-Elevation-compatible API (default: https://api.open-elevation.com).")
|
||||||
def serve(data_dir: str, site_dir: Optional[str], host: str, port: int,
|
def serve(data_dir: str, site_dir: Optional[str], host: str, port: int,
|
||||||
strava_client_id: Optional[str], strava_client_secret: Optional[str],
|
strava_client_id: Optional[str], strava_client_secret: Optional[str],
|
||||||
max_users: Optional[int], public_url: Optional[str],
|
max_users: Optional[int], public_url: Optional[str],
|
||||||
@@ -77,8 +77,7 @@ def serve(data_dir: str, site_dir: Optional[str], host: str, port: int,
|
|||||||
console.print(f" Users: [yellow]max {current_limit}[/yellow]")
|
console.print(f" Users: [yellow]max {current_limit}[/yellow]")
|
||||||
else:
|
else:
|
||||||
console.print(f" Users: [dim]unlimited[/dim]")
|
console.print(f" Users: [dim]unlimited[/dim]")
|
||||||
if dem_url:
|
console.print(f" DEM: [cyan]{srv.dem_url}[/cyan]")
|
||||||
console.print(f" DEM: [cyan]{dem_url}[/cyan]")
|
|
||||||
console.print()
|
console.print()
|
||||||
|
|
||||||
log_config = uvicorn.config.LOGGING_CONFIG.copy()
|
log_config = uvicorn.config.LOGGING_CONFIG.copy()
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ webroot: Path | None = None # nginx webroot — when set, trigger full rebuil
|
|||||||
strava_client_id: str = ""
|
strava_client_id: str = ""
|
||||||
strava_client_secret: str = ""
|
strava_client_secret: str = ""
|
||||||
public_url: str = "" # e.g. "https://yourdomain.com" — used for OAuth redirect URIs
|
public_url: str = "" # e.g. "https://yourdomain.com" — used for OAuth redirect URIs
|
||||||
dem_url: str = "" # Open-Elevation-compatible API base URL; empty = feature disabled
|
dem_url: str = "https://api.open-elevation.com" # Open-Elevation-compatible API base URL
|
||||||
_db = None # sqlite3.Connection, opened lazily
|
_db = None # sqlite3.Connection, opened lazily
|
||||||
|
|
||||||
|
|
||||||
@@ -1279,11 +1279,7 @@ async def recalculate_elevation_endpoint(
|
|||||||
user = _require_user(bincio_session)
|
user = _require_user(bincio_session)
|
||||||
_check_id(activity_id)
|
_check_id(activity_id)
|
||||||
if not dem_url:
|
if not dem_url:
|
||||||
raise HTTPException(
|
raise HTTPException(503, "DEM URL not configured.")
|
||||||
503,
|
|
||||||
"DEM URL not configured. "
|
|
||||||
"Pass --dem-url <api-url> to bincio serve (e.g. https://api.open-elevation.com).",
|
|
||||||
)
|
|
||||||
dd = _get_data_dir() / user.handle
|
dd = _get_data_dir() / user.handle
|
||||||
if not (dd / "activities" / f"{activity_id}.json").exists():
|
if not (dd / "activities" / f"{activity_id}.json").exists():
|
||||||
raise HTTPException(404, "Activity not found")
|
raise HTTPException(404, "Activity not found")
|
||||||
|
|||||||
Reference in New Issue
Block a user