From 1ca3230153f7ece14fdfaf21c3c2266e02537037 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Mon, 17 Nov 2025 17:21:19 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=A8=A1=E5=BC=8F=EF=BC=9A=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E6=89=A7=E8=A1=8C=E5=91=A8=E6=9C=9F=E8=A7=84?= =?UTF-8?q?=E5=88=99=E7=9A=84=E5=8D=95=E4=BB=BB=E5=8A=A1=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 IGNORE_EXECUTION_RULES 环境变量,用于标记手动运行单个任务时忽略执行周期/进度限制 - run_script_now 在手动运行单个任务时设置该标记,并保留原始任务索引用于日志显示 - do_save 支持 ignore_execution_rules 参数,单任务手动运行时直接跳过执行周期与进度判断 - 保持手动运行 ALL 和定时任务的执行周期/进度规则不变,避免影响现有功能 --- app/run.py | 8 ++++++-- quark_auto_save.py | 12 +++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/run.py b/app/run.py index 863611e..9f2cf7e 100644 --- a/app/run.py +++ b/app/run.py @@ -1855,8 +1855,12 @@ def run_script_now(): if tasklist: process_env["TASKLIST"] = json.dumps(tasklist, ensure_ascii=False) # 添加原始任务索引的环境变量 - if len(tasklist) == 1 and 'original_index' in request.json: - process_env["ORIGINAL_TASK_INDEX"] = str(request.json['original_index']) + if len(tasklist) == 1: + # 单任务手动运行:前端传入 original_index,用于日志展示 + if 'original_index' in request.json: + process_env["ORIGINAL_TASK_INDEX"] = str(request.json['original_index']) + # 单任务手动运行应忽略执行周期和任务进度限制(包括自动模式下进度100%也要执行) + process_env["IGNORE_EXECUTION_RULES"] = "1" process = subprocess.Popen( command, stdout=subprocess.PIPE, diff --git a/quark_auto_save.py b/quark_auto_save.py index ec8b776..9673fff 100644 --- a/quark_auto_save.py +++ b/quark_auto_save.py @@ -4466,7 +4466,7 @@ def do_sign(account): print() -def do_save(account, tasklist=[]): +def do_save(account, tasklist=[], ignore_execution_rules=False): print(f"🧩 载入插件") plugins, CONFIG_DATA["plugins"], task_plugins_config = Config.load_plugins( CONFIG_DATA.get("plugins", {}) @@ -4479,6 +4479,9 @@ def do_save(account, tasklist=[]): sent_notices = set() def is_time(task): + # 若为手动单任务运行并明确要求忽略执行周期/进度限制,则始终执行 + if ignore_execution_rules: + return True # 获取任务的执行周期模式,优先使用任务自身的execution_mode,否则使用系统配置的execution_mode execution_mode = task.get("execution_mode") or CONFIG_DATA.get("execution_mode", "manual") @@ -5892,9 +5895,12 @@ def main(): print(f"===============转存任务===============") # 任务列表 if tasklist_from_env: - do_save(accounts[0], tasklist_from_env) + # 若通过环境变量传入任务列表,视为手动运行,可由外层控制是否忽略执行周期/进度限制 + ignore_execution_rules = os.environ.get("IGNORE_EXECUTION_RULES", "").lower() in ["1", "true", "yes"] + do_save(accounts[0], tasklist_from_env, ignore_execution_rules=ignore_execution_rules) else: - do_save(accounts[0], CONFIG_DATA.get("tasklist", [])) + # 定时任务或命令行全量运行,始终遵循执行周期/进度规则 + do_save(accounts[0], CONFIG_DATA.get("tasklist", []), ignore_execution_rules=False) print() # 通知 if NOTIFYS: From 710c91840f753acaa59844603e7aac15013cc053 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Tue, 18 Nov 2025 16:06:11 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=9C=A8=E4=BB=BB=E5=8A=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=95=B0=E9=87=8F=E6=8C=87=E7=A4=BA=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/main.css | 26 ++++++++++++++++++++++++++ app/templates/index.html | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/app/static/css/main.css b/app/static/css/main.css index 9ae107f..ff20f4e 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -8339,4 +8339,30 @@ div:has(> .collapse:not(.show)):has(+ .row.title[title^="资源搜索"]) { .crontab-link:hover { color: var(--focus-border-color); text-decoration: none; +} + +/* 任务列表:任务数量指示器 */ +.tasklist-count-indicator { + min-width: 32px; + height: 32px; + border-radius: 6px; + border: 1px solid var(--dark-text-color); + background-color: transparent; + color: var(--dark-text-color); + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0 8px; + font-size: 0.95rem; + line-height: 32px; + user-select: none; + cursor: default; + flex-shrink: 0; + white-space: nowrap; + box-sizing: border-box; +} + +.tasklist-count-single-digit { + width: 32px; + padding: 0; } \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html index 58a4228..df85b22 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1033,6 +1033,13 @@ {{ tasklistSort.order === 'asc' ? '升序排列' : '降序排列' }} + +
+ {{ tasklistVisibleCount }} +
+
+ +
@@ -1064,7 +1088,7 @@