Spaces:
Running
Running
Commit ·
b50c965
1
Parent(s): bc54ade
Fix empty RPC bodies (usage and memory touches); stop publishing the API schema
Browse files- brain/app.py +8 -1
- brain/store/supabase.py +2 -1
brain/app.py
CHANGED
|
@@ -57,8 +57,15 @@ def create_app(deps: Deps | None = None) -> FastAPI:
|
|
| 57 |
yield
|
| 58 |
await app.state.deps.aclose()
|
| 59 |
|
|
|
|
|
|
|
| 60 |
app = FastAPI(
|
| 61 |
-
title="Prova brain",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
)
|
| 63 |
app.state.deps = deps
|
| 64 |
|
|
|
|
| 57 |
yield
|
| 58 |
await app.state.deps.aclose()
|
| 59 |
|
| 60 |
+
# No docs pages and no published schema: scanners request /openapi.json within hours of a
|
| 61 |
+
# Space going public, and the list of routes is theirs to guess, not ours to hand over.
|
| 62 |
app = FastAPI(
|
| 63 |
+
title="Prova brain",
|
| 64 |
+
version=__version__,
|
| 65 |
+
lifespan=lifespan,
|
| 66 |
+
docs_url=None,
|
| 67 |
+
redoc_url=None,
|
| 68 |
+
openapi_url=None,
|
| 69 |
)
|
| 70 |
app.state.deps = deps
|
| 71 |
|
brain/store/supabase.py
CHANGED
|
@@ -103,7 +103,8 @@ class SupabaseStore:
|
|
| 103 |
|
| 104 |
async def _rpc(self, function: str, args: Row) -> Any:
|
| 105 |
response = await self._request("POST", f"rpc/{function}", json=args)
|
| 106 |
-
|
|
|
|
| 107 |
|
| 108 |
# --- Login sessions -----------------------------------------------------
|
| 109 |
|
|
|
|
| 103 |
|
| 104 |
async def _rpc(self, function: str, args: Row) -> Any:
|
| 105 |
response = await self._request("POST", f"rpc/{function}", json=args)
|
| 106 |
+
# A function that returns nothing (bump_usage, touch_memories) answers 204 with no body.
|
| 107 |
+
return response.json() if response.content else None
|
| 108 |
|
| 109 |
# --- Login sessions -----------------------------------------------------
|
| 110 |
|