PageSourceSearch

https://tellmemore.ai/assets/admin-banned-content-BOK_h_y9.js

js tellmemore.ai collected 2026-10-05 15:53:48 UTC 6,877 bytes, 1 lines download raw bytes

1import{u as k,m as R,r as p,a as B,n as I,j as e,C as i,o as l,p as d,al as D,f as r,az as F,aA as U,aB as j,b9 as A,af as T,a9 as z,aD as u,$ as K,z as N,I as C,T as $,B as P,t as o,am as M,P as Q,F as L,G as q}from"./index-BbHYa4r9.js";import{B as G}from"./ban-DEf2GRI9.js";function V(){const{user:n,isLoading:E}=k(),{toast:c}=R(),[x,v]=p.useState(""),[m,g]=p.useState(""),[b,y]=p.useState(""),{data:a,isLoading:f}=B({queryKey:["/api/admin/banned-content"]}),{data:t,isLoading:S}=B({queryKey:["/api/admin/ip-bans"]}),h=I({mutationFn:async()=>L("POST","/api/admin/ip-bans",{ipAddress:x.trim(),reason:m.trim(),notes:b.trim()||void 0}),onSuccess:()=>{q.invalidateQueries({queryKey:["/api/admin/ip-bans"]}),v(""),g(""),y(""),c({title:"IP banned",description:`${x.trim()} is now blocked.`})},onError:()=>c({title:"Failed to ban IP",variant:"destructive"})}),w=I({mutationFn:async s=>L("DELETE",`/api/admin/ip-bans/${encodeURIComponent(s)}`),onSuccess:()=>{q.invalidateQueries({queryKey:["/api/admin/ip-bans"]}),c({title:"IP unbanned"})},onError:()=>c({title:"Failed to unban IP",variant:"destructive"})});return E?e.jsx("div",{className:"max-w-6xl mx-auto p-4",children:e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-stone-200 rounded w-64"}),e.jsx("div",{className:"h-32 bg-stone-200 rounded"})]})}):!(n!=null&&n.isAdmin)&&(n==null?void 0:n.username)!=="tellmemore"?e.jsx("div",{className:"max-w-4xl mx-auto p-4",children:e.jsxs(i,{children:[e.jsx(l,{children:e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(D,{className:"w-5 h-5 text-red-500"}),"Access Denied"]})}),e.jsx(r,{children:e.jsx("p",{className:"text-stone-600",children:"You need admin privileges to access this page."})})]})}):e.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6 sm:py-8 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-stone-900",children:"Banned Content"}),e.jsx("p",{className:"text-stone-600 mt-2",children:"Manage banned tags, users, and IP addresses"})]}),e.jsxs(F,{defaultValue:"ips",className:"space-y-4",children:[e.jsxs(U,{className:"grid w-full grid-cols-3 max-w-lg",children:[e.jsxs(j,{value:"ips",className:"flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4"}),"IP Bans"]}),e.jsxs(j,{value:"tags",className:"flex items-center gap-2",children:[e.jsx(T,{className:"w-4 h-4"}),"Banned Tags"]}),e.jsxs(j,{value:"users",className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"Banned Users"]})]}),e.jsxs(u,{value:"ips",className:"space-y-4",children:[e.jsxs(i,{children:[e.jsx(l,{children:e.jsxs(d,{className:"flex items-center gap-2 text-base",children:[e.jsx(K,{className:"w-4 h-4"}),"Ban an IP Address"]})}),e.jsxs(r,{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(N,{className:"text-xs",children:"IP Address"}),e.jsx(C,{placeholder:"e.g. 98.181.118.241",value:x,onChange:s=>v(s.target.value)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(N,{className:"text-xs",children:"Reason (required)"}),e.jsx(C,{placeholder:"e.g. Abusive behaviour",value:m,onChange:s=>g(s.target.value)})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(N,{className:"text-xs",children:"Notes (optional)"}),e.jsx($,{placeholder:"Internal notes — not shown to users",value:b,onChange:s=>y(s.target.value),rows:2})]}),e.jsx(P,{onClick:()=>h.mutate(),disabled:!x.trim()||!m.trim()||h.isPending,variant:"destructive",size:"sm",children:h.isPending?"Banning…":"Ban IP"})]})]}),e.jsxs(i,{children:[e.jsx(l,{children:e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(A,{className:"w-5 h-5 text-red-600"}),"Active IP Bans",t&&e.jsx(o,{variant:"secondary",children:t.filter(s=>s.isActive).length})]})}),e.jsx(r,{children:S?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-stone-900"})}):!t||t.filter(s=>s.isActive).length===0?e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-stone-500",children:"No active IP bans."})}):e.jsx("div",{className:"space-y-2",children:t.filter(s=>s.isActive).map(s=>e.jsxs("div",{className:"flex items-start justify-between p-3 bg-stone-50 rounded gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("code",{className:"text-sm font-mono font-bold text-red-700",children:s.ipAddress}),e.jsx(o,{variant:"destructive",className:"text-[10px]",children:s.reason})]}),s.notes&&e.jsx("p",{className:"text-xs text-stone-500 mt-0.5",children:s.notes}),e.jsxs("p",{className:"text-xs text-stone-400 mt-0.5",children:["Banned ",M(new Date(s.bannedAt),"d MMM yyyy"),s.expiresAt&&` · expires ${M(new Date(s.expiresAt),"d MMM yyyy")}`]})]}),e.jsx(P,{variant:"ghost",size:"sm",className:"text-stone-400 hover:text-red-600 shrink-0",onClick:()=>w.mutate(s.ipAddress),disabled:w.isPending,children:e.jsx(Q,{className:"w-4 h-4"})})]},s.id))})})]})]}),e.jsx(u,{value:"tags",children:e.jsxs(i,{children:[e.jsx(l,{children:e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(T,{className:"w-5 h-5 text-orange-600"}),"Most Banned Tags"]})}),e.jsx(r,{children:f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-stone-900"})}):!(a!=null&&a.bannedTags)||a.bannedTags.length===0?e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-stone-500",children:"No banned tags yet."})}):e.jsx("div",{className:"space-y-2",children:a.bannedTags.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-stone-50 rounded",children:[e.jsx(o,{variant:"destructive",children:s.tag}),e.jsx("span",{className:"text-sm font-semibold text-stone-600",children:s.count})]},s.tag))})})]})}),e.jsx(u,{value:"users",children:e.jsxs(i,{children:[e.jsx(l,{children:e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(G,{className:"w-5 h-5 text-red-600"}),"Blocked Users"]})}),e.jsx(r,{children:f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-stone-900"})}):!(a!=null&&a.bannedUsers)||a.bannedUsers.length===0?e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-stone-500",children:"No blocked users yet."})}):e.jsx("div",{className:"space-y-2",children:a.bannedUsers.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-stone-50 rounded",children:[e.jsx("span",{className:"font-semibold text-stone-900",children:s.username}),e.jsx(o,{variant:"secondary",children:s.banCount})]},s.id))})})]})})]})]})}export{V 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.