Commit 910157b6 authored by 郭阔's avatar 郭阔

feat(panel): homepage shows computed next-fire time

launchd exposes no next-trigger (systemd-only), so the 栏目列表 下次 column
was always '-' on macOS — compute it from schedule times (same _next_fire
as the schedule board) and highlight it amber.
parent f4b55d54
...@@ -577,6 +577,15 @@ def index(): ...@@ -577,6 +577,15 @@ def index():
}) })
# 开启(开关 ON)的栏目置顶,组内保持字母序 # 开启(开关 ON)的栏目置顶,组内保持字母序
sources.sort(key=lambda s: (0 if s.get("toggle_on") else 1, s["source"])) sources.sort(key=lambda s: (0 if s.get("toggle_on") else 1, s["source"]))
# macOS launchd 不提供下次触发时间:从排期时间计算(与调度中心一致)
now = datetime.now()
for s in sources:
if s.get("next") in (None, "", "-"):
times = [t for t in pl.schedule_times(s["source"]).split(",") if t.strip()]
nxt = _next_fire(times, now)
if nxt:
s["next"] = nxt.strftime("%m-%d %H:%M")
# digest timer 状态 # digest timer 状态
digest_props = get_systemd_props("news-harvester-digest.timer") digest_props = get_systemd_props("news-harvester-digest.timer")
digest_run_time = (read_oncalendar_from_systemd("news-harvester-digest.timer") digest_run_time = (read_oncalendar_from_systemd("news-harvester-digest.timer")
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
</td> </td>
<td> <td>
<span style="color:#666;font-size:12px">上次</span> {{ s.last }}<br> <span style="color:#666;font-size:12px">上次</span> {{ s.last }}<br>
<span style="color:#666;font-size:12px">下次</span> {{ s.next }} <span style="color:#666;font-size:12px">下次</span> <span style="color:#e8c34a;font-weight:600">{{ s.next }}</span>
</td> </td>
<td> <td>
{% if s.log %} {% if s.log %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment