From 75d7e5bdfa301de9e9496b33aa98b72568bfa79e Mon Sep 17 00:00:00 2001 From: Louis King Date: Fri, 6 Feb 2026 12:09:36 +0000 Subject: [PATCH] Added permissive robots.txt route --- src/meshcore_hub/web/app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/meshcore_hub/web/app.py b/src/meshcore_hub/web/app.py index 50e069a..fae3505 100644 --- a/src/meshcore_hub/web/app.py +++ b/src/meshcore_hub/web/app.py @@ -7,7 +7,7 @@ from typing import AsyncGenerator import httpx from fastapi import FastAPI, Request -from fastapi.responses import HTMLResponse +from fastapi.responses import HTMLResponse, PlainTextResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from starlette.exceptions import HTTPException as StarletteHTTPException @@ -152,6 +152,11 @@ def create_app( except Exception as e: return {"status": "not_ready", "api": str(e)} + @app.get("/robots.txt", response_class=PlainTextResponse) + async def robots_txt() -> str: + """Serve robots.txt to control search engine crawling.""" + return "User-agent: *\nAllow: /\n" + @app.exception_handler(StarletteHTTPException) async def http_exception_handler( request: Request, exc: StarletteHTTPException