Karan Adhikari commited on
Update main.py
Browse files- Backend/fastapi/main.py +6 -2
Backend/fastapi/main.py
CHANGED
|
@@ -19,7 +19,7 @@ from Backend.fastapi.routes.api_routes import (
|
|
| 19 |
create_token_api, revoke_token_api, update_token_limits_api,
|
| 20 |
speed_test_api, speed_test_stream_api,
|
| 21 |
get_admin_stats_api, clear_cache_api, get_dead_links_api,
|
| 22 |
-
get_stream_analytics_api,
|
| 23 |
get_subscription_plans_api, add_subscription_plan_api,
|
| 24 |
update_subscription_plan_api, delete_subscription_plan_api,
|
| 25 |
get_all_subscribers_api, manage_subscriber_api,
|
|
@@ -180,6 +180,10 @@ async def get_dead_links(_: bool = Depends(require_auth)):
|
|
| 180 |
async def get_stream_analytics(_: bool = Depends(require_auth)):
|
| 181 |
return await get_stream_analytics_api()
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
@app.get("/admin/subscriptions", response_class=HTMLResponse)
|
| 184 |
async def admin_subscriptions(request: Request, _: bool = Depends(require_auth)):
|
| 185 |
return await admin_subscriptions_page(request, _)
|
|
@@ -257,4 +261,4 @@ async def speed_test_stream(
|
|
| 257 |
|
| 258 |
@app.exception_handler(401)
|
| 259 |
async def auth_exception_handler(request: Request, exc):
|
| 260 |
-
return RedirectResponse(url="/login", status_code=302)
|
|
|
|
| 19 |
create_token_api, revoke_token_api, update_token_limits_api,
|
| 20 |
speed_test_api, speed_test_stream_api,
|
| 21 |
get_admin_stats_api, clear_cache_api, get_dead_links_api,
|
| 22 |
+
get_stream_analytics_api, clear_stream_analytics_api,
|
| 23 |
get_subscription_plans_api, add_subscription_plan_api,
|
| 24 |
update_subscription_plan_api, delete_subscription_plan_api,
|
| 25 |
get_all_subscribers_api, manage_subscriber_api,
|
|
|
|
| 180 |
async def get_stream_analytics(_: bool = Depends(require_auth)):
|
| 181 |
return await get_stream_analytics_api()
|
| 182 |
|
| 183 |
+
@app.post("/api/admin/clear-analytics")
|
| 184 |
+
async def clear_analytics(_: bool = Depends(require_auth)):
|
| 185 |
+
return await clear_stream_analytics_api()
|
| 186 |
+
|
| 187 |
@app.get("/admin/subscriptions", response_class=HTMLResponse)
|
| 188 |
async def admin_subscriptions(request: Request, _: bool = Depends(require_auth)):
|
| 189 |
return await admin_subscriptions_page(request, _)
|
|
|
|
| 261 |
|
| 262 |
@app.exception_handler(401)
|
| 263 |
async def auth_exception_handler(request: Request, exc):
|
| 264 |
+
return RedirectResponse(url="/login", status_code=302)
|