feat: complete ni-mail rewrite with Graph API, IMAP, OTP extractor, Web UI and Docker deployment

This commit is contained in:
juanjuanjuanidea
2026-07-24 13:57:34 +08:00
commit 015a63043d
17 changed files with 4265 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import os
from flask import Flask, render_template, jsonify
from app.db import db
from app.api import accounts, emails
def create_app():
app = Flask(__name__)
db_path = os.getenv("DATABASE_URL", f"sqlite:///{os.path.join(os.getcwd(), 'ni_mail.db')}")
app.config["SQLALCHEMY_DATABASE_URI"] = db_path
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config["SECRET_KEY"] = os.getenv("SECRET_KEY", "ni-mail-secret-key")
db.init_app(app)
app.register_blueprint(accounts.bp)
app.register_blueprint(emails.bp)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/health")
def health():
return jsonify({"status": "ok", "app": "ni-mail"})
with app.app_context():
db.create_all()
return app