PageSourceSearch

https://5ducks.ai/assets/BulkSignups-DTW3Se5J.js

js 5ducks.ai collected 2026-10-05 15:17:35 UTC 13,062 bytes, 1 lines download raw bytes

1import{w as Ce,u as Ne,r as o,V as Z,ai as d,j as e,ad as Se,ba as we,B as r,aa as Te,ae as Ae,af as ke,ag as Re,ak as De,ar as N,aZ as S,a_ as w,a$ as T,b0 as A,b1 as u,I as Pe,al as Ee,Y as ee,a3 as se,a4 as te,$ as ae,as as ie,at as ne,au as p,av as a,aw as re,ax as i,aJ as k,bg as R,aK as D,aL as P,aM as E,aN as M,aO as F,aP as B,aQ as I,aI as Me,X as Fe,g as Be,C as Ie,O as h,aR as ce}from"./index-BA-hDO3C.js";import{B as L}from"./badge-BmS2sdGI.js";import{S as Le}from"./switch-JUsuRP0a.js";import{T as Oe}from"./TriggerReviewButton-DgCW6cm1.js";import{S as ze}from"./shield-BxDR8zf3.js";import{R as O}from"./refresh-cw-Bjqttn03.js";import{G as $e}from"./globe-B4oBl9ot.js";import{T as Ve}from"./trash-2-C0n4-7p4.js";import{C as qe}from"./chevron-left-CJuQnFIJ.js";import"./popover-BZcGkHPI.js";import"./format-CW0G_LzU.js";import"./play-BjufNzl7.js";const Ke={pending:{label:"Pending",variant:"destructive"},approved:{label:"Approved",variant:"default"},ignored:{label:"Ignored",variant:"secondary"}},le=[{code:"CN",name:"China"},{code:"RU",name:"Russia"},{code:"IR",name:"Iran"},{code:"KP",name:"North Korea"},{code:"SY",name:"Syria"},{code:"CU",name:"Cuba"},{code:"VE",name:"Venezuela"},{code:"BY",name:"Belarus"},{code:"MM",name:"Myanmar"},{code:"AF",name:"Afghanistan"},{code:"IQ",name:"Iraq"},{code:"LY",name:"Libya"},{code:"SD",name:"Sudan"},{code:"SO",name:"Somalia"},{code:"YE",name:"Yemen"}];function z(){ce.invalidateQueries({predicate:n=>{var m;return((m=n.queryKey[0])==null?void 0:m.toString().includes("/api/bot-security/bulk-signups"))??!1}})}function $(){ce.invalidateQueries({queryKey:["/api/bot-security/bulk-signups/rules"]})}function ts(){var W;const{toast:n}=Ce(),[,m]=Ne(),[v,oe]=o.useState("all"),[c,b]=o.useState(1),j=20,[de,f]=o.useState(!1),[V,ue]=o.useState("country_block"),[x,q]=o.useState(""),[K,Y]=o.useState("At this time, SendClaw does not serve this region."),he=()=>{const s=new URLSearchParams;return v!=="all"&&s.set("status",v),s.set("page",c.toString()),s.set("pageSize",j.toString()),s.toString()},{data:l,isLoading:xe,refetch:me}=Z({queryKey:[`/api/bot-security/bulk-signups?${he()}`]}),{data:y,isLoading:je}=Z({queryKey:["/api/bot-security/bulk-signups/rules"]}),H=d({mutationFn:async s=>h("POST",`/api/bot-security/bulk-signups/${s}/approve`),onSuccess:s=>{n({title:"Alert Approved",description:s.message}),z()},onError:()=>{n({title:"Error",description:"Failed to approve alert",variant:"destructive"})}}),Q=d({mutationFn:async s=>h("POST",`/api/bot-security/bulk-signups/${s}/ignore`),onSuccess:()=>{n({title:"Alert Ignored",description:"The alert has been dismissed"}),z()},onError:()=>{n({title:"Error",description:"Failed to ignore alert",variant:"destructive"})}}),U=d({mutationFn:async s=>h("POST","/api/bot-security/bulk-signups/force-scan",s?{date:s}:{}),onSuccess:s=>{n({title:"Scan Complete",description:s.message}),z()},onError:()=>{n({title:"Error",description:"Failed to run scan",variant:"destructive"})}}),C=d({mutationFn:async s=>h("POST","/api/bot-security/bulk-signups/rules",s),onSuccess:()=>{n({title:"Rule Created",description:"Security rule has been added"}),$(),f(!1),q(""),Y("At this time, SendClaw does not serve this region.")},onError:()=>{n({title:"Error",description:"Failed to create rule",variant:"destructive"})}}),ge=d({mutationFn:async({id:s,enabled:t})=>h("PATCH",`/api/bot-security/bulk-signups/rules/${s}`,{enabled:t}),onSuccess:()=>{$()},onError:()=>{n({title:"Error",description:"Failed to update rule",variant:"destructive"})}}),pe=d({mutationFn:async s=>h("DELETE",`/api/bot-security/bulk-signups/rules/${s}`),onSuccess:()=>{n({title:"Rule Deleted",description:"Security rule has been removed"}),$()},onError:()=>{n({title:"Error",description:"Failed to delete rule",variant:"destructive"})}}),ve=s=>{const t=s?s.toISOString().split("T")[0]:void 0;U.mutate(t)},be=()=>{if(!x){n({title:"Error",description:"Please select a country",variant:"destructive"});return}const s=le.find(t=>t.code===x);C.mutate({type:V,value:x,label:`Block ${(s==null?void 0:s.name)||x}`,message:K})},g=l?Math.ceil(l.total/j):0,_=s=>new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}),fe=(s,t)=>Math.round((new Date(t).getTime()-new Date(s).getTime())/6e4),G=(y==null?void 0:y.items)||[];return e.jsxs("div",{className:"container mx-auto py-8 px-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ze,{className:"h-8 w-8 text-destructive"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Bulk Signup Alerts"}),e.jsx("p",{className:"text-muted-foreground",children:"Detect and manage coordinated bot registration patterns"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Se,{open:de,onOpenChange:f,children:[e.jsx(we,{asChild:!0,children:e.jsxs(r,{variant:"outline",size:"sm",children:[e.jsx(Te,{className:"h-4 w-4 mr-2"}),"Add Rule"]})}),e.jsxs(Ae,{children:[e.jsxs(ke,{children:[e.jsx(Re,{children:"Add Security Rule"}),e.jsx(De,{children:"Create a rule to automatically block bot registrations based on criteria."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Rule Type"}),e.jsxs(S,{value:V,onValueChange:ue,children:[e.jsx(w,{children:e.jsx(T,{})}),e.jsx(A,{children:e.jsx(u,{value:"country_block",children:"Country Block"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Country"}),e.jsxs(S,{value:x,onValueChange:q,children:[e.jsx(w,{children:e.jsx(T,{placeholder:"Select a country"})}),e.jsx(A,{children:le.map(s=>
1e.jsxs(u,{value:s.code,children:[s.name," (",s.code,")"]},s.code))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Message shown to blocked users"}),e.jsx(Pe,{value:K,onChange:s=>Y(s.target.value),placeholder:"At this time, SendClaw does not serve this region."})]})]}),e.jsxs(Ee,{children:[e.jsx(r,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),e.jsx(r,{onClick:be,disabled:C.isPending,children:C.isPending?"Creating...":"Create Rule"})]})]})]}),e.jsx(Oe,{onTrigger:ve,isPending:U.isPending,label:"Run Scan",description:"Default scans last 24 hours"}),e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>me(),children:[e.jsx(O,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})]}),e.jsxs(ee,{className:"mb-6",children:[e.jsx(se,{className:"pb-4",children:e.jsxs(te,{className:"text-lg flex items-center gap-2",children:[e.jsx($e,{className:"h-5 w-5"}),"Security Rules"]})}),e.jsx(ae,{children:je?e.jsx("div",{className:"flex justify-center py-6",children:e.jsx(O,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):G.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No security rules configured. Click "Add Rule" to create one.'}):e.jsx("div",{className:"overflow-x-auto rounded-md border",children:e.jsxs(ie,{children:[e.jsx(ne,{children:e.jsxs(p,{children:[e.jsx(a,{children:"Rule"}),e.jsx(a,{children:"Type"}),e.jsx(a,{children:"Value"}),e.jsx(a,{children:"Message"}),e.jsx(a,{children:"Enabled"}),e.jsx(a,{children:"Created"}),e.jsx(a,{className:"text-right",children:"Actions"})]})}),e.jsx(re,{children:G.map(s=>e.jsxs(p,{children:[e.jsx(i,{className:"font-medium",children:s.label}),e.jsx(i,{children:e.jsx(L,{variant:"outline",children:s.type==="country_block"?"Country":s.type})}),e.jsx(i,{children:e.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children:s.value})}),e.jsx(i,{className:"max-w-[300px] truncate text-sm text-muted-foreground",children:s.message}),e.jsx(i,{children:e.jsx(Le,{checked:s.enabled,onCheckedChange:t=>ge.mutate({id:s.id,enabled:t})})}),e.jsx(i,{className:"whitespace-nowrap text-sm",children:_(s.createdAt)}),e.jsx(i,{className:"text-right",children:e.jsxs(k,{children:[e.jsx(R,{asChild:!0,children:e.jsx(r,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",children:e.jsx(Ve,{className:"h-4 w-4"})})}),e.jsxs(D,{children:[e.jsxs(P,{children:[e.jsx(E,{children:"Delete Rule?"}),e.jsxs(M,{children:['This will permanently delete the rule "',s.label,'". Bot registrations from this source will no longer be blocked by this rule.']})]}),e.jsxs(F,{children:[e.jsx(B,{children:"Cancel"}),e.jsx(I,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>pe.mutate(s.id),children:"Delete"})]})]})]})})]},s.id))})]})})})]}),e.jsxs(ee,{children:[e.jsx(se,{className:"pb-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-between",children:[e.jsx(te,{className:"text-lg",children:"Alerts"}),e.jsxs(S,{value:v,onValueChange:s=>{oe(s),b(1)},children:[e.jsx(w,{className:"w-[150px]",children:e.jsx(T,{placeholder:"Status"})}),e.jsxs(A,{children:[e.jsx(u,{value:"all",children:"All Statuses"}),e.jsx(u,{value:"pending",children:"Pending"}),e.jsx(u,{value:"approved",children:"Approved"}),e.jsx(u,{value:"ignored",children:"Ignored"})]})]})]})}),e.jsx(ae,{children:xe?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(O,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(W=l==null?void 0:l.items)!=null&&W.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto rounded-md border",children:e.jsxs(ie,{children:[e.jsx(ne,{children:e.jsxs(p,{children:[e.jsx(a,{children:"Date"}),e.jsx(a,{children:"Name Prefix"}),e.jsx(a,{children:"Bots"}),e.jsx(a,{children:"IPs"}),e.jsx(a,{children:"Claimed"}),e.jsx(a,{children:"Window"}),e.jsx(a,{children:"Status"}),e.jsx(a,{className:"text-right",children:"Actions"})]})}),e.jsx(re,{children:l.items.map(s=>{var J,X;const t=Ke[s.status],ye=s.status==="pending";return e.jsxs(p,{children:[e.jsx(i,{className:"whitespace-nowrap text-sm",children:_(s.createdAt)}),e.jsx(i,{children:e.jsx("code",{className:"text-sm bg-muted px-2 py-0.5 rounded",children:s.namePrefix||"—"})}),e.jsx(i,{children:e.jsx("span",{className:"font-mono font-bold",children:s.botCount})}),e.jsx(i,{children:e.jsx("span",{className:"font-mono",children:((J=s.ipList)==null?void 0:J.length)||0})}),e.jsxs(i,{children:[e.jsxs("span",{className:`font-mono ${s.claimedCount===0?"text-destructive font-bold":""}`,children:[s.claimedCount,"/",s.botCount]}),s.claimedCount===0&&e.jsx(L,{variant:"destructive",className:"ml-2 text-xs",children:"Red Flag"})]}),e.jsxs(i,{className:"whitespace-nowrap text-sm",children:[fe(s.windowStart,s.windowEnd),"m"]}),e.jsx(i,{children:e.jsx(L,{variant:(t==null?void 0:t.variant)||"outline",children:(t==null?void 0:t.label)||s.status})}),e.jsx(i,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsxs(r,{variant:"ghost",size:"sm",onClick:()=>m(`/admin/bulk-signups/${s.id}`),children:[e.jsx(Me,{className:"h-4 w-4 mr-1"}),"View"]}
1),ye&&e.jsxs(e.Fragment,{children:[e.jsxs(k,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{variant:"ghost",size:"sm",className:"text-muted-foreground",disabled:Q.isPending,children:[e.jsx(Fe,{className:"h-4 w-4 mr-1"}),"Ignore"]})}),e.jsxs(D,{children:[e.jsxs(P,{children:[e.jsx(E,{children:"Ignore Alert?"}),e.jsxs(M,{children:["This will dismiss the alert for ",e.jsx("strong",{children:s.botCount}),' bots with prefix "',e.jsx("strong",{children:s.namePrefix}),'". No action will be taken.']})]}),e.jsxs(F,{children:[e.jsx(B,{children:"Cancel"}),e.jsx(I,{onClick:()=>Q.mutate(s.id),children:"Ignore"})]})]})]}),e.jsxs(k,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(r,{size:"sm",variant:"destructive",disabled:H.isPending,children:[e.jsx(Be,{className:"h-4 w-4 mr-1"}),"Approve"]})}),e.jsxs(D,{children:[e.jsxs(P,{children:[e.jsx(E,{children:"Approve Removal?"}),e.jsxs(M,{children:["This will ",e.jsxs("strong",{children:["suspend ",s.botCount," bots"]}),' with prefix "',e.jsx("strong",{children:s.namePrefix}),'", remove their handles, and ',e.jsxs("strong",{children:["block ",((X=s.ipList)==null?void 0:X.length)||0," IPs for 14 days"]}),". This action cannot be undone."]})]}),e.jsxs(F,{children:[e.jsx(B,{children:"Cancel"}),e.jsx(I,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>H.mutate(s.id),children:"Approve Removal"})]})]})]})]})]})})]},s.id)})})]})}),g>1&&e.jsxs("div",{className:"flex items-center justify-between mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",(c-1)*j+1,"-",Math.min(c*j,l.total)," of ",l.total," alerts"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>b(s=>Math.max(1,s-1)),disabled:c<=1,children:[e.jsx(qe,{className:"h-4 w-4"}),"Prev"]}),e.jsxs("span",{className:"text-sm px-2",children:["Page ",c," of ",g]}),e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>b(s=>Math.min(g,s+1)),disabled:c>=g,children:["Next",e.jsx(Ie,{className:"h-4 w-4"})]})]})]})]}):e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No bulk signup alerts found"})})]})]})}export{ts as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.