PageSourceSearch

https://gg.givingcompass.org/_nuxt/C3cEnwdj.js

js givingcompass.org collected 2026-09-24 09:19:18 UTC 10,841 bytes, 1 lines download raw bytes

1import{B as a,r as e,c as l,x as t,aG as o,ay as r,aw as s,R as n,av as i,aH as u,$ as d,C as c,az as m,S as p,U as v,aq as f,aL as y,i as h,ax as b}from"./nX7w3--X.js";import{P as g}from"./CrK_MUeO.js";import{u as _,r as k,e as w,V as x,_ as C}from"#entry";import{u as j}from"./inpFMjNm.js";import{V as S}from"./B9goy8s8.js";import{V as q}from"./CnLvr--j.js";import{V as P}from"./369w539r.js";import{V}from"./BWNBbf6k.js";import{V as I}from"./Bpq7MrYI.js";import{V as z}from"./Ch9sftxZ.js";import{V as Q,a as T,b as L,c as R}from"./BWrehKB2.js";import{V as U}from"./CVi8ooJQ.js";import{V as $}from"./BzdmcfQK.js";import"./CzuCJjyz.js";import"./CNAuE06t.js";import"./C-u_YpPl.js";import"./CtG27aky.js";import"./CzdGDBjF.js";import"./DeYW9Fiz.js";import"./Bs0o2c6W.js";import"./egkXgMqP.js";import"./CFQTgrnx.js";import"./Boy9wtnx.js";const A={async lookupTrialQuotas(a){try{const{data:e,error:l}=await _("/quota/admin/trial",{params:{ip:a}});return l.value?(console.error("Quota admin lookup error:",l.value),{data:null,error:l.value}):{data:e.value,error:null}}catch(e){return console.error("Quota admin lookup exception:",e),{data:null,error:e}}},async getStandardPool(){try{const{data:a,error:e}=await _("/quota/admin/trial/pool");return e.value?(console.error("Standard pool lookup error:",e.value),{data:null,error:e.value}):{data:a.value,error:null}}catch(a){return console.error("Standard pool lookup exception:",a),{data:null,error:a}}},async clearStandardPool(){try{const{error:a}=await _("/quota/admin/trial/pool/clear",{method:"POST"});return a.value?(console.error("Standard pool clear error:",a.value),{error:a.value}):{error:null}}catch(a){return console.error("Standard pool clear exception:",a),{error:a}}},async clearQuota(a,e){try{const{error:l}=await _("/quota/admin/trial/clear",{method:"POST",body:{ip:a,quota_type:e}});return l.value?(console.error("Quota admin clear error:",l.value),{error:l.value}):{error:null}}catch(l){return console.error("Quota admin clear exception:",l),{error:l}}}},D={class:"page-top"},G={class:"page-intro"},F={class:"intro-actions"},O={class:"pool-section"},E={class:"num-col"},N={class:"num-col"},B={class:"num-col"},H={class:"num-col"},K={class:"date-cell"},M={key:1,colspan:"5",class:"empty-cell"},W={class:"actions-col"},Y={class:"search-row"},J={key:0,class:"result-section"},X={class:"result-heading"},Z={class:"ip-code"},aa={class:"num-col"},ea={key:0},la={key:1,class:"empty-cell"},ta={class:"num-col"},oa={class:"num-col"},ra={class:"date-cell"},sa={class:"actions-col"},na={key:1,class:"empty-state"},ia={class:"modal-title"},ua=C(a({__name:"trial-quotas",setup(a){const{setSEO:_}=j();_({title:"Admin - Trial Quotas",description:"Inspect and clear IP-keyed trial/abuse quotas.",noIndex:!0});const C=A,ua=k(),da=e(""),ca=e(null),ma=e(!1),pa=e(null),va=e(null),fa=e(null),ya=l((()=>da.value.trim())),ha=l((()=>!ya.value||ma.value)),ba=e(null),ga=e(!1),_a=e(!1),ka=e(!1);async function wa(){ga.value=!0;const{data:a}=await C.getStandardPool();ga.value=!1,ba.value=a}async function xa(){_a.value=!0;const{error:a}=await C.clearStandardPool();_a.value=!1,ka.value=!1,a?ua.showSnackbar({message:"Failed to clear the standard pool. Please try again.",color:"error",timeout:4e3}):(ua.showSnackbar({message:"Cleared the global standard pool.",color:"success",timeout:3e3}),await wa())}t(wa);const Ca=l((()=>{const a=ca.value;return!!a&&!a.trial.has_record&&!a.abuse.has_record}));async function ja(){if(ha.value)return;const a=ya.value;ma.value=!0,pa.value=null;const{data:e,error:l}=await C.lookupTrialQuotas(a);if(ma.value=!1,l)return ca.value=null,void(pa.value=l?.data?.detail||l?.message||"Failed to look up quotas.");ca.value=e}async function Sa(){ca.value&&(da.value=ca.value.ip,await ja())}function qa(){va.value=null}async function Pa(){if(!va.value||!ca.value)return;const a=va.value,e=ca.value.ip;fa.value=a;const{error:l}=await C.clearQuota(e,a);fa.value=null,va.value=null,l?ua.showSnackbar({message:`Failed to clear ${a} quota. Please try again.`,color:"error",timeout:4e3}):(ua.showSnackbar({message:`Cleared ${a} quota for ${e}.`,color:"success",timeout:3e3}),await ja())}const Va=l((()=>{const a=ca.value;return a?[{type:"trial",label:"Trial",info:a.trial},{type:"abuse",label:"Abuse",info:a.abuse}]:[]}));
1function Ia(a){try{return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}catch{return a}}const za=l((()=>{const a=va.value;return a?{title:`Clear ${a} quota`,body:`This will delete the current ${a}-quota bucket for IP ${ca.value?.ip??""}. The bucket will refill from zero on the next request.`}:{title:"",body:""}}));return(a,e)=>(s(),o(g,{title:"Admin - Trial Quotas",subtitle:"Inspect and clear IP-keyed trial/abuse quotas."},{default:r((()=>[n("div",D,[n("div",G,[e[7]||(e[7]=n("p",{class:"intro-text"}," Look up an IP to see its current trial and abuse counters. Clearing a bucket lets you resume testing without waiting for the calendar rollover. ",-1)),n("div",F,[d(w,{icon:"",variant:"text",size:"small",color:"grey",loading:c(ma),disabled:!c(ca),onClick:Sa},{default:r((()=>[d(x,{icon:"mdi-refresh",size:"20"}),d(S,{activator:"parent",location:"top"},{default:r((()=>[...e[6]||(e[6]=[m("Refresh",-1)])])),_:1})])),_:1},8,["loading","disabled"])])]),n("div",O,[e[11]||(e[11]=n("h3",{class:"result-heading"},"Global pools",-1)),d(q,{density:"comfortable",class:"quota-table"},{default:r((()=>[e[10]||(e[10]=n("thead",null,[n("tr",null,[n("th",null,"Pool"),n("th",{class:"num-col"},"Used"),n("th",{class:"num-col"},"Limit"),n("th",{class:"num-col"},"Remaining"),n("th",{class:"num-col"},"Downgraded today"),n("th",null,"Resets at"),n("th",{class:"actions-col"},"Actions")])],-1)),n("tbody",null,[n("tr",{class:p({"quota-row--empty":c(ba)&&!c(ba).has_record})},[n("td",null,[d(P,{size:"small",variant:"tonal",color:"success"},{default:r((()=>[...e[8]||(e[8]=[m(" Standard (anonymous) ",-1)])])),_:1})]),c(ba)?(s(),i(v,{key:0},[n("td",E,f(c(ba).used),1),n("td",N,f(c(ba).limit),1),n("td",B,f(c(ba).remaining),1),n("td",H,f(c(ba).denied_today),1),n("td",K,f(Ia(c(ba).resets_at)),1)],64)):(s(),i("td",M,f(c(ga)?"Loading…":"Could not load pool state."),1)),n("td",W,[d(w,{variant:"text",size:"small",color:"error",class:"text-none",loading:c(_a),disabled:c(_a)||!c(ba)?.has_record,onClick:e[0]||(e[0]=a=>ka.value=!0)},{default:r((()=>[d(x,{icon:"mdi-delete-outline",size:"18",start:""}),e[9]||(e[9]=m(" Clear ",-1))])),_:1},8,["loading","disabled"])])],2)])])),_:1}),e[12]||(e[12]=n("p",{class:"pool-note"},' Daily site-wide budget of anonymous chat runs served on the Standard reasoning depth. When drained, guest submissions are silently served on Lite until the next UTC day. "Downgraded today" counts those runs. ',-1))]),n("div",Y,[d(V,{modelValue:c(da),"onUpdate:modelValue":e[1]||(e[1]=a=>h(da)?da.value=a:null),label:"IP address",placeholder:"e.g. 73.158.42.10",variant:"outlined",density:"comfortable","hide-details":"",class:"search-input",onKeyup:y(ja,["enter"])},null,8,["modelValue"]),d(w,{color:"primary",variant:"flat",size:"large",class:"text-none",loading:c(ma),disabled:c(ha),onClick:ja},{default:r((()=>[...e[13]||(e[13]=[m(" Look up ",-1)])])),_:1},8,["loading","disabled"])]),c(pa)?(s(),o(I,{key:0,type:"error",variant:"tonal",density:"compact",class:"mt-4",closable:"","onClick:close":e[2]||(e[2]=a=>pa.value=null)},{default:r((()=>[m(f(c(pa)),1)])),_:1})):u("",!0)]),c(ca)?(s(),i("div",J,[n("h3",X,[e[14]||(e[14]=m(" Results for ",-1)),n("code",Z,f(c(ca).ip),1)]),c(Ca)?(s(),o(I,{key:0,type:"info",variant:"tonal",density:"compact",class:"mb-4"},{default:r((()=>[...e[15]||(e[15]=[m(" No recorded activity for this IP. Could be a typo, an IP that hasn't visited the trial site, or one whose buckets were already cleared. ",-1)])])),_:1})):u("",!0),d(q,{density:"comfortable",class:"quota-table"},{default:r((()=>[e[17]||(e[17]=n("thead",null,[n("tr",null,[n("th",null,"Quota"),n("th",{class:"num-col"},"Used"),n("th",{class:"num-col"},"Limit"),n("th",{class:"num-col"},"Remaining"),n("th",null,"Resets at"),n("th",{class:"actions-col"},"Actions")])],-1)),n("tbody",null,[(s(!0),i(v,null,b(c(Va),(a=>(s(),i("tr",{key:a.type,class:p({"quota-row--empty":!a.info.has_record})},[n("td",null,[d(P,{size:"small",variant:"tonal",color:"trial"===a.type?"primary":"warning"},{default:r((()=>[m(f(a.label),1)])),_:2},1032,["color"])]),n("td",aa,[a.info.has_record?(s(),i("span",ea,f(a.info.used),1)):(s(),i("span",la,"—"))]),n("td",ta,f(a.info.limit),1),n("td",oa,f(a.info.remaining),1),n("td",ra,f(Ia(a.info.resets_at)),1),n("td",sa,[d(w,{variant:"text",size:"small",color:"error",class:"text-none",loading:c(fa)===a.type,disabled:null!==c(fa)||!a.info.has_record,onClick:e=>{return l=a.type,void(va.value=l);var l}},{default:r((()=>[d(x,{icon:"mdi-delete-outline",size:"18",start:""}
1),e[16]||(e[16]=m(" Clear ",-1))])),_:1},8,["loading","disabled","onClick"])])],2)))),128))])])),_:1})])):c(pa)||c(ma)?u("",!0):(s(),i("div",na,[d(x,{icon:"mdi-counter",size:"64",color:"grey"}),e[18]||(e[18]=n("h3",null,"No IP looked up yet",-1)),e[19]||(e[19]=n("p",null,"Enter an IP address above to see its current quotas.",-1))])),d(z,{modelValue:c(ka),"onUpdate:modelValue":e[4]||(e[4]=a=>h(ka)?ka.value=a:null),"max-width":"440"},{default:r((()=>[d(Q,{rounded:"xl"},{default:r((()=>[d(T,{class:"modal-header"},{default:r((()=>[...e[20]||(e[20]=[n("span",{class:"modal-title"},"Clear the global standard pool",-1)])])),_:1}),d(U),d(L,{class:"pa-6"},{default:r((()=>[...e[21]||(e[21]=[n("p",null," This will delete today's site-wide standard-pool counter. Guest submissions immediately regain Standard until the pool fills again. ",-1)])])),_:1}),d(U),d(R,{class:"modal-actions"},{default:r((()=>[d($),d(w,{variant:"text",class:"text-none",onClick:e[3]||(e[3]=a=>ka.value=!1)},{default:r((()=>[...e[22]||(e[22]=[m(" Cancel ",-1)])])),_:1}),d(w,{color:"error",variant:"flat",class:"text-none",loading:c(_a),onClick:xa},{default:r((()=>[...e[23]||(e[23]=[m(" Clear ",-1)])])),_:1},8,["loading"])])),_:1})])),_:1})])),_:1},8,["modelValue"]),d(z,{"model-value":null!==c(va),"max-width":"440","onUpdate:modelValue":e[5]||(e[5]=a=>{a||qa()})},{default:r((()=>[d(Q,{rounded:"xl"},{default:r((()=>[d(T,{class:"modal-header"},{default:r((()=>[n("span",ia,f(c(za).title),1)])),_:1}),d(U),d(L,{class:"pa-6"},{default:r((()=>[n("p",null,f(c(za).body),1)])),_:1}),d(U),d(R,{class:"modal-actions"},{default:r((()=>[d($),d(w,{variant:"text",class:"text-none",onClick:qa},{default:r((()=>[...e[24]||(e[24]=[m(" Cancel ",-1)])])),_:1}),d(w,{color:"error",variant:"flat",class:"text-none",loading:null!==c(fa),onClick:Pa},{default:r((()=>[...e[25]||(e[25]=[m(" Clear ",-1)])])),_:1},8,["loading"])])),_:1})])),_:1})])),_:1},8,["model-value"])])),_:1}))}}),[["__scopeId","data-v-bf297a35"]]);export{ua 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.