diff --git a/app/run.py b/app/run.py index 7d07815..4b4c126 100644 --- a/app/run.py +++ b/app/run.py @@ -25,8 +25,10 @@ def get_app_ver(): BUILD_TAG = os.environ.get("BUILD_TAG", "") if BUILD_TAG[:1] == "v": return BUILD_TAG - else: + elif BUILD_SHA: return f"{BUILD_TAG}({BUILD_SHA[:7]})" + else: + return "dev" # 文件路径 @@ -229,4 +231,4 @@ if __name__ == "__main__": scheduler = BackgroundScheduler() reload_tasks() scheduler.start() - app.run(debug=os.environ.get("DEBUG", False), host="0.0.0.0", port=5005) + app.run(debug=os.environ.get("DEBUG", True), host="0.0.0.0", port=5005) diff --git a/app/templates/index.html b/app/templates/index.html index 47800eb..d46ca83 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -218,7 +218,7 @@

- Cp0204/quark_auto_save [[ version ]] + Cp0204/quark_auto_save

@@ -262,6 +262,8 @@ var app = new Vue({ el: '#app', data: { + version: "[[ version ]]", + versionTips: "", weekdays: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], formData: { cookie: [], @@ -307,9 +309,24 @@ }, mounted() { this.fetchData(); + this.checkNewVersion(); $('[data-toggle="tooltip"]').tooltip() }, methods: { + checkNewVersion() { + this.versionTips = this.version; + axios.get('https://api.github.com/repos/Cp0204/quark-auto-save/tags') + .then(response => { + latestVersion = response.data[0].name; + console.log(`检查版本:当前 ${this.version} 最新 ${latestVersion}`); + if (latestVersion != this.version) { + this.versionTips += ` ${latestVersion}`; + } + }) + .catch(error => { + console.error('Error:', error); + }); + }, fetchData() { axios.get('/data') .then(response => {