From 75a45313c4a8fca0dec4cc1cc72f725319d116e6 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Mon, 10 Aug 2026 11:17:19 +0000 Subject: [PATCH] =?UTF-8?q?dnfs2:=20=E7=89=B9=E6=AE=8A=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=20link=20=E7=B1=BB=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=B8=BA=20js/file/style/theme=20=E5=9B=9B?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dnfs2/src/dnfs2.cpp | 18 +++------------- fsys/public/dnfs.html | 1 - fsys/public/js/dnfs.js | 48 +++++++----------------------------------- 3 files changed, 11 insertions(+), 56 deletions(-) diff --git a/dnfs2/src/dnfs2.cpp b/dnfs2/src/dnfs2.cpp index 6d0aa03..e36e3b6 100644 --- a/dnfs2/src/dnfs2.cpp +++ b/dnfs2/src/dnfs2.cpp @@ -56,7 +56,6 @@ using namespace pmc::net; static constexpr size_t kMaxBodySize = 10 * 1024 * 1024; // 特殊节点 -static constexpr size_t kSpMaxUrl = 2048; static constexpr size_t kSpMaxCode = 512 * 1024; static constexpr size_t kSpMaxData = 3500 * 1024; static constexpr size_t kSpReviewCodePrefix = 4000; @@ -243,7 +242,7 @@ private: // 特殊节点校验 // ============================================================================ -static const std::vector kSpTypes = {"link", "js", "file", "style", "theme"}; +static const std::vector kSpTypes = {"js", "file", "style", "theme"}; // 识别特殊节点信封:合法信封返回 object;普通内容返回 nullptr; // 以 {"_sp" 开头但 JSON 非法视为格式错误(抛异常)。 @@ -279,15 +278,7 @@ static void validate_sp(const json::object& sp) { if (sp.contains("persist") && !sp.at("persist").is_bool()) throw DnfsExp("persist 必须是布尔值", 400); - if (t == "link") { - if (!sp.contains("url") || !sp.at("url").is_string()) - throw DnfsExp("链接节点缺少 url", 400); - std::string url = std::string(sp.at("url").as_string()); - if (url.rfind("http://", 0) != 0 && url.rfind("https://", 0) != 0) - throw DnfsExp("链接节点必须是 http/https URL", 400); - if (url.size() > kSpMaxUrl) - throw DnfsExp("链接过长", 400); - } else if (t == "js") { + if (t == "js") { if (!sp.contains("code") || !sp.at("code").is_string()) throw DnfsExp("前端代码不能为空", 400); std::string code = std::string(sp.at("code").as_string()); @@ -364,10 +355,7 @@ static std::string sp_review_text(const std::string& title, const json::object& } std::string t = std::string(sp.at("_sp").as_string()); - if (t == "link") { - if (sp.contains("url") && sp.at("url").is_string()) - parts.push_back(std::string(sp.at("url").as_string())); - } else if (t == "js") { + if (t == "js") { if (sp.contains("code") && sp.at("code").is_string()) { std::string code = std::string(sp.at("code").as_string()); if (code.size() > kSpReviewCodePrefix) code = code.substr(0, kSpReviewCodePrefix); diff --git a/fsys/public/dnfs.html b/fsys/public/dnfs.html index 37d7a9f..d103b4d 100644 --- a/fsys/public/dnfs.html +++ b/fsys/public/dnfs.html @@ -31,7 +31,6 @@