INNER CODE UNIT · Python
outlook_mailbox_js
AaronL725/grok-register · web/server.py:157
def outlook_mailbox_js():
return FileResponse(OUTLOOK_MAILBOX_JS, media_type="application/javascript", headers={"Cache-Control": "no-store"})
@app.middleware("http")
async def protect_outlook_mailbox_api(request: Request, call_next):
response = await call_next(request)
if request.url.path.startswith("/api/mailboxes/outlook"):
response.headers["Cache-Control"] = "no-store"
response.headers["X-Content-Type-Options"] = "nosniff"
return response
def _require_local_origin(request: Request) -> None:
origin = str(request.headers.get("origin") or "").strip()
if not origin:
return
from urllib.parse import urlsplit