PageSourceSearch

https://uncensored.ai/assets/SignupAuditTab-CQIiSxTm.js

js uncensored.ai collected 2026-10-05 13:12:06 UTC 8,979 bytes, 2 lines download raw bytes

1import{r as l,w as k,j as e,B as N,I as D,q as I,R as E,T as R}from"./index-uZtOByCD.js";import{C as x,c as u}from"./card-DhR4AuIr.js";import{B as T}from"./badge-0Vfv_Kne.js";import{S as A}from"./skeleton-igHUvnUl.js";import{S as B}from"./shield-DLDD69IG.js";const y={created:"bg-emerald-500/10 text-emerald-400 border-emerald-500/30",email_exists:"bg-amber-500/10 text-amber-400 border-amber-500/30",rate_limited:"bg-red-500/10 text-red-400 border-red-500/30",blocked_domain:"bg-red-500/10 text-red-400 border-red-500/30",weak_password:"bg-amber-500/10 text-amber-400 border-amber-500/30",missing_fields:"bg-muted text-muted-foreground border-border/50",create_error:"bg-red-500/10 text-red-400 border-red-500/30",exception:"bg-red-500/10 text-red-400 border-red-500/30"};function z(){const[i,C]=l.useState([]),[f,w]=l.useState(!0),[_,v]=l.useState(null),[b,S]=l.useState(""),[p,O]=l.useState("all"),[g,L]=l.useState(24),j=l.useCallback(async()=>{var t;w(!0),v(null);try{const{data:s}=await k.auth.getSession(),n=(t=s.session)==null?void 0:t.access_token;if(!n)throw new Error("Admin sign-in required");const a=await fetch(`https://xpasfhcxsldtjymqemey.supabase.co/functions/v1/admin-signup-audit?t=${Date.now()}`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json",apikey:"sb_publishable_ffUSDgpKldxZrcNI8WRaWw_PHdOocvc",Authorization:`Bearer ${n}`},body:JSON.stringify({windowHours:g})}),r=await a.text();let o=null;try{o=r?JSON.parse(r):null}catch{o={error:r}}if(!a.ok||o!=null&&o.error)throw new Error((o==null?void 0:o.error)||`Service returned ${a.status}`);C((o==null?void 0:o.rows)??[])}catch(s){v((s==null?void 0:s.message)??"Failed to load signup audit")}finally{w(!1)}},[g]);l.useEffect(()=>{j()},[j]);const c=l.useMemo(()=>{const t=b.trim().toLowerCase();return i.filter(s=>p!=="all"&&s.outcome!==p?!1:t?(s.email??"").toLowerCase().includes(t)||(s.email_domain??"").toLowerCase().includes(t)||(s.client_ip??"").toLowerCase().includes(t)||(s.user_agent??"").toLowerCase().includes(t):!0)},[i,b,p]),d=l.useMemo(()=>{const t={},s={},n={};for(const a of i)t[a.outcome]=(t[a.outcome]??0)+1,a.email_domain&&(s[a.email_domain]=(s[a.email_domain]??0)+1),a.client_ip&&(n[a.client_ip]=(n[a.client_ip]??0)+1);const h=Object.entries(s).sort((a,r)=>r[1]-a[1]).slice(0,10),m=Object.entries(n).sort((a,r)=>r[1]-a[1]).slice(0,10);return{total:i.length,byOutcome:t,topDomains:h,topIps:m}},[i]),U=l.useCallback(()=>{const t=["created_at","outcome","email","email_domain","client_ip","captcha_result","error_code","user_id","user_agent"],s=r=>{const o=r==null?"":String(r);return/[",\n]/.test(o)?`"${o.replace(/"/g,'""')}"`:o},n=[t.join(",")];for(const r of c)n.push([r.created_at,r.outcome,r.email,r.email_domain,r.client_ip,r.captcha_result,r.error_code,r.user_id,r.user_agent].map(s).join(","));const h=new Blob([n.join(`
2`)],{type:"text/csv"}),m=URL.createObjectURL(h),a=document.createElement("a");a.href=m,a.download=`signup-audit-${new Date().toISOString().slice(0,10)}.csv`,a.click(),URL.revokeObjectURL(m)},[c]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 rounded-lg border border-border/50 bg-card/60 p-1",children:[1,6,24,72,168].map(t=>e.jsx(N,{size:"sm",variant:g===t?"default":"ghost",className:"h-7 px-2.5 text-xs",onClick:()=>L(t),children:t<24?`${t}h`:`${Math.round(t/24)}d`},t))}),e.jsx(D,{value:b,onChange:t=>S(t.target.value),placeholder:"Filter by email, domain, IP, UA…",className:"h-8 w-64 text-xs"}),e.jsxs("select",{value:p,onChange:t=>O(t.target.value),className:"h-8 rounded-md border border-border/50 bg-card/60 px-2 text-xs text-foreground",children:[e.jsx("option",{value:"all",children:"All outcomes"}),Object.keys(y).map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(N,{size:"sm",variant:"outline",className:"h-8 gap-1.5 text-xs",onClick:U,children:[e.jsx(I,{className:"h-3.5 w-3.5"})," CSV"]}),e.jsxs(N,{size:"sm",variant:"outline",className:"h-8 gap-1.5 text-xs",onClick:j,disabled:f,children:[e.jsx(E,{className:`h-3.5 w-3.5 ${f?"animate-spin":""}`})," Refresh"]})]})]}),_&&e.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400 flex items-center gap-2",children:[e.jsx(R,{className:"h-3.5 w-3.5"})," ",_]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:[e.jsx(x,{className:"bg-card/80",children:e.jsxs(u,{className:"p-3",children:[e.jsx("div",{className:"text-[11px] text-muted-foreground uppercase tracking-wide",children:"Attempts"}),e.jsx("div",{className:"text-2xl font-semibold text-foreground",children:d.total})]})}),["created","rate_limited","blocked_domain","email_exists","create_error"].map(t=>e.jsx(x,{className:"bg-card/80",children:e.jsxs(u,{className:"p-3",children:[e.jsx("div",{className:"text-[11px] text-muted-foreground uppercase tracking-wide",children:t.replace("_"," ")}),e.jsx("div",{className:"text-2xl font-semibold text-foreground",children:d.byOutcome[t]??0})]})},t))]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsx(x,{className:"bg-card/80",children:e.jsxs(u,{className:"p-4",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"Top email domains"}),d.topDomains.length===0?e.jsx("div",{className:"text-xs text-muted-foreground",children:"No data"}):e.jsx("ul",{className:"space-y-1 text-xs",children:d.topDomains.map(([t,s])=>e.jsxs("li",{className:"flex items-center justify-between font-mono",children:[e.jsx("span",{className:"truncate",children:t}),e.jsx("span",{className:"text-foreground font-semibold",children:s})]},t))})]})}),e.jsx(x,{className:"bg-card/80",children:e.jsxs(u,{className:"p-4",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"Top IPs"}),d.topIps.length===0?e.jsx("div",{className:"text-xs text-muted-foreground",children:"No data"}):e.jsx("ul",{className:"space-y-1 text-xs",children:d.topIps.map(([t,s])=>e.jsxs("li",{className:"flex items-center justify-between font-mono",children:[e.jsx("span",{className:"truncate",children:t}),e.jsx("span",{className:"text-foreground font-semibold",children:s})]},t))})]})})]}),e.jsx(x,{className:"bg-card/80",children:e.jsx(u,{className:"p-0",children:f?e.jsx("div",{className:"p-4 space-y-2",children:Array.from({length:8}).map((t,s)=>e.jsx(A,{className:"h-8 w-full"},s))}):c.length===0?e.jsxs("div",{className:"p-8 text-center text-sm text-muted-foreground flex flex-col items-center gap-2",children:[e.jsx(B,{className:"h-8 w-8"}),"No signup attempts in this window."]}):e.jsxs("div",{className:"overflow-x-auto table-cards-wrap",children:[e.jsxs("table",{className:"table-cards w-full text-xs",children:[e.jsx("thead",{className:"bg-muted/30 text-muted-foreground uppercase tracking-wide",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Time"}),e.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Outcome"}),e.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Email"}),e.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Domain"}),e.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"IP"}),e.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Captcha"}),e.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"UA"})]})}),e.jsx("tbody",{children:c.slice(0,500).map(t=>e.jsxs("tr",{className:"border-t border-border/30 hover:bg-muted/20",children:[e.jsx("td",{"data-label":"Time",className:"px-3 py-1.5 font-mono text-muted-foreground whitespace-nowrap",children:new Date(t.created_at).toLocaleStr
2ing()}),e.jsx("td",{"data-label":"Outcome",className:"px-3 py-1.5",children:e.jsx(T,{className:`text-[10px] font-mono ${y[t.outcome]??"bg-muted text-muted-foreground border-border/50"}`,variant:"outline",children:t.outcome})}),e.jsx("td",{"data-label":"Email",className:"px-3 py-1.5 font-mono truncate max-w-[220px]",children:t.email??"—"}),e.jsx("td",{"data-label":"Domain",className:"px-3 py-1.5 font-mono text-muted-foreground",children:t.email_domain??"—"}),e.jsx("td",{"data-label":"IP",className:"px-3 py-1.5 font-mono text-muted-foreground",children:t.client_ip??"—"}),e.jsx("td",{"data-label":"Captcha",className:"px-3 py-1.5 font-mono text-muted-foreground",children:t.captcha_result??"—"}),e.jsx("td",{"data-label":"UA",className:"px-3 py-1.5 font-mono text-muted-foreground truncate max-w-[280px]",title:t.user_agent??"",children:t.user_agent??"—"})]},t.id))})]}),c.length>500&&e.jsxs("div",{className:"px-3 py-2 text-[11px] text-muted-foreground border-t border-border/30",children:["Showing first 500 of ",c.length," rows — narrow the filter or export CSV for the full set."]})]})})})]})}export{z 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.