diff --git a/app/__pycache__/main.cpython-312.pyc b/app/__pycache__/main.cpython-312.pyc index 4dc8814..5446fad 100644 Binary files a/app/__pycache__/main.cpython-312.pyc and b/app/__pycache__/main.cpython-312.pyc differ diff --git a/app/main.py b/app/main.py index 1208c9b..56ecf67 100644 --- a/app/main.py +++ b/app/main.py @@ -1,9 +1,11 @@ from fastapi import FastAPI, APIRouter, Request from fastapi.templating import Jinja2Templates +from fastapi.staticfiles import StaticFiles from security import security_router import uvicorn app = FastAPI() +app.mount("/static", StaticFiles(directory="static"), name="static") app.include_router(security_router) templates = Jinja2Templates(directory="templates") @@ -11,11 +13,20 @@ templates = Jinja2Templates(directory="templates") @app.get("/") async def read_root(request: Request): - data = "hi" + routes = [] + for route in request.app.routes: + if route.name in ["openapi", "swagger_ui_html", "swagger_ui_redirect", "redoc_html", "static", "read_root"]: + continue + routes.append({ + "path": getattr(route, "path", "N/A"), + "name": getattr(route, "name", "N/A"), + "methods": list(route.methods) if hasattr(route, "methods") else [] + }) + return templates.TemplateResponse( request=request, name="index.html", - contents={"data": data} + context={"routes": routes} ) if __name__ == "__main__": diff --git a/app/security/__pycache__/__init__.cpython-312.pyc b/app/security/__pycache__/__init__.cpython-312.pyc index 28c3200..665cb23 100644 Binary files a/app/security/__pycache__/__init__.cpython-312.pyc and b/app/security/__pycache__/__init__.cpython-312.pyc differ diff --git a/app/security/__pycache__/security.cpython-312.pyc b/app/security/__pycache__/security.cpython-312.pyc index db7d39e..1190b53 100644 Binary files a/app/security/__pycache__/security.cpython-312.pyc and b/app/security/__pycache__/security.cpython-312.pyc differ diff --git a/app/security/security.py b/app/security/security.py index 0c444ac..0d52f59 100644 --- a/app/security/security.py +++ b/app/security/security.py @@ -6,12 +6,7 @@ templates = Jinja2Templates(directory="templates") @security_router.get("/browser") -async def security_check_list(request: Request): +async def browser_local_cryptography_strength(request: Request): return templates.TemplateResponse( request=request, name="browser_random_number.html", contents={"rand": "rand"} - ) - - -@security_router.get("/browser") -async def security_check_browser(): - return {"message": "checking browser security"} + ) \ No newline at end of file diff --git a/app/static/logo.png b/app/static/logo.png new file mode 100644 index 0000000..ec86335 Binary files /dev/null and b/app/static/logo.png differ diff --git a/app/templates/base.html b/app/templates/base.html index b286ff2..43c3574 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -1,45 +1,54 @@ - - - - - - {% block title %}My FastAPI App{% endblock %} - {% block css %} - {% endblock %} - - - - + - {% block content %} - {% endblock %} - {% block js %} - {% endblock %} - + {% block content %} + {% endblock %} + {% block js %} + {% endblock %} + - + + \ No newline at end of file diff --git a/app/templates/browser_random_number.html b/app/templates/browser_random_number.html index aa9c971..0becbdb 100644 --- a/app/templates/browser_random_number.html +++ b/app/templates/browser_random_number.html @@ -4,20 +4,22 @@ {% block content %}
-
+

Detected Browser: Something

+

This visualization demonstrates the strength and uniformity of your + browser's random number generator.

- +
{% endblock %} {% block js %} -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html index df200c0..9606d80 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -3,12 +3,38 @@ {% block title %}Home Page{% endblock %} {% block content %} -
-

Hello World

+
+

Available Endpoints

+
+ {% for route in routes %} +
+
+

{{ route.name }}

+
+ + {{ route.methods | join(', ') }} + +
+
+ {{ route.path }} + {% if 'GET' in route.methods %} + + Visit + + {% endif %} +
+
+
+ {% endfor %} +
{% endblock %} {% block css %} {{ super() }} -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/docker-compose.local.yml b/docker-compose.local.yml index c2c2f04..489034a 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -4,4 +4,7 @@ services: user: 1000:1000 # should be owner of volumes ports: - 35050:35050 + volumes: + - ./app:/code/app + command: fastapi dev main.py --host 0.0.0.0 --port 35050 restart: unless-stopped