feat: 服务页双栏布局 + 滑块验证码 v2(图片化挑战/行为校验/限流/蜜罐)
服务页(/services): - lg+ 双栏:左列服务菜单(NO.01-07,点击选中)、右列表单 (sticky 跟随);移动端保持上下堆叠 滑块验证码 v2(防机械脚本): - 答案坐标不再下发:缺口位置由服务端烘进 PNG(lib/captchaImage 自绘点阵底图 + 拼块裁片,lib/pngEncoder 纯 TS PNG 编码器, node:zlib 零依赖),脚本必须做图像识别才能定位 - 行为轨迹校验:拖动采样提交服务端,样本数 ≥6、总时长 ≥1.2s、 单调时间戳、峰值速度 > 平均×1.8(匀速直线 = 拒)、末点 ≈ 答案 - 位置容差 ±10px;失败 5 次作废;挑战 10 分钟过期 - IP 指纹(哈希)限流:challenge 15/10min、verify 30/10min、 咨询提交 3/小时;蜜罐字段(website)命中静默丢弃 端到端:无轨迹/匀速直线/超短时长均拒;真人节奏通过;重放拦截; 蜜罐丢弃;第 14 次刷 challenge 起 429;SMTP 真发正常。
This commit is contained in:
@@ -43,6 +43,9 @@ export default function ServicesClient({
|
||||
const [name, setName] = useState("");
|
||||
const [contact, setContact] = useState("");
|
||||
const [message, setMessage] = useState("");
|
||||
// 蜜罐:人类不可见(CSS 藏 + tabIndex=-1 + autocomplete 关闭),
|
||||
// 群发机器人会把它当普通字段填上 —— 提交接口静默丢弃。
|
||||
const [honeypot, setHoneypot] = useState("");
|
||||
const [captchaOpen, setCaptchaOpen] = useState(false);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -72,6 +75,7 @@ export default function ServicesClient({
|
||||
serviceSlug: selected.slug,
|
||||
serviceTitle: selected.title,
|
||||
message: message.trim(),
|
||||
website: honeypot,
|
||||
}),
|
||||
});
|
||||
const data = (await res.json()) as { id?: number; error?: string };
|
||||
@@ -89,7 +93,7 @@ export default function ServicesClient({
|
||||
setSubmitting(false);
|
||||
}
|
||||
},
|
||||
[selected, name, contact, message]
|
||||
[selected, name, contact, message, honeypot]
|
||||
);
|
||||
|
||||
if (doneId !== null) {
|
||||
@@ -164,8 +168,10 @@ export default function ServicesClient({
|
||||
</p>
|
||||
</header>
|
||||
|
||||
{/* 服务菜单 */}
|
||||
<section className="mt-12" aria-label="服务列表">
|
||||
{/* 双栏:左服务菜单 / 右表单(lg+ 并排,移动端上下堆叠) */}
|
||||
<div className="mt-12 grid grid-cols-1 lg:grid-cols-12 gap-10 lg:gap-8 items-start">
|
||||
{/* 服务菜单(左栏) */}
|
||||
<section className="lg:col-span-6 xl:col-span-7" aria-label="服务列表">
|
||||
{services.length === 0 ? (
|
||||
<p className="font-mono-2 text-sm text-l2 border border-dashed border-line p-8 text-center">
|
||||
服务清单整理中——有需要可直接写邮件给我。
|
||||
@@ -221,8 +227,11 @@ export default function ServicesClient({
|
||||
)}
|
||||
</section>
|
||||
|
||||
{/* 留言表单 */}
|
||||
<section className="mt-12 flex flex-col gap-5" aria-label="咨询表单">
|
||||
{/* 留言表单(右栏,lg+ sticky 跟随) */}
|
||||
<section
|
||||
className="lg:col-span-6 xl:col-span-5 flex flex-col gap-5 lg:sticky lg:top-24"
|
||||
aria-label="咨询表单"
|
||||
>
|
||||
<p className="font-mono-2 text-xs text-l3 uppercase tracking-widest">
|
||||
{selected ? `咨询:${selected.title}` : "留言"}
|
||||
</p>
|
||||
@@ -273,6 +282,20 @@ export default function ServicesClient({
|
||||
<p className="mt-1.5 font-mono-2 text-xs text-l3">{submitNote}</p>
|
||||
</div>
|
||||
|
||||
{/* 蜜罐字段 — 人类不可见;机器人填了就被服务端静默丢弃 */}
|
||||
<div aria-hidden="true" className="absolute left-[-9999px] top-auto h-px w-px overflow-hidden">
|
||||
<label htmlFor="svc-website">网站(勿填)</label>
|
||||
<input
|
||||
id="svc-website"
|
||||
type="text"
|
||||
name="website"
|
||||
tabIndex={-1}
|
||||
autoComplete="off"
|
||||
value={honeypot}
|
||||
onChange={(e) => setHoneypot(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<p className="border-l-2 border-selection pl-2 text-sm text-l1" role="alert">
|
||||
{error}
|
||||
@@ -288,6 +311,7 @@ export default function ServicesClient({
|
||||
{submitting ? "提交中…" : "提交(需完成滑块验证)"}
|
||||
</button>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<SliderCaptcha
|
||||
open={captchaOpen}
|
||||
|
||||
Reference in New Issue
Block a user