PageSourceSearch

https://escortadvisor-b4fe68rl.manus.space/assets/AdminProxies-DJLrYPJU.js

js escortadvisor-b4fe68rl.manus.space collected 2026-10-03 05:02:12 UTC 12,687 bytes, 6 lines download raw bytes

1import{c as K,j as e,aK as x,f as X,r as d,t as n,q as i,L as J,B as r,a6 as E,ah as p,ao as W,b6 as Y,aU as Z,ap as ee,b7 as te,b8 as se,as as I,a9 as ae,x as ie,az as le,am as re}from"./index-cscxoOf9.js";import{B as ne}from"./badge-Dj3athcC.js";import{C as b,a as v,b as R,c as $}from"./card-D3DTOm_c.js";import{S as ce,a as oe,b as de,c as xe,d as w}from"./select-DV5rJMmL.js";import{A as he}from"./arrow-left-B9FPhhoq.js";import{A as me}from"./activity-yT1jo4yw.js";import{C as ue}from"./circle-x-DHp6YeSD.js";import{R as je}from"./refresh-cw-D0KbhpJJ.js";import"./index-DFAQqnLD.js";import"./chevron-up-BeQs4DJL.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const pe=K("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);function Ne({className:s,...a}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:x("w-full caption-bottom text-sm",s),...a}
6)})}function ge({className:s,...a}){return e.jsx("thead",{"data-slot":"table-header",className:x("[&_tr]:border-b",s),...a})}function be({className:s,...a}){return e.jsx("tbody",{"data-slot":"table-body",className:x("[&_tr:last-child]:border-0",s),...a})}function H({className:s,...a}){return e.jsx("tr",{"data-slot":"table-row",className:x("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...a})}function c({className:s,...a}){return e.jsx("th",{"data-slot":"table-head",className:x("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function o({className:s,...a}){return e.jsx("td",{"data-slot":"table-cell",className:x("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function ze(){const{user:s}=X(),a=s?.role==="admin",[m,f]=d.useState(1),[U,y]=d.useState(!1),[N,C]=d.useState(""),[k,A]=d.useState(""),[P,S]=d.useState(null),[T,z]=d.useState(!1),l=n.useUtils(),{data:B,isLoading:D,refetch:q}=n.proxy.list.useQuery({page:m,limit:20},{enabled:a}),{data:u}=n.proxy.stats.useQuery(void 0,{enabled:a}),g=n.proxy.add.useMutation({onSuccess:()=>{i.success("Proxy aggiunto con successo"),y(!1),C(""),A(""),l.proxy.list.invalidate(),l.proxy.stats.invalidate()},onError:t=>i.error(t.message)}),O=n.proxy.remove.useMutation({onSuccess:()=>{i.success("Proxy rimosso"),l.proxy.list.invalidate(),l.proxy.stats.invalidate()},onError:t=>i.error(t.message)}),V=n.proxy.updateStatus.useMutation({onSuccess:()=>{l.proxy.list.invalidate(),l.proxy.stats.invalidate()},onError:t=>i.error(t.message)}),G=n.proxy.test.useMutation({onMutate:({id:t})=>S(t),onSettled:()=>S(null),onSuccess:t=>{t.success?i.success(`Proxy funzionante! Tempo risposta: ${t.latencyMs??"?"}ms`):i.error(`Proxy non funzionante: ${t.error}`),l.proxy.list.invalidate()},onError:t=>i.error(t.message)}),Q=n.proxy.healthCheckAll.useMutation({onMutate:()=>z(!0),onSettled:()=>z(!1),onSuccess:t=>{i.success(`Health check completato: ${t.passed} passati, ${t.failed} falliti`),l.proxy.list.invalidate(),l.proxy.stats.invalidate()},onError:t=>i.error(t.message)});if(!s||s.role!=="admin")return e.jsx("div",{className:"min-h-screen bg-[#0a0a14] flex items-center justify-center pb-nav",children:e.jsx("p",{className:"text-white/50",children:"Accesso negato"})});const M=B?.proxies??[],L=B?.total??0,j=Math.ceil(L/20);return e.jsxs("div",{className:"min-h-screen bg-[#0a0a14] text-white",children:[e.jsx("div",{className:"border-b border-white/5 bg-[#161A1E] backdrop-blur-sm sticky top-0 z-10",children:e.jsxs("div",{className:"container py-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{href:"/admin",children:e.jsxs(r,{variant:"ghost",size:"sm",className:"text-white/60 hover:text-white gap-1.5",children:[e.jsx(he,{className:"w-4 h-4"}),"Admin"]})}),e.jsx("div",{className:"w-px h-5 bg-[#0f1117]/10"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:"w-5 h-5 text-[#5BBAC5]"}),e.jsx("h1",{className:"font-['Nunito'] font-bold text-lg",children:"Gestione Proxy"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>Q.mutate(),disabled:T,className:"border-white/10 text-white/70 hover:text-white gap-1.5",children:[T?e.jsx(p,{className:"w-4 h-4 animate-spin"}):e.jsx(me,{className:"w-4 h-4"}),"Health Check Tutti"]}),e.jsxs(W,{open:U,onOpenChange:y,children:[e.jsx(Y,{asChild:!0,children:e.jsxs(r,{size:"sm",className:"bg-[#2F7F88] hover:bg-[#2F7F88] gap-1.5",children:[e.jsx(Z,{className:"w-4 h-4"}),"Aggiungi Proxy"]})}),e.jsxs(ee,{className:"bg-[#0f1117] border-white/10 text-white",children:[e.jsx(te,{children:e.jsx(se,{className:"font-['Nunito']",children:"Aggiungi Proxy"})}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-white/60 mb-1.5 block",children:"URL Proxy *"}),e.jsx(I,{placeholder:"http://user:pass@host:port",value:N,onChange:t=>C(t.target.value),className:"bg-[#0f1117]/5 border-white/10 text-white placeholder:text-white/30"}),e.jsx("p",{className:"text-xs text-white/30 mt-1",children:"Formati supportati: http://, https://, socks4://, socks5://"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-white/60 mb-1.5 block",children:"Etichetta (opzionale)"}),e.jsx(I,{placeholder:"es. BrightData IT, Proxy residenziale...",value:k,onChange:t=>A(t.target.value),className:"bg-[#0f1117]/5 border-white/10 text-white placeholder:text-white/30"})]}),e.jsxs(r,{className:"w-full bg-[#2F7F88] hover:bg-[#2F7F88]",onClick:()=>g.mutate({url:N,label:k||void 0}),disabled:!N||g.isPending,children:[g.isPending?e.jsx(p,{className:"w-4 h-4 animate-spin mr-2"}):null,"Aggiungi"]})]})]})]})]})]})}),e.jsxs("div",{className:"container py-8 space-y-6",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Totale",value:u?.total??0,icon:ae,color:"text-white/70"},{label:"Attivi",value:u?.active??0,icon:ie,color:"text-emerald-400"},{label:"Inattivi",value:u?.inactive??0,icon:le,color:"text-[#C28B2C]"},{label:"Bannati",value:u?.banned??0,icon:ue,color:"text-red-400"}].map(({label:t,value:h,icon:_,color:F})=>e.jsx(b,{className:"bg-[#0f1117] border-white/5",children:e.jsxs(v,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl bg-[#0f1117]/5 flex items-center justify-center ${F}`,children:e.jsx(_,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:`font-['Nunito'] font-bold text-xl ${F}`,children:h}),e.jsx("div",{className:"text-xs text-white/40",children:t})]})]})},t))}),e.jsxs(b,{className:"bg-[#161A1E] border-white/5",children:[e.jsx(R,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs($,{className:"font-['Nunito'] text-base",children:["Pool Proxy (",L,")"]}),e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>q(),className:"text-white/40 hover:text-white",children:e.jsx(je,{className:"w-4 h-4"})})]})}),e.jsx(v,{className:"p-0",children:D?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(p,{className:"w-6 h-6 animate-spin text-[#5BBAC5]"})}):M.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx(E,{className:"w-12 h-12 text-white/10 mx-auto mb-3"}),e.jsx("p",{className:"text-white/40 font-['Nunito']",children:"Nessun proxy configurato"}),e.jsx("p",{className:"text-sm text-white/20 mt-1",children:"Aggiungi proxy per distribuire le richieste di scraping"})]}
6):e.jsxs(Ne,{children:[e.jsx(ge,{children:e.jsxs(H,{className:"border-white/5 hover:bg-transparent",children:[e.jsx(c,{className:"text-white/40 font-['Nunito'] text-xs",children:"Proxy"}),e.jsx(c,{className:"text-white/40 font-['Nunito'] text-xs",children:"Protocollo"}),e.jsx(c,{className:"text-white/40 font-['Nunito'] text-xs",children:"Stato"}),e.jsx(c,{className:"text-white/40 font-['Nunito'] text-xs",children:"Successi / Errori"}),e.jsx(c,{className:"text-white/40 font-['Nunito'] text-xs",children:"Latenza"}),e.jsx(c,{className:"text-white/40 font-['Nunito'] text-xs",children:"Ultimo test"}),e.jsx(c,{className:"text-white/40 font-['Nunito'] text-xs text-right",children:"Azioni"})]})}),e.jsx(be,{children:M.map(t=>e.jsxs(H,{className:"border-white/5 hover:bg-[#0f1117]/2",children:[e.jsx(o,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-['Nunito'] text-sm text-white font-medium",children:t.label||`${t.host}:${t.port}`}),e.jsxs("div",{className:"text-xs text-white/30 font-mono mt-0.5",children:[t.host,":",t.port,t.username&&e.jsx("span",{className:"ml-1 text-white/20",children:"(auth)"})]})]})}),e.jsx(o,{children:e.jsx(ne,{variant:"outline",className:"border-white/10 text-white/50 text-xs uppercase",children:t.protocol})}),e.jsx(o,{children:e.jsxs(ce,{value:t.status,onValueChange:h=>V.mutate({id:t.id,status:h}),children:[e.jsx(oe,{className:"w-28 h-7 bg-transparent border-white/10 text-xs",children:e.jsx(de,{})}),e.jsxs(xe,{className:"bg-[#1F2328] border-white/10",children:[e.jsx(w,{value:"active",className:"text-emerald-400 text-xs",children:"Attivo"}),e.jsx(w,{value:"inactive",className:"text-[#C28B2C] text-xs",children:"Inattivo"}),e.jsx(w,{value:"banned",className:"text-red-400 text-xs",children:"Bannato"})]})]})}),e.jsx(o,{children:e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("span",{className:"text-emerald-400",children:[t.successRequests??0," ✓"]}),e.jsxs("span",{className:"text-red-400",children:[t.failedRequests??0," ✗"]})]})}),e.jsx(o,{children:t.avgLatencyMs?e.jsxs("span",{className:`text-xs font-mono ${t.avgLatencyMs<1e3?"text-emerald-400":t.avgLatencyMs<3e3?"text-[#C28B2C]":"text-red-400"}`,children:[t.avgLatencyMs,"ms"]}):e.jsx("span",{className:"text-xs text-white/20",children:"—"})}),e.jsx(o,{children:e.jsx("span",{className:"text-xs text-white/30",children:t.lastCheckedAt?new Date(t.lastCheckedAt).toLocaleString("it-IT",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"})}),e.jsx(o,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>G.mutate({id:t.id}),disabled:P===t.id,className:"h-7 w-7 p-0 text-white/40 hover:text-[#5BBAC5]",title:"Testa proxy",children:P===t.id?e.jsx(p,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(pe,{className:"w-3.5 h-3.5"})}),e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>{confirm(`Rimuovere il proxy ${t.host}:${t.port}?`)&&O.mutate({id:t.id})},className:"h-7 w-7 p-0 text-white/40 hover:text-red-400",title:"Rimuovi proxy",children:e.jsx(re,{className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})]}),j>1&&e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(r,{variant:"outline",size:"sm",onClick:()=>f(t=>Math.max(1,t-1)),disabled:m===1,className:"border-white/10 text-white/60",children:"Precedente"}),e.jsxs("span",{className:"text-sm text-white/40",children:[m," / ",j]}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>f(t=>Math.min(j,t+1)),disabled:m===j,className:"border-white/10 text-white/60",children:"Successiva"})]}),e.jsxs(b,{className:"bg-[#161A1E] border-white/5",children:[e.jsx(R,{children:e.jsx($,{className:"font-['Nunito'] text-sm text-white/60",children:"Come usare i proxy"})}),e.jsxs(v,{className:"space-y-3 text-sm text-white/40 font-['Nunito']",children:[e.jsx("p",{children:"I proxy vengono usati automaticamente dal crawler per distribuire le richieste su IP diversi e ridurre il rischio di ban da parte dei siti target."}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 mt-4",children:[{title:"Formato URL",desc:"http://user:pass@host:port oppure socks5://host:port"},{title:"Rotazione automatica",desc:"Il sistema usa round-robin tra i proxy attivi, con fallback automatico in caso di errore"},{title:"Health check",desc:'Usa "Health Check Tutti" per verificare lo stato di tutti i proxy e aggiornare le statistiche'}
6].map(({title:t,desc:h})=>e.jsxs("div",{className:"bg-[#0f1117]/3 rounded-xl p-3",children:[e.jsx("div",{className:"font-['Nunito'] font-semibold text-white/60 text-xs mb-1",children:t}),e.jsx("div",{className:"text-xs text-white/30",children:h})]},t))})]})]})]})]})}export{ze 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.