Update: Logic with Twitch login now works.
This commit is contained in:
@@ -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.
|
||||
|
||||
## <20> Technology Stack
|
||||
|
||||
* **Backend:** Python 3.9+ (FastAPI)
|
||||
* **Database:** SQLite (initially, for simplicity) with SQLAlchemy
|
||||
|
||||
15
main.py
15
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")
|
||||
|
||||
Reference in New Issue
Block a user