diff --git a/README.md b/README.md index faa2b70..ac294a7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,11 @@ This project is currently in **Phase 1: Initial Development**. * **Interaction:** Provide "single message focus" and other moderation tools for streamers and their teams. * **Self-Hosted:** The service is hosted by the project owner (you) and provided to users. -## 💻 Technology Stack +## 🔒 Security & Privacy + +User privacy and security are paramount. All sensitive user credentials, such as OAuth access and refresh tokens from external platforms, are **always encrypted** before being stored in the database. They are never stored in plain text, ensuring a high standard of security for user data. + +## � Technology Stack * **Backend:** Python 3.9+ (FastAPI) * **Database:** SQLite (initially, for simplicity) with SQLAlchemy diff --git a/main.py b/main.py index 4543a65..fe04dc1 100644 --- a/main.py +++ b/main.py @@ -3,6 +3,7 @@ from fastapi import FastAPI, Request from starlette.middleware.sessions import SessionMiddleware from starlette.staticfiles import StaticFiles from starlette.responses import FileResponse, RedirectResponse +from contextlib import asynccontextmanager import models from database import engine @@ -14,12 +15,16 @@ from config import settings # Import settings to get the secret key BASE_DIR = os.path.dirname(os.path.abspath(__file__)) STATIC_DIR = os.path.join(BASE_DIR, "static") -# This line tells SQLAlchemy to create all the tables based on the models -# we defined. It will create the `multichat_overlay.db` file with the -# 'users' and 'settings' tables if they don't exist. -models.Base.metadata.create_all(bind=engine) +@asynccontextmanager +async def lifespan(app: FastAPI): + # This code runs on startup + print("Application startup: Creating database tables...") + models.Base.metadata.create_all(bind=engine) + print("Application startup: Database tables created.") + yield + # Code below yield runs on shutdown, if needed -app = FastAPI() +app = FastAPI(lifespan=lifespan) # Mount the 'static' directory using an absolute path for reliability app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")