mirror of
https://github.com/KingHWJ/WeReadBoard.git
synced 2026-11-03 18:24:58 +08:00
feat(version): 显示应用版本号
This commit is contained in:
1 parent
f5ffea6eb0
commit
9985f7c81a
8 files changed
+29
-4
No files matched your search
@@ -25,6 +25,7 @@ import time
|
||||
import urllib.request
|
||||
from datetime import datetime
|
||||
from functools import wraps
|
||||
from pathlib import Path
|
||||
|
||||
import pymysql
|
||||
|
||||
@@ -45,6 +46,16 @@ from reading_api import reading_bp
|
||||
# ======================================================================
|
||||
app = Flask(__name__, static_folder="static", template_folder="templates")
|
||||
|
||||
try:
|
||||
APP_VERSION = Path(__file__).with_name("VERSION").read_text(encoding="utf-8").strip()
|
||||
except FileNotFoundError:
|
||||
APP_VERSION = "unknown"
|
||||
|
||||
|
||||
@app.context_processor
|
||||
def inject_app_version():
|
||||
return {"app_version": APP_VERSION}
|
||||
|
||||
# 注册当前看板数据接口,并保留旧客户端兼容路径。
|
||||
app.register_blueprint(reading_bp)
|
||||
register_auth(app)
|
||||
|
||||
Reference in new issue
Block a user