From 49d9a334209da8d69fffb3ba5e6436dac7fded34 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Wed, 12 Aug 2026 15:48:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=BB=E9=A2=98/=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E7=BB=A7=E6=89=BF=E6=9F=A5=E8=AF=A2=E8=B7=B3=E8=BF=87=E8=A7=82?= =?UTF-8?q?=E7=9C=8B=E8=AE=A1=E6=95=B0=E2=80=94=E2=80=94=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E9=85=8D=E5=90=88=20noread=20=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 前端 inheritThemeStyle 的 fetch 体附加 noread:true,后端 dnfs2 _handle_get_notes 检测到该标记时跳过 _bump_views,避免静默查询 污染节点的观看次数统计。 --- dnfs2/src/dnfs2.cpp | 9 +++++++-- fsys/public/js/dnfs.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dnfs2/src/dnfs2.cpp b/dnfs2/src/dnfs2.cpp index c279c84..62fa19b 100644 --- a/dnfs2/src/dnfs2.cpp +++ b/dnfs2/src/dnfs2.cpp @@ -934,9 +934,14 @@ private: return make_json_obj(http::status::internal_server_error, err, req); } - // 打开节点 pid 时观看人数 +1(pid=0 为虚拟根节点,无对应行,跳过)。 + // 打开节点 pid 时观看人数 +1(pid=0 为虚拟根节点或无 noread 标记时, + // 前端样式继承等静默查询传 {"noread":true} 来跳过)。 // best-effort:失败仅记日志,不影响返回结果。 - if (pid != 0) { + bool noread = false; + if (auto it2 = body.find("noread"); it2 != body.end() && it2->value().is_bool()) { + noread = it2->value().as_bool(); + } + if (pid != 0 && !noread) { _bump_views(pid); } diff --git a/fsys/public/js/dnfs.js b/fsys/public/js/dnfs.js index e8fd878..b61853b 100644 --- a/fsys/public/js/dnfs.js +++ b/fsys/public/js/dnfs.js @@ -722,7 +722,7 @@ function inheritThemeStyle() { var res = await fetch('/get_notes', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ pid: pid }) + body: JSON.stringify({ pid: pid, noread: true }) }); if (gen !== _inherit_gen) return; if (!res.ok) continue;