|
|
from fastapi import FastAPI |
|
|
from fastapi.responses import FileResponse, HTMLResponse |
|
|
from fastapi.middleware.wsgi import WSGIMiddleware |
|
|
from fastapi.staticfiles import StaticFiles |
|
|
import os |
|
|
import dotenv |
|
|
|
|
|
|
|
|
dotenv.load_dotenv() |
|
|
|
|
|
from github_workflow_app.app import app as github_app |
|
|
from social_media_publishers.app import app as social_app, start_scheduler, shutdown_scheduler |
|
|
|
|
|
app = FastAPI() |
|
|
|
|
|
@app.on_event("startup") |
|
|
async def startup_event(): |
|
|
await start_scheduler() |
|
|
|
|
|
@app.on_event("shutdown") |
|
|
async def shutdown_event(): |
|
|
await shutdown_scheduler() |
|
|
|
|
|
app.mount("/github_workflow", github_app) |
|
|
app.mount("/social", social_app) |
|
|
|
|
|
|
|
|
@app.get("/zly0q7bqr790s491gs8wvbdcuengnn.html") |
|
|
def facebook_verify(): |
|
|
file_path = "zly0q7bqr790s491gs8wvbdcuengnn.html" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="text/html") |
|
|
else: |
|
|
return {"error": "Verification file not found"} |
|
|
|
|
|
|
|
|
@app.get("/tiktokDWNIFZr0FFO0hEPaEmddc8513jZqTKpR.txt") |
|
|
def tiktok_verify(): |
|
|
file_path = "tiktokDWNIFZr0FFO0hEPaEmddc8513jZqTKpR.txt" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="text/plain") |
|
|
else: |
|
|
return {"error": "Verification file not found"} |
|
|
|
|
|
@app.get("/googleb795e68a4c533fc2.html") |
|
|
def google_verify(): |
|
|
file_path = "googleb795e68a4c533fc2.html" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="text/html") |
|
|
else: |
|
|
return {"error": "Verification file not found"} |
|
|
|
|
|
@app.get("/logo.webp") |
|
|
def logo(): |
|
|
file_path = "logo.webp" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="image/webp") |
|
|
else: |
|
|
return {"error": "Logo not found"} |
|
|
|
|
|
@app.get("/favicon.ico") |
|
|
def favicon(): |
|
|
file_path = "logo.webp" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="image/webp") |
|
|
else: |
|
|
|
|
|
|
|
|
return JSONResponse(status_code=404, content={"error": "Favicon not found"}) |
|
|
|
|
|
|
|
|
@app.get("/privacy-policy") |
|
|
def privacy_policy(): |
|
|
file_path = "privacy_policy.html" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="text/html") |
|
|
else: |
|
|
return {"error": "Privacy policy file not found"} |
|
|
|
|
|
|
|
|
@app.get("/data-deletion") |
|
|
def data_deletion(): |
|
|
file_path = "data_deletion.html" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="text/html") |
|
|
else: |
|
|
return {"error": "Data deletion file not found"} |
|
|
|
|
|
|
|
|
@app.get("/terms-of-service") |
|
|
def terms_of_service(): |
|
|
file_path = "terms_of_service.html" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="text/html") |
|
|
else: |
|
|
return {"error": "Terms of Service file not found"} |
|
|
|
|
|
@app.get("/", response_class=HTMLResponse) |
|
|
def root(): |
|
|
file_path = "index.html" |
|
|
if os.path.exists(file_path): |
|
|
return FileResponse(file_path, media_type="text/html") |
|
|
else: |
|
|
|
|
|
return """ |
|
|
<html> |
|
|
<head><title>Elvoro Tools - Loading...</title></head> |
|
|
<body><h1>Elvoro Tools</h1><p>Running...</p></body> |
|
|
</html> |
|
|
""" |
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
import uvicorn |
|
|
print("Elvoro Main App") |
|
|
print("Running on http://localhost:7860") |
|
|
uvicorn.run(app, host="0.0.0.0", port=7860) |
|
|
|