Merge pull request #869 from midoks/dev

面板优化
This commit is contained in:
Mr Chen
2026-04-04 23:09:53 +08:00
committed by GitHub
3 changed files with 18 additions and 4 deletions
+5 -1
View File
@@ -35,7 +35,7 @@ redis
pillow
Jinja2>=2.11.2
PyMySQL>=1.0.2
whitenoise==5.3.0
whitenoise>5.3.0
tldextract
pyotp
pytz
@@ -46,3 +46,7 @@ pyyaml
croniter
bcrypt
packaging
Flask-Compress
brotli
zstd
zstandard
+2 -1
View File
@@ -377,6 +377,7 @@ mw_install(){
mw_common_proxy
echo "bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh")"
bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh")
mw_clean_lib
bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh")
}
@@ -401,8 +402,8 @@ mw_update_dev()
mw_common_proxy
echo "bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh")"
mw_clean_lib
bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh")
cd ${PANEL_DIR}
}
+11 -2
View File
@@ -24,6 +24,7 @@ from flask import Response
from flask import Flask, abort, current_app, session, url_for
from flask import Blueprint, render_template
from flask import render_template_string
from flask_compress import Compress
from flask_socketio import SocketIO, emit, send
@@ -44,15 +45,23 @@ setup.init()
app = Flask(__name__, template_folder='templates/default')
# curl --compressed -I "http://127.0.0.1:44010/" -H "Accept-Encoding: zstd" --write-out "%{json}"
app.config["COMPRESS_ALGORITHM"] = ["zstd", "br", "gzip", "deflate"]
Compress(app)
# 缓存配置
cache = Cache(config={'CACHE_TYPE': 'simple'})
cache.init_app(app, config={'CACHE_TYPE': 'simple'})
# 静态文件配置
from whitenoise import WhiteNoise
app.wsgi_app = WhiteNoise(app.wsgi_app, root="../web/static/", prefix="static/", max_age=604800)
app.static_folder = "../static"
app.static_url_path = "/static"
app.jinja_env.trim_blocks = True
# from whitenoise import WhiteNoise
# app.wsgi_app = WhiteNoise(app.wsgi_app, root="../web/static/", prefix="static/", max_age=604800)
# session配置
# app.secret_key = uuid.UUID(int=uuid.getnode()).hex[-12:]
app.config['SECRET_KEY'] = uuid.UUID(int=uuid.getnode()).hex[-12:]