diff --git a/app.py b/app.py index 4440391..f0cd589 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, jsonify, Response, stream_with_context +from flask import Flask, render_template, jsonify, Response, stream_with_context, request, redirect from config import Config from extensions import db, redis_client, migrate, s3_client from blueprints.auth import auth_bp @@ -142,6 +142,11 @@ def create_app(): @app.route('/') def index(): + # 检测是否为移动端访问 + user_agent = request.headers.get('User-Agent', '').lower() + mobile_keywords = ['mobile', 'android', 'iphone', 'ipad', 'ipod', 'windows phone', 'blackberry'] + if any(keyword in user_agent for keyword in mobile_keywords): + return redirect('/mobile') return render_template('index.html') @app.route('/ocr') diff --git a/templates/mobile.html b/templates/mobile.html index 1f7a060..071a6a4 100644 --- a/templates/mobile.html +++ b/templates/mobile.html @@ -189,7 +189,7 @@ - +
-
+ + +