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 # Load environment variables 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) # Facebook domain verification route @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"} # TikTok domain verification route @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 a 404 so browser falls back or shows broken icon, # but keeps logs cleaner than 500 return JSONResponse(status_code=404, content={"error": "Favicon not found"}) # Privacy Policy route @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"} # Data Deletion route @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"} # Terms of Service route @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: # Fallback if index.html is missing return """ Elvoro Tools - Loading...

Elvoro Tools

Running...

""" 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)