Files
OpenFlare/frontend/app/(main)/waf/rules/editor/components/node-library.tsx
T
ryan 28eef0bbcd feat(waf): 新增 UA 检查节点 ua_check
支持要求携带 UA、浏览器/OS 白名单 and-or 匹配,以及优先屏蔽爬虫与非正常 UA。
2026-07-19 11:35:31 +08:00

49 lines
1.2 KiB
TypeScript

import {
Ban,
Fingerprint,
Globe2,
ScanSearch,
ShieldCheck,
} from 'lucide-react';
import { Button } from '@/components/ui/button';
import {
NODE_TYPE_LABELS,
WAF_NODE_DRAG_MIME,
type AddableNodeType,
} from './node-factory';
const items = [
{ type: 'ip_match' as const, icon: Fingerprint },
{ type: 'geo_match' as const, icon: Globe2 },
{ type: 'ua_check' as const, icon: ScanSearch },
{ type: 'pow' as const, icon: ShieldCheck },
{ type: 'block' as const, icon: Ban },
] satisfies { type: AddableNodeType; icon: typeof Fingerprint }[];
export function NodeLibrary() {
return (
<div className='flex items-center gap-2'>
{items.map(({ type, icon: Icon }) => (
<Button
key={type}
type='button'
variant='outline'
size='sm'
draggable
className='cursor-grab active:cursor-grabbing'
onDragStart={(event) => {
event.dataTransfer.setData(WAF_NODE_DRAG_MIME, type);
event.dataTransfer.setData('text/plain', type);
event.dataTransfer.effectAllowed = 'copy';
}}
>
<Icon data-icon='inline-start' />
{NODE_TYPE_LABELS[type]}
</Button>
))}
</div>
);
}