fix(static): 前端脚本识别 WAF 拦截响应并正确提示

- validation.js 新增 WafTip 公共检测:403 + 响应体含 blocked by WAF 双重特征,
  与 gateway 白名单拒绝的 403(JSON 错误消息)精确区分
- login/register/dnfs/view 各请求点在 JSON 解析前识别拦截,统一提示
  「请求被 WAF 安全规则拦截,请检查输入内容」
- 修复 dnfs getNode 被 WAF 拦截时落入 catch 误跳登录页的问题
- 验证码图片加载识别 403 拦截,alt 提示点击重试
- __view.html 补充引入 validation.js
This commit is contained in:
qing committed 2026-07-30 11:01:34 +08:00
1 parent 40175eddb5
commit 9765edac9b
6 files changed
+34 -1

No files matched your search

+10
View File
@@ -19,6 +19,11 @@ async function getNode(id) {
});
const responseText = await res.text();
// WAF 拦截:弹提示并中止,不能落入 catch(其会误跳登录页)
if (window.WafTip && WafTip.isBlocked(res, responseText)) {
alert(WafTip.MESSAGE);
return;
}
let result;
try {
@@ -78,6 +83,7 @@ async function addNode(pid, title, content) {
});
const responseText = await res.text();
if (window.WafTip && WafTip.isBlocked(res, responseText)) throw new Error(WafTip.MESSAGE);
let result;
try {
@@ -137,6 +143,7 @@ async function deleteNode(id) {
});
const responseText = await res.text();
if (window.WafTip && WafTip.isBlocked(res, responseText)) throw new Error(WafTip.MESSAGE);
let result;
try {
@@ -188,6 +195,7 @@ async function deleteChild(id) {
});
const responseText = await res.text();
if (window.WafTip && WafTip.isBlocked(res, responseText)) throw new Error(WafTip.MESSAGE);
let result;
try {
@@ -246,6 +254,7 @@ async function updateNode(id, pid, title, content) {
});
const responseText = await res.text();
if (window.WafTip && WafTip.isBlocked(res, responseText)) throw new Error(WafTip.MESSAGE);
let result;
try {
@@ -301,6 +310,7 @@ async function moveNode(id, pid, title, content) {
});
const responseText = await res.text();
if (window.WafTip && WafTip.isBlocked(res, responseText)) throw new Error(WafTip.MESSAGE);
let result;
try {