三端自适应布局与 PWA 可安装支持
新增响应式样式、手机侧滑导航、manifest 与 Service Worker;补充根路径重定向与安装 App 入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -551,6 +551,28 @@ def login_required(f):
|
||||
return wrap
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
if session.get("logged_in"):
|
||||
return redirect(url_for("plans"))
|
||||
return redirect(url_for("login"))
|
||||
|
||||
|
||||
@app.route("/manifest.webmanifest")
|
||||
def web_manifest():
|
||||
response = app.send_static_file("manifest.json")
|
||||
response.mimetype = "application/manifest+json"
|
||||
return response
|
||||
|
||||
|
||||
@app.route("/sw.js")
|
||||
def service_worker():
|
||||
response = app.send_static_file("sw.js")
|
||||
response.headers["Cache-Control"] = "no-cache"
|
||||
response.headers["Service-Worker-Allowed"] = "/"
|
||||
return response
|
||||
|
||||
|
||||
@app.route("/login", methods=["GET", "POST"])
|
||||
def login():
|
||||
if request.method == "POST":
|
||||
|
||||
Reference in New Issue
Block a user