- 补 download_all_chat 末尾 snapshot + reset,修复最后频道永远卡「🚀下载中」 - h-skip 改为跨频道累加,解决切频道视觉归零 - 清理前端 currentFilter 死变量 / download_stat 无意义三元 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -710,6 +710,12 @@ async def download_all_chat(client: pyrogram.Client):
|
|||||||
logger.warning(f"Download {key} error: {e}")
|
logger.warning(f"Download {key} error: {e}")
|
||||||
finally:
|
finally:
|
||||||
value.need_check = True
|
value.need_check = True
|
||||||
|
# 所有频道串行跑完后,补一次最后频道的快照;否则末尾那个频道永远只留在 _task_progress
|
||||||
|
# 里、不会进 _completed_chats,前端会一直显示「🚀 下载中」
|
||||||
|
snapshot_current_chat()
|
||||||
|
# snapshot 只是复制、不会清空 _task_progress,必须 reset 一下,否则前端 h-skip 会把
|
||||||
|
# 最后频道的 skipped_files 同时计入 completed_chats 汇总和当前值,造成双计
|
||||||
|
reset_task_progress()
|
||||||
|
|
||||||
|
|
||||||
async def run_until_all_task_finish():
|
async def run_until_all_task_finish():
|
||||||
|
|||||||
@@ -236,9 +236,8 @@ def clear_skipped_message(chat_id: str, message_id: int):
|
|||||||
|
|
||||||
def remove_download_entry(chat_id, message_id):
|
def remove_download_entry(chat_id, message_id):
|
||||||
"""从下载结果中移除条目,使其不再显示在正在下载列表"""
|
"""从下载结果中移除条目,使其不再显示在正在下载列表"""
|
||||||
chat_key = chat_id if not isinstance(chat_id, str) else chat_id
|
if chat_id in _download_result and message_id in _download_result[chat_id]:
|
||||||
if chat_key in _download_result and message_id in _download_result[chat_key]:
|
del _download_result[chat_id][message_id]
|
||||||
del _download_result[chat_key][message_id]
|
|
||||||
|
|
||||||
|
|
||||||
async def update_download_status(
|
async def update_download_status(
|
||||||
|
|||||||
@@ -1115,8 +1115,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ── 加载配置 ──
|
// ── 加载配置 ──
|
||||||
let currentFilter = '';
|
|
||||||
|
|
||||||
function parseFilterDisplay(filter) {
|
function parseFilterDisplay(filter) {
|
||||||
if (!filter) return '';
|
if (!filter) return '';
|
||||||
const startM = filter.match(/message_date\s*>=\s*(\d{4}-\d{2}-\d{2})/);
|
const startM = filter.match(/message_date\s*>=\s*(\d{4}-\d{2}-\d{2})/);
|
||||||
@@ -1144,7 +1142,6 @@
|
|||||||
const el = document.getElementById('cfg-path');
|
const el = document.getElementById('cfg-path');
|
||||||
el.textContent = p; el.title = p;
|
el.textContent = p; el.title = p;
|
||||||
document.getElementById('path-input').value = d.save_path || '';
|
document.getElementById('path-input').value = d.save_path || '';
|
||||||
currentFilter = d.download_filter || '';
|
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1587,7 +1584,11 @@
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
fetch('/api/task_progress').then(r => r.json()).then(p => {
|
fetch('/api/task_progress').then(r => r.json()).then(p => {
|
||||||
document.getElementById('h-skip').textContent = p.skipped_files || 0;
|
// h-skip 要跨频道累加:本次运行里已完成频道的 skip 汇总 + 当前频道实时的 skipped_files
|
||||||
|
// 否则切频道时 reset_task_progress 会把计数清零,视觉上会「跳过数突然归零」
|
||||||
|
const completed = Array.isArray(p.completed_chats) ? p.completed_chats : [];
|
||||||
|
const completedSkip = completed.reduce((s, c) => s + (c.skip || 0), 0);
|
||||||
|
document.getElementById('h-skip').textContent = completedSkip + (p.skipped_files || 0);
|
||||||
renderTaskQueue(p);
|
renderTaskQueue(p);
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user