PageSourceSearch

https://unmomento.net/assets/DmcaAudits-Bs62sZp1.js

js unmomento.net collected 2026-10-07 04:16:45 UTC 6,085 bytes, 1 lines download raw bytes

1import{F as w,h as i,m as b,l as e,w as f,L as A}from"./index-CW929O71.js";import{A as _}from"./arrow-left-BP7uAe4L.js";import{C as N}from"./clipboard-check-HjhrNh9B.js";import{R as C}from"./refresh-cw-C9FT9UiI.js";const j={A:"border-emerald-600/30 bg-emerald-600/10 text-emerald-700 dark:text-emerald-400",B:"border-emerald-600/30 bg-emerald-600/10 text-emerald-700 dark:text-emerald-400",C:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-400",D:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-400",F:"border-destructive/30 bg-destructive/10 text-destructive"},S={pass:"text-emerald-700 dark:text-emerald-400",warn:"text-amber-700 dark:text-amber-400",fail:"text-destructive"},L=n=>{if(!n)return"—";try{return new Date(n).toLocaleString([],{dateStyle:"medium",timeStyle:"short"})}catch{return n}};function T(){const n=w(),[d,u]=i.useState(null),[c,h]=i.useState(!1),[m,l]=i.useState(""),[g,p]=i.useState(""),x=i.useCallback(async()=>{l("");try{const t=await b.entities.DmcaAuditReport.list("-created_date",60);u(Array.isArray(t)?t:[])}catch(t){l((t==null?void 0:t.message)||"Could not load the audits."),u(s=>s??[])}},[]);if(i.useEffect(()=>{n===!0&&x()},[n,x]),n===!1)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("p",{className:"text-sm text-foreground/50",children:"Admins only."})});const y=async()=>{var t,s,o;h(!0),l(""),p("");try{const a=await b.functions.invoke("dmcaAudit",{force:!0}),r=(a==null?void 0:a.data)??a;if(r!=null&&r.error)throw new Error(r.error);p(`Audit finished — grade ${r.grade} (${r.score}/100), ${r.failed} failed check(s), ${r.findings} content item(s) flagged for review.`),await x()}catch(a){l(((s=(t=a==null?void 0:a.response)==null?void 0:t.data)==null?void 0:s.error)||((o=a==null?void 0:a.data)==null?void 0:o.error)||(a==null?void 0:a.message)||"The audit could not be run.")}finally{h(!1)}},k="min-h-11 inline-flex items-center gap-2 rounded-full bg-primary px-5 py-2.5 text-xs font-bold text-primary-foreground transition-all hover:brightness-110 disabled:opacity-50",v="rounded-2xl border border-border bg-card p-5 mb-4";return e.jsx("div",{className:"min-h-screen bg-background pb-24",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 pt-6",children:[e.jsxs(f,{to:"/",className:"inline-flex items-center gap-1.5 text-xs font-bold text-foreground/50 hover:text-foreground mb-4",children:[e.jsx(_,{size:14})," Back to site"]}),e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx(N,{className:"text-primary",size:22}),e.jsx("h1",{className:"text-2xl font-black text-foreground",children:"DMCA audits"})]}),e.jsxs("p",{className:"text-sm text-foreground/50 mb-6 max-w-[62ch]",children:["A weekly check that the DMCA machinery is in place — the designated agent published and matching the registered record, the policy and reporting pages published, no notice past its deadline — plus an advisory scan of recently added content. Nothing is removed by an audit."," ",e.jsx(f,{to:"/admin/dmca",className:"underline underline-offset-2 hover:text-foreground",children:"Open the inbox"}),"."]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-5",children:[e.jsxs("button",{type:"button",onClick:y,disabled:c,className:k,children:[c?e.jsx(C,{size:14,className:"animate-spin"}):e.jsx(N,{size:14}),c?"Auditing…":"Run audit now"]}),g&&e.jsx("span",{className:"text-xs text-primary",role:"status","aria-live":"polite",children:g})]}),m&&e.jsx("p",{className:"text-sm text-amber-600 mb-4",role:"alert",children:m}),d===null&&!m&&e.jsx("p",{className:"text-sm text-foreground/40",children:"Loading audits…"}),d!==null&&d.length===0&&e.jsx("p",{className:"text-sm text-foreground/50",children:"No audit has run yet. The first one runs on the weekly schedule."}),d==null?void 0:d.map(t=>e.jsxs("div",{className:v,"data-qa-private":!0,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsxs("span",{className:`rounded-full border px-3 py-0.5 text-xs font-black ${j[t.grade]||j.C}`,children:[t.grade," · ",t.score,"/100"]}
1),e.jsxs("span",{className:"text-xs text-foreground/50",children:[t.trigger==="manual"?`Run by ${t.run_by||"an admin"}`:"Weekly run"," · ",L(t.run_at)]})]}),e.jsx("ul",{className:"mt-2 space-y-1",children:(t.checks||[]).map(s=>e.jsxs("li",{className:"text-[13px] leading-relaxed",children:[e.jsx("span",{className:`font-bold ${S[s.status]||""}`,children:s.status==="pass"?"PASS":s.status==="warn"?"WARN":"FAIL"})," ",e.jsx("span",{className:"text-foreground",children:s.label}),e.jsxs("span",{className:"text-foreground/50",children:[" — ",s.detail]})]},s.id))}),t.ai_review&&e.jsxs("div",{className:"mt-3 rounded-lg border border-border bg-background px-3.5 py-3",children:[e.jsx("p",{className:"text-[11px] font-black uppercase tracking-wider text-foreground/40 mb-1",children:"The model's read — advisory"}),e.jsx("p",{className:"text-[13px] leading-relaxed text-foreground/80 whitespace-pre-wrap",children:t.ai_review})]}),(t.content_findings||[]).length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("p",{className:"text-[11px] font-black uppercase tracking-wider text-foreground/40 mb-1",children:["Flagged for a person to look at (",t.content_findings.length,")"]}),t.content_findings.map((s,o)=>e.jsxs("p",{className:"text-[13px] leading-relaxed text-foreground/80",children:[e.jsx("span",{className:"font-bold text-foreground",children:s.title||s.content_id})," · ",s.severity," — ",s.reason,s.recommendation?` (${s.recommendation})`:""]},o)),e.jsx("p",{className:"text-[12px] text-foreground/40 mt-1",children:"Nothing was removed. Review it in the inbox."})]}),e.jsxs("p",{className:"mt-3 text-[12px] text-foreground/40",children:[t.content_scanned," recent record(s) reviewed · ",t.content_skipped," sample record(s) skipped ·"," ",t.open_notices," open notice(s) · ",t.overdue_notices," past 48 hours",t.emailed?" · summary emailed to the agent":""]})]},t.id)),e.jsx(A,{className:"mt-14 pb-10"})]})})}export{T 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.