mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-12 07:10:44 +08:00
WebUI跟进多账号配置
This commit is contained in:
parent
867e6d4a6c
commit
e545722b9d
@ -20,6 +20,8 @@ config_path = os.environ.get("CONFIG_PATH", "./config/quark_config.json")
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.secret_key = "ca943f6db6dd34823d36ab08d8d6f65d"
|
app.secret_key = "ca943f6db6dd34823d36ab08d8d6f65d"
|
||||||
app.config["JSON_AS_ASCII"] = False
|
app.config["JSON_AS_ASCII"] = False
|
||||||
|
app.config["JSON_SORT_KEYS"] = False
|
||||||
|
app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False
|
||||||
|
|
||||||
|
|
||||||
# 设置icon
|
# 设置icon
|
||||||
@ -42,7 +44,7 @@ def read_json():
|
|||||||
# 将数据写入 JSON 文件
|
# 将数据写入 JSON 文件
|
||||||
def write_json(data):
|
def write_json(data):
|
||||||
with open(config_path, "w", encoding="utf-8") as f:
|
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():
|
def index():
|
||||||
if not session.get("username"):
|
if not session.get("username"):
|
||||||
return redirect(url_for("login"))
|
return redirect(url_for("login"))
|
||||||
data = read_json()
|
return render_template("index.html")
|
||||||
return render_template("index.html", data=data)
|
|
||||||
|
|
||||||
|
|
||||||
# 获取配置数据
|
# 获取配置数据
|
||||||
|
|||||||
@ -14,15 +14,28 @@
|
|||||||
<h1 class="mb-4">夸克自动转存配置</h1>
|
<h1 class="mb-4">夸克自动转存配置</h1>
|
||||||
<form @submit.prevent="saveConfig">
|
<form @submit.prevent="saveConfig">
|
||||||
|
|
||||||
<h2>Cookie</h2>
|
<div class="row">
|
||||||
<input type="text" v-model="formData.cookie" class="form-control" placeholder="打开 pan.quark.com 抓取"><br>
|
<div class="col">
|
||||||
|
<h2>Cookie</h2>
|
||||||
|
</div>
|
||||||
|
<div class="col text-right">
|
||||||
|
<button type="button" class="btn btn-outline-primary mb-3" @click="addCookie()">+</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>所有账号执行签到,仅第一个账号执行转存,请自行确认顺序。</p>
|
||||||
|
<div v-for="(value, index) in formData.cookie" :key="index" class="input-group mb-2">
|
||||||
|
<input type="text" v-model="formData.cookie[index]" class="form-control" placeholder="打开 pan.quark.com 抓取">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button type="button" class="btn btn-outline-danger" @click="removeCookie(index)">-</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h2>通知</h2>
|
<h2>通知</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="col text-right">
|
<div class="col text-right">
|
||||||
<button type="button" class="btn btn-outline-primary mb-3" @click="addItem()">+</button>
|
<button type="button" class="btn btn-outline-primary mb-3" @click="addPush()">+</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="(value, key) in formData.push_config" :key="key" class="input-group mb-2">
|
<div v-for="(value, key) in formData.push_config" :key="key" class="input-group mb-2">
|
||||||
@ -31,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<input type="text" v-model="formData.push_config[key]" class="form-control">
|
<input type="text" v-model="formData.push_config[key]" class="form-control">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button type="button" class="btn btn-outline-danger" @click="removeItem(key)">-</button>
|
<button type="button" class="btn btn-outline-danger" @click="removePush(key)">-</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -135,7 +148,7 @@
|
|||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
formData: {
|
formData: {
|
||||||
cookie: "",
|
cookie: [],
|
||||||
push_config: {},
|
push_config: {},
|
||||||
emby: {
|
emby: {
|
||||||
url: "",
|
url: "",
|
||||||
@ -143,7 +156,8 @@
|
|||||||
},
|
},
|
||||||
tasklist: []
|
tasklist: []
|
||||||
}
|
}
|
||||||
}, watch: {
|
},
|
||||||
|
watch: {
|
||||||
'task.shareurl': function (newVal, oldVal) {
|
'task.shareurl': function (newVal, oldVal) {
|
||||||
this.task.shareurl_ban = '';
|
this.task.shareurl_ban = '';
|
||||||
}
|
}
|
||||||
@ -155,6 +169,8 @@
|
|||||||
fetchData() {
|
fetchData() {
|
||||||
axios.get('/data')
|
axios.get('/data')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
if (typeof response.data.cookie === 'string')
|
||||||
|
response.data.cookie = [response.data.cookie];
|
||||||
this.formData = response.data;
|
this.formData = response.data;
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -171,12 +187,18 @@
|
|||||||
console.error('Error saving config:', error);
|
console.error('Error saving config:', error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addItem() {
|
addCookie() {
|
||||||
|
this.formData.cookie.push("");
|
||||||
|
},
|
||||||
|
removeCookie(index) {
|
||||||
|
this.formData.cookie.splice(index, 1);
|
||||||
|
},
|
||||||
|
addPush() {
|
||||||
key = prompt("增加的键名", "");
|
key = prompt("增加的键名", "");
|
||||||
if (key != "" && key != null)
|
if (key != "" && key != null)
|
||||||
this.$set(this.formData.push_config, key, "");
|
this.$set(this.formData.push_config, key, "");
|
||||||
},
|
},
|
||||||
removeItem(key) {
|
removePush(key) {
|
||||||
this.$delete(this.formData.push_config, key);
|
this.$delete(this.formData.push_config, key);
|
||||||
},
|
},
|
||||||
addTask() {
|
addTask() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user