diff --git a/docker-compose.yml b/docker-compose.yml index 35fd21b..7a2a2a8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -237,7 +237,6 @@ services: - NETWORK_NAME=${NETWORK_NAME:-MeshCore Network} - NETWORK_CITY=${NETWORK_CITY:-} - NETWORK_COUNTRY=${NETWORK_COUNTRY:-} - - NETWORK_LOCATION=${NETWORK_LOCATION:-} - NETWORK_RADIO_CONFIG=${NETWORK_RADIO_CONFIG:-} - NETWORK_CONTACT_EMAIL=${NETWORK_CONTACT_EMAIL:-} - NETWORK_CONTACT_DISCORD=${NETWORK_CONTACT_DISCORD:-} diff --git a/src/meshcore_hub/api/routes/members.py b/src/meshcore_hub/api/routes/members.py index 00f2001..7656004 100644 --- a/src/meshcore_hub/api/routes/members.py +++ b/src/meshcore_hub/api/routes/members.py @@ -20,7 +20,7 @@ router = APIRouter() async def list_members( _: RequireRead, session: DbSession, - limit: int = Query(default=50, ge=1, le=100), + limit: int = Query(default=50, ge=1, le=500), offset: int = Query(default=0, ge=0), ) -> MemberList: """List all members with pagination.""" diff --git a/src/meshcore_hub/api/routes/nodes.py b/src/meshcore_hub/api/routes/nodes.py index 27a1d66..d82e874 100644 --- a/src/meshcore_hub/api/routes/nodes.py +++ b/src/meshcore_hub/api/routes/nodes.py @@ -19,7 +19,7 @@ async def list_nodes( session: DbSession, search: Optional[str] = Query(None, description="Search in name or public key"), adv_type: Optional[str] = Query(None, description="Filter by advertisement type"), - limit: int = Query(50, ge=1, le=100, description="Page size"), + limit: int = Query(50, ge=1, le=500, description="Page size"), offset: int = Query(0, ge=0, description="Page offset"), ) -> NodeList: """List all nodes with pagination and filtering.""" diff --git a/src/meshcore_hub/common/config.py b/src/meshcore_hub/common/config.py index 77542e3..631752e 100644 --- a/src/meshcore_hub/common/config.py +++ b/src/meshcore_hub/common/config.py @@ -231,9 +231,6 @@ class WebSettings(CommonSettings): network_country: Optional[str] = Field( default=None, description="Network country (ISO 3166-1 alpha-2)" ) - network_location: Optional[str] = Field( - default=None, description="Network location (lat,lon)" - ) network_radio_config: Optional[str] = Field( default=None, description="Radio configuration details" ) diff --git a/src/meshcore_hub/web/app.py b/src/meshcore_hub/web/app.py index 5758a19..e0a9789 100644 --- a/src/meshcore_hub/web/app.py +++ b/src/meshcore_hub/web/app.py @@ -53,7 +53,6 @@ def create_app( network_name: str | None = None, network_city: str | None = None, network_country: str | None = None, - network_location: tuple[float, float] | None = None, network_radio_config: str | None = None, network_contact_email: str | None = None, network_contact_discord: str | None = None, @@ -71,7 +70,6 @@ def create_app( network_name: Display name for the network network_city: City where the network is located network_country: Country where the network is located - network_location: (lat, lon) tuple for map centering network_radio_config: Radio configuration description network_contact_email: Contact email address network_contact_discord: Discord invite/server info @@ -101,7 +99,6 @@ def create_app( app.state.network_name = network_name or settings.network_name app.state.network_city = network_city or settings.network_city app.state.network_country = network_country or settings.network_country - app.state.network_location = network_location or (0.0, 0.0) app.state.network_radio_config = ( network_radio_config or settings.network_radio_config ) @@ -168,7 +165,6 @@ def get_network_context(request: Request) -> dict: "network_name": request.app.state.network_name, "network_city": request.app.state.network_city, "network_country": request.app.state.network_country, - "network_location": request.app.state.network_location, "network_radio_config": radio_config, "network_contact_email": request.app.state.network_contact_email, "network_contact_discord": request.app.state.network_contact_discord, diff --git a/src/meshcore_hub/web/cli.py b/src/meshcore_hub/web/cli.py index 4eeeb8f..be07d6f 100644 --- a/src/meshcore_hub/web/cli.py +++ b/src/meshcore_hub/web/cli.py @@ -60,20 +60,6 @@ import click envvar="NETWORK_COUNTRY", help="Network country", ) -@click.option( - "--network-lat", - type=float, - default=None, - envvar="NETWORK_LAT", - help="Network center latitude", -) -@click.option( - "--network-lon", - type=float, - default=None, - envvar="NETWORK_LON", - help="Network center longitude", -) @click.option( "--network-radio-config", type=str, @@ -126,8 +112,6 @@ def web( network_name: str | None, network_city: str | None, network_country: str | None, - network_lat: float | None, - network_lon: float | None, network_radio_config: str | None, network_contact_email: str | None, network_contact_discord: str | None, @@ -190,21 +174,9 @@ def web( effective_country = network_country or settings.network_country if effective_city and effective_country: click.echo(f"Location: {effective_city}, {effective_country}") - effective_lat = network_lat if network_lat is not None else 0.0 - effective_lon = network_lon if network_lon is not None else 0.0 - if effective_lat != 0.0 or effective_lon != 0.0: - click.echo(f"Map center: {effective_lat}, {effective_lon}") click.echo(f"Reload mode: {reload}") click.echo("=" * 50) - # Build network_location tuple only if explicitly provided - network_location: tuple[float, float] | None = None - if network_lat is not None or network_lon is not None: - network_location = ( - network_lat if network_lat is not None else 0.0, - network_lon if network_lon is not None else 0.0, - ) - if reload: # For development, use uvicorn's reload feature click.echo("\nStarting in development mode with auto-reload...") @@ -225,7 +197,6 @@ def web( network_name=network_name, network_city=network_city, network_country=network_country, - network_location=network_location, network_radio_config=network_radio_config, network_contact_email=network_contact_email, network_contact_discord=network_contact_discord, diff --git a/src/meshcore_hub/web/routes/map.py b/src/meshcore_hub/web/routes/map.py index b93691c..d0cd8b7 100644 --- a/src/meshcore_hub/web/routes/map.py +++ b/src/meshcore_hub/web/routes/map.py @@ -124,20 +124,28 @@ async def map_data(request: Request) -> JSONResponse: error = str(e) logger.warning(f"Failed to fetch nodes for map: {e}") - # Get network center location - network_location = request.app.state.network_location - logger.info( f"Map data: {total_nodes} total nodes, " f"{nodes_with_coords} with coordinates" ) + # Calculate center from nodes, or use default (0, 0) + center_lat = 0.0 + center_lon = 0.0 + if nodes_with_location: + center_lat = sum(n["lat"] for n in nodes_with_location) / len( + nodes_with_location + ) + center_lon = sum(n["lon"] for n in nodes_with_location) / len( + nodes_with_location + ) + return JSONResponse( { "nodes": nodes_with_location, "members": members_list, "center": { - "lat": network_location[0], - "lon": network_location[1], + "lat": center_lat, + "lon": center_lon, }, "debug": { "total_nodes": total_nodes, diff --git a/src/meshcore_hub/web/templates/map.html b/src/meshcore_hub/web/templates/map.html index 994df55..25943bc 100644 --- a/src/meshcore_hub/web/templates/map.html +++ b/src/meshcore_hub/web/templates/map.html @@ -73,24 +73,24 @@
Legend:
-
+ 💬 Chat
-
+ 📡 Repeater
-
+ 🪧 Room
-
+ 📍 Other
-
- Infrastructure + 📡 + Infrastructure (gold glow)
@@ -101,8 +101,8 @@ {% block extra_scripts %}