mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-19 03:20:42 +08:00
WebUI 支持星期指定
This commit is contained in:
parent
a5729f8eef
commit
3dd7aa361c
@ -25,10 +25,12 @@ script_path = os.environ.get("SCRIPT_PATH", "./quark_auto_save.py")
|
||||
config_path = os.environ.get("CONFIG_PATH", "./config/quark_config.json")
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config["APP_VERSION"] = "0.2.4.1"
|
||||
app.config["APP_VERSION"] = "0.2.5"
|
||||
app.secret_key = "ca943f6db6dd34823d36ab08d8d6f65d"
|
||||
app.json.ensure_ascii = False
|
||||
app.json.sort_keys = False
|
||||
app.jinja_env.variable_start_string = '[['
|
||||
app.jinja_env.variable_end_string = ']]'
|
||||
|
||||
|
||||
def gen_md5(string):
|
||||
@ -172,7 +174,8 @@ def reload_tasks():
|
||||
)
|
||||
if scheduler.state == 2:
|
||||
scheduler.resume() # 恢复调度器
|
||||
|
||||
else:
|
||||
print(">>> no crontab")
|
||||
|
||||
def init():
|
||||
# 检查配置文件是否存在
|
||||
|
||||
@ -132,6 +132,15 @@
|
||||
<input type="date" name="enddate[]" class="form-control mb-2" v-model="task.enddate" placeholder="可选">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">运行星期</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check form-check-inline" v-for="(day, index) in weekdays" :key="index">
|
||||
<input class="form-check-input" type="checkbox" v-model="task.runweek" :value="index+1">
|
||||
<label class="form-check-label" v-html="day"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Emby ID</label>
|
||||
<div class="col-sm-10">
|
||||
@ -148,7 +157,7 @@
|
||||
</form>
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<a target="_blank" href="https://github.com/Cp0204/quark-auto-save">@Cp0204/quark_auto_save</a> v{{ version }}
|
||||
<a target="_blank" href="https://github.com/Cp0204/quark-auto-save">@Cp0204/quark_auto_save</a> v[[ version ]]
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -184,6 +193,7 @@
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
weekdays: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
formData: {
|
||||
cookie: [],
|
||||
push_config: {},
|
||||
@ -196,18 +206,17 @@
|
||||
run_log: ""
|
||||
},
|
||||
watch: {
|
||||
'task.shareurl': function () {
|
||||
this.task.shareurl_ban = '';
|
||||
},
|
||||
'formData.push_config': {
|
||||
handler: function (newVal, oldVal) {
|
||||
for (key in newVal) {
|
||||
if (newVal[key] === 'string') {
|
||||
if (newVal[key].toLowerCase() === 'false') {
|
||||
this.$set(this.formData.push_config, key, false);
|
||||
} else if (newVal[key].toLowerCase() === 'true') {
|
||||
this.$set(this.formData.push_config, key, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
@ -219,8 +228,16 @@
|
||||
fetchData() {
|
||||
axios.get('/data')
|
||||
.then(response => {
|
||||
// cookie兼容
|
||||
if (typeof response.data.cookie === 'string')
|
||||
response.data.cookie = [response.data.cookie];
|
||||
// 星期运行兼容
|
||||
response.data.tasklist = response.data.tasklist.map(task => {
|
||||
if (!task.hasOwnProperty('runweek')) {
|
||||
task.runweek = [1, 2, 3, 4, 5, 6, 7];
|
||||
}
|
||||
return task;
|
||||
});
|
||||
this.formData = response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
@ -261,7 +278,8 @@
|
||||
pattern: "",
|
||||
replace: "",
|
||||
enddate: "",
|
||||
emby_id: ""
|
||||
emby_id: "",
|
||||
runweek: [1, 2, 3, 4, 5, 6, 7]
|
||||
});
|
||||
},
|
||||
removeTask(index) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user