INNER CODE UNIT · Python
create_app
ghost-in-the-droid/android-agent · gitd/app.py:101
def create_app() -> FastAPI:
"""Build and return the FastAPI application."""
app = FastAPI(
title="Ghost in the Droid API",
description="Open-source mobile automation for Android ADB and iOS Appium/WDA devices",
version="1.0.0",
lifespan=lifespan,
openapi_tags=TAGS_METADATA,
)
# CORS: restrict to the local dashboard/docs origins by default. A
# wildcard combined with allow_credentials=True lets *any* website the
# developer visits issue credentialed requests to this API, which in
# turn can drive ADB (/api/phone/*), install skills, etc. See CWE-352.
app.add_middleware(
CORSMiddleware,
allow_origins=_cors_origins(),
allow_credentials=True,