From e545722b9d40c4910d4ab73d2a8064b3906c63f7 Mon Sep 17 00:00:00 2001 From: Cp0204 Date: Wed, 28 Feb 2024 02:39:55 +0800 Subject: [PATCH] =?UTF-8?q?WebUI=E8=B7=9F=E8=BF=9B=E5=A4=9A=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/run.py | 7 ++++--- app/templates/index.html | 38 ++++++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/app/run.py b/app/run.py index 24a713a..b29532a 100644 --- a/app/run.py +++ b/app/run.py @@ -20,6 +20,8 @@ config_path = os.environ.get("CONFIG_PATH", "./config/quark_config.json") app = Flask(__name__) app.secret_key = "ca943f6db6dd34823d36ab08d8d6f65d" app.config["JSON_AS_ASCII"] = False +app.config["JSON_SORT_KEYS"] = False +app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False # 设置icon @@ -42,7 +44,7 @@ def read_json(): # 将数据写入 JSON 文件 def write_json(data): with open(config_path, "w", encoding="utf-8") as f: - json.dump(data, f, indent=4, ensure_ascii=False) + json.dump(data, f, indent=4, ensure_ascii=False, sort_keys=False) # 登录页面 @@ -77,8 +79,7 @@ def logout(): def index(): if not session.get("username"): return redirect(url_for("login")) - data = read_json() - return render_template("index.html", data=data) + return render_template("index.html") # 获取配置数据 diff --git a/app/templates/index.html b/app/templates/index.html index 36d812b..6e9ce96 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -14,15 +14,28 @@

夸克自动转存配置

-

Cookie

-
+
+
+

Cookie

+
+
+ +
+
+

所有账号执行签到,仅第一个账号执行转存,请自行确认顺序。

+
+ +
+ +
+

通知

- +
@@ -31,7 +44,7 @@
- +
@@ -135,7 +148,7 @@ el: '#app', data: { formData: { - cookie: "", + cookie: [], push_config: {}, emby: { url: "", @@ -143,7 +156,8 @@ }, tasklist: [] } - }, watch: { + }, + watch: { 'task.shareurl': function (newVal, oldVal) { this.task.shareurl_ban = ''; } @@ -155,6 +169,8 @@ fetchData() { axios.get('/data') .then(response => { + if (typeof response.data.cookie === 'string') + response.data.cookie = [response.data.cookie]; this.formData = response.data; }) .catch(error => { @@ -171,12 +187,18 @@ console.error('Error saving config:', error); }); }, - addItem() { + addCookie() { + this.formData.cookie.push(""); + }, + removeCookie(index) { + this.formData.cookie.splice(index, 1); + }, + addPush() { key = prompt("增加的键名", ""); if (key != "" && key != null) this.$set(this.formData.push_config, key, ""); }, - removeItem(key) { + removePush(key) { this.$delete(this.formData.push_config, key); }, addTask() {