From 8069bf51aba03632460dd0c1e00620b8b62e89a8 Mon Sep 17 00:00:00 2001 From: dami Date: Thu, 17 Jul 2025 17:37:57 +0800 Subject: [PATCH] update --- web/admin/__init__.py | 7 +++---- web/config.py | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/web/admin/__init__.py b/web/admin/__init__.py index 2277d5ca4..f6044f5b3 100644 --- a/web/admin/__init__.py +++ b/web/admin/__init__.py @@ -63,6 +63,7 @@ app.config['SESSION_USE_SIGNER'] = True app.config['SESSION_KEY_PREFIX'] = 'MW_:' app.config['SESSION_COOKIE_NAME'] = "MW_VER_1" app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=31) +app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 604800 # db的配置 # app.config['SQLALCHEMY_DATABASE_URI'] = mw.getSqitePrefix()+config.SQLITE_PATH+"?timeout=20" # 使用 SQLite 数据库 @@ -94,13 +95,12 @@ def sendAuthenticated(): @app.before_request def requestCheck(): + request.start_time = time.time() admin_close = thisdb.getOption('admin_close') if admin_close == 'yes': if not request.path.startswith('/close'): return redirect('/close') - - config.APP_START_TIME=time.time() # 自定义basic auth认证 if app.config['BASIC_AUTH_OPEN']: basic_auth = thisdb.getOptionByJson('basic_auth', default={'open':False}) @@ -129,8 +129,7 @@ def requestCheck(): def requestAfter(response): response.headers['soft'] = config.APP_NAME response.headers['mw-version'] = config.APP_VERSION - if mw.isDebugMode(): - response.headers['mw-debug-cos'] = time.time() - config.APP_START_TIME + response.headers['X-Response-Time'] = round(time.time() - request.start_time, 4) return response diff --git a/web/config.py b/web/config.py index afe82f97d..0c3fb2e70 100644 --- a/web/config.py +++ b/web/config.py @@ -74,6 +74,3 @@ SQLITE_PATH = os.path.join(DATA_DIR, APP_SQLITE_NAME + '.db') DEFAULT_SERVER = '0.0.0.0' DEFAULT_SERVER_PORT = 7201 -# APP启动时间 -APP_START_TIME=0 -