Commit f313bd51 authored by 郭阔's avatar 郭阔

ui(edit): 抓取条数回写当前生效值(源覆盖→default.conf→20 兜底)

parent c06ad75a
...@@ -870,8 +870,10 @@ def edit_source(name): ...@@ -870,8 +870,10 @@ def edit_source(name):
if request.method == "GET": if request.method == "GET":
current_time = ",".join(t for t in pl.schedule_times(name).split(",") if t.strip()) or "-" current_time = ",".join(t for t in pl.schedule_times(name).split(",") if t.strip()) or "-"
conf = read_conf(name) conf = read_conf(name)
# 回写当前生效的抓取条数(源覆盖优先,否则 default.conf,再兜底 20)
current_count = conf.get("COUNT") or read_conf("default").get("COUNT") or "20"
return render_template("edit.html", name=name, current_time=current_time, conf=conf, return render_template("edit.html", name=name, current_time=current_time, conf=conf,
providers=get_providers()) current_count=current_count, providers=get_providers())
# POST: 执行 modify-source.sh # POST: 执行 modify-source.sh
time = request.form.get("time", "").strip() time = request.form.get("time", "").strip()
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
<label for="count">抓取条数</label> <label for="count">抓取条数</label>
<input type="number" id="count" name="count" min="1" <input type="number" id="count" name="count" min="1"
placeholder="留空不变" placeholder="留空不变"
value="{{ conf.get('COUNT', '') }}"> value="{{ current_count }}">
<div class="hint">当前: {{ conf.get('COUNT', '(继承 default.conf)') }}</div> <div class="hint">当前生效 {{ current_count }} 条{% if not conf.get('COUNT') %}(继承全局默认,保存后写入本源覆盖){% endif %}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
......
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