PageSourceSearch

https://wereldkundig.lovable.app/assets/DnsGids-wvd6liu2.js

js wereldkundig.lovable.app collected 2026-10-03 03:46:48 UTC 16,228 bytes, 6 lines download raw bytes

1import{c as Ne,r as n,j as e,a as we,L as be,M as D,W as ye,e as t}from"./index-B82HvaAM.js";import{H as Ce,B as l}from"./Header-L2QgqdaV.js";import{F as Se}from"./Footer-BWOnZv4a.js";import{I as d}from"./input-nzaEMCEV.js";import{L as c}from"./label-BTahKWN_.js";import{s as m}from"./client-i0ubu7x8.js";import{L as Le}from"./lock-C4MYrLL8.js";import{E as ie}from"./eye-DRaC0X-Y.js";import{C as _}from"./copy-B7j9gQWU.js";import{T as De}from"./trash-2-BQJ75Yw7.js";import"./logo-wereldkundig-BV1ZJ4Kj.js";/**
2 * @license lucide-react v0.462.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 _e=Ne("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),N="[email protected]",le=h=>{let i=h.trim().toLowerCase();return i=i.replace(/^https?:\/\//,""),i=i.replace(/^(www|nieuws)\./,""),i=i.split("/")[0],i.split("?")[0]},$=h=>{const i=new Date(h);return`${i.toLocaleDateString("nl-NL",{day:"numeric",month:"long",year:"numeric"})} om ${i.toLocaleTimeString("nl-NL",{hour:"2-digit",minute:"2-digit"})}`},Te=()=>{const[h,i]=n.useState(!0),[oe,w]=n.useState(!1),[z,E]=n.useState([]),[de,ce]=n.useState([]),[I,me]=n.useState(""),[F,ue]=n.useState(""),[g,A]=n.useState(""),[P,M]=n.useState(!1),[V,B]=n.useState(""),[W,T]=n.useState(""),[K,H]=n.useState(""),[q,O]=n.useState(!1),[u,R]=n.useState(""),[x,U]=n.useState(N),[f,G]=n.useState(""),[b,J]=n.useState(!1),[xe,y]=n.useState(!1),[C,he]=n.useState(""),[Z,Q]=n.useState(null),[j,X]=n.useState(""),[v,Y]=n.useState(N),[ee,ae]=n.useState(!1),k=le(W),se=/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(k),o=q?le(K).replace(/^nieuws\./,"nieuws."):se?`nieuws.${k}`:"",p=n.useCallback(async()=>{const{data:a}=await m.from("dns_shares").select("*").order("created_at",{ascending:!1});E(a||[]);const{data:s}=await m.from("dns_share_mails").select("*").order("sent_at",{ascending:!0});ce(s||[])},[]),S=n.useCallback(async()=>{const{data:a}=await m.auth.getSession();if(a.session){const{data:s}=await m.from("user_roles").select("role").eq("user_id",a.session.user.id).eq("role","admin").maybeSingle();s?(w(!0),await p()):w(!1)}i(!1)},[p]);n.useEffect(()=>{S()},[S]);const pe=async a=>{a.preventDefault(),A(""),M(!0);const{error:s}=await m.auth.signInWithPassword({email:I.trim(),password:F});if(M(!1),s){A("Inloggen is mislukt. Controleer je e-mailadres en wachtwoord.");return}i(!0),await S()},ge=async()=>{await m.auth.signOut(),w(!1),E([])},ne=a=>`https://wereldkundig.nl/dns/${a}`,L=async(a,s)=>{try{await navigator.clipboard.writeText(a),t.success(`${s} gekopieerd`)}catch{t.error("Kopiëren lukt niet in deze browser")}},te=(a=!1)=>{const s=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;return se?!o||!/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(o)?(t.error("Vul een geldig adres voor de pagina voor aanmelding en archief-nieuwsbrieven in"),!1):a&&!s.test(u.trim())?(t.error("Vul het e-mailadres van de klant in"),!1):!a&&u.trim()&&!s.test(u.trim())?(t.error("Het e-mailadres van de klant is niet geldig"),!1):x.trim()&&!s.test(x.trim())?(t.error("Het kopie-adres is niet geldig"),!1):f.trim().length<4?(t.error("Vul een wachtwoord van minimaal 4 tekens in"),!1):!0:(t.error("Vul een geldige domeinnaam in"),!1)},fe=()=>{te()&&y(!0)},re=async a=>{if(!te(a))return;J(!0);const{data:s,error:r}=await m.functions.invoke("dns-share",{body:{action:"create",domain:k,subdomain:o,recipientEmail:u.trim(),ccEmail:x.trim(),clientName:V.trim(),password:f.trim(),sendMail:a}});if(J(!1),r||!(s!=null&&s.ok)){t.error(a?"Versturen is mislukt. Probeer het opnieuw.":"Aanmaken is mislukt. Probeer het opnieuw.");return}s.mailed?t.success(`Mail verstuurd naar ${u.trim()}`):a?t.success("Pagina aangemaakt. De mail kon niet worden verstuurd; deel de link handmatig."):t.success("Link aangemaakt. Je kunt hem nu zelf delen."),he(s.link||""),B(""),T(""),H(""),O(!1),R(""),U(N),G(""),y(!1),await p()},je=async a=>{const{error:s}=await m.from("dns_shares").delete().eq("id",a);if(s){t.error("Verwijderen mislukt");return}t.success("Verwijderd"),await p()},ve=async a=>{const s=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;
6if(!s.test(j.trim())){t.error("Vul het e-mailadres van de klant in");return}if(v.trim()&&!s.test(v.trim())){t.error("Het kopie-adres is niet geldig");return}ae(!0);const{data:r,error:ke}=await m.functions.invoke("dns-share",{body:{action:"send",token:a.token,recipientEmail:j.trim(),ccEmail:v.trim()}});if(ae(!1),ke||!(r!=null&&r.ok)){t.error("Versturen is mislukt. Probeer het opnieuw.");return}r.mailed?(t.success(`Mail verstuurd naar ${j.trim()}`),Q(null)):t.error("De mail kon niet worden verstuurd. Probeer het opnieuw."),await p()};return e.jsxs(e.Fragment,{children:[e.jsxs(we,{children:[e.jsx("title",{children:"DNS-gegevens versturen (beheer) - Wereldkundig"}),e.jsx("meta",{name:"description",content:"Beheer van DNS-pagina's voor klanten."}),e.jsx("meta",{name:"robots",content:"noindex, nofollow, noarchive, nosnippet, noimageindex"}),e.jsx("meta",{name:"googlebot",content:"noindex, nofollow, noarchive"}),e.jsx("meta",{name:"referrer",content:"no-referrer"})]}),e.jsx(Ce,{}),e.jsx("main",{className:"pt-32 pb-20 bg-background min-h-screen",children:e.jsxs("div",{className:"container mx-auto px-6 max-w-4xl",children:[e.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-foreground mb-6",children:"DNS-gegevens"}),h?e.jsx("p",{className:"text-muted-foreground",children:"Laden..."}):oe?e.jsxs("div",{className:"space-y-12",children:[e.jsx("div",{children:e.jsx(l,{variant:"outline",size:"sm",className:"rounded-full",onClick:ge,children:"Uitloggen"})}),e.jsxs("section",{className:"bg-card border border-border rounded-2xl p-6 space-y-4",children:[e.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"DNS-gegevens klaarzetten en mailen"}),e.jsx("p",{className:"text-muted-foreground",children:"Jij bepaalt de domeinnaam en het adres van de pagina voor aanmelding en archief-nieuwsbrieven. De klant krijgt een mail met een eigen pagina waarop de records staan om te kopiëren."}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"dns-client",children:"Klantnaam (optioneel)"}),e.jsx(d,{id:"dns-client",autoComplete:"off",spellCheck:!1,value:V,onChange:a=>B(a.target.value),className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"dns-domain",children:"Domeinnaam van de klant"}),e.jsx(d,{id:"dns-domain",autoComplete:"off",spellCheck:!1,placeholder:"natuurlijkedeo.nl",value:W,onChange:a=>T(a.target.value),className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"dns-subdomain",children:"Adres van de pagina voor aanmelding en archief-nieuwsbrieven"}),e.jsx(d,{id:"dns-subdomain",autoComplete:"off",spellCheck:!1,placeholder:"nieuws.natuurlijkedeo.nl",value:q?K:o,onChange:a=>{O(!0),H(a.target.value)},className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"dns-recipient",children:"E-mailadres van de klant (leeg laten als je alleen een link maakt)"}),e.jsx(d,{id:"dns-recipient",type:"email",autoComplete:"off",value:u,onChange:a=>R(a.target.value),className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"dns-cc",children:"Kopie naar"}),e.jsx(d,{id:"dns-cc",type:"email",autoComplete:"off",value:x,onChange:a=>U(a.target.value),className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"dns-pagepw",children:"Wachtwoord voor de pagina"}),e.jsx(d,{id:"dns-pagepw",type:"text",autoComplete:"off",spellCheck:!1,maxLength:60,placeholder:"minimaal 4 tekens",value:f,onChange:a=>G(a.target.value),className:"mt-2 max-w-[16rem]"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Dit wachtwoord wordt in de mail meegestuurd."})]})]}),xe?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border border-border rounded-2xl p-5 bg-background space-y-4",children:[e.jsx("p",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:"Zo ziet de klant de pagina"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Adres van de pagina voor aanmelding en archief-nieuwsbrieven"}),e.jsx("p",{className:"font-mono text-lg text-primary break-all",children:o}),e.jsx("p",{className:"text-muted-foreground mt-3",children:"Domeinnaam"}),e.jsx("p",{className:"font-mono text-muted-foreground break-all",children:k})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-1",children:[e.jsx("span",{className:"font-semibold text-foreground w-20",children:"Type A"}),e.jsxs("span",{className:"font-mono text-foreground",children:[o.split(".")[0],e.jsx("span",{className:"text-muted-foreground",children:o.slice(o.split(".")[0].length)})]}),e.jsx("span",{className:"font-mono text-foreground",children:"84.22.97.162"})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-1",children:[e.jsx("span",{className:"font-semibold text-foreground w-20",children:"Type AAAA"}),e.jsxs("span",{className:"font-mono text-foreground",children:[o.split(".")[0],e.jsx("span",{className:"text-muted-foreground",children:o.slice(o.split(".")[0].length)})]}),e.jsx("span",{className:"font-mono text-foreground break-all",children:"2a02:2770:11:0:21a:4aff:fe7f:4207"})]})]}),e.jsxs("div",{className:"text-muted-foreground space-y-1 pt-2 border-t border-border",children:[u.trim()?e.jsxs("p",{children:["Mail gaat naar ",e.jsx("span",{className:"text-foreground",children:u.trim()}),x.trim()&&e.jsxs(e.Fragment,{children:[" met kopie naar ",e.jsx("span",{className:"text-foreground",children:x.trim()})]})]}):e.jsx("p",{children:"Geen e-mailadres ingevuld: je kunt alleen een link maken om zelf te delen."}),e.jsxs("p",{children:["Wachtwoord van de pagina:"," ",e.jsx("span",{className:"font-mono text-foreground",children:f.trim()})]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(l,{onClick:()=>re(!0),disabled:b,className:"rounded-full font-semibold",children:[e.jsx(D,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),b?"Bezig...":"Klopt het? Mail de DNS-gegevens"]}),e.jsxs(l,{variant:"outline",onClick:()=>re(!1),disabled:b,className:"rounded-full font-semibold",children:[e.jsx(_e,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),"Maak alleen een link"]}),e.jsx(l,{variant:"ghost",className:"rounded-full",onClick:()=>y(!1),children:"Aanpassen"})]})]}):e.jsxs(l,{onClick:fe,className:"rounded-full font-semibold",children:[e.jsx(ie,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),"Bekijk de pagina"]}),C&&e.jsxs("div",{className:"border border-primary/40 bg-primary/5 rounded-2xl p-5 space-y-3",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"Link om te delen met de klant"}),e.jsx("p",{className:"font-mono break-all text-primary",children:C}),e.jsxs(l,{variant:"outline",size:"sm",className:"rounded-full",onClick:()=>L(C,"Link"),children:[e.jsx(_,{className:"w-4 h-4 mr-2","aria-hidden":"true"})," Kopieer link"]})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Verstuurde pagina's"}),z.length===0?e.jsx("p",{className:"text-muted-foreground",children:"Nog niets verstuurd."}):z.map(a=>e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold text-foreground",children:a.client_name||a.domain}),e.jsxs("p",{className:"text-sm text-muted-foreground break-all",children:["Domein: ",e.jsx("span",{className:"font-mono",children:a.domain})]}),e.jsx("p",{className:"font-mono text-primary break-all",children:a.subdomain})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(l,{variant:"outline",size:"sm",className:"rounded-full",onClick:()=>window.open(`/dns/${a.token}`,"_blank","noopener"),children:[e.jsx(ie,{className:"w-4 h-4 mr-2","aria-hidden":"true"})," Bekijk pagina"]}),e.jsxs(l,{variant:"outline",size:"sm",className:"rounded-full",onClick:()=>L(ne(a.token),"Link"),children:[e.jsx(_,{className:"w-4 h-4 mr-2","aria-hidden":"true"})," Link"]}),e.jsxs(l,{variant:"outline",size:"sm",className:"rounded-full",onClick:()=>{Q(Z===a.id?null:a.id),X(a.recipient_email||""),Y(a.cc_email||N)},children:[e.jsx(D,{className:"w-4 h-4 mr-2","aria-hidden":"true"})," Mail"]}),e.jsx(l,{variant:"outline",size:"sm",className:"rounded-full",onClick:()=>je(a.id),"aria-label":`Pagina van ${a.client_name||a.domain} verwijderen`,children:e.jsx(De,{className:"w-4 h-4","aria-hidden":"true"})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:ne(a.token)}),a.password&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["Wachtwoord: ",e.jsx("span",{className:"font-mono",children:a.password})]}),e.jsx(l,{variant:"outline",size:"sm",className:"rounded-full",onClick:()=>L(a.password,"Wachtwoord"),"aria-label":"Wachtwoord kopiëren",children:e.jsx(_,{className:"w-4 h-4","aria-hidden":"true"})})]}),(()=>{const s=de.filter(r=>r.share_id===a.id);return s.length===0?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Aangemaakt op ",$(a.created_at),", nog geen mail verstuurd."]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Verstuurde mails"}),s.map(r=>e.jsxs("p",{className:`text-sm font-medium ${r.opened_at?"text-emerald-600":"text-muted-foreground"}`,children:[r.kind==="cc"?"Kopie":"Klant"," (",r.email,") — verstuurd op"," ",$(r.sent_at),","," ",r.opened_at?`geopend op ${$(r.opened_at)}`:"nog niet geopend"]},r.id))]})})(),Z===a.id&&e.jsxs("div",{className:"border border-border rounded-xl p-4 space-y-3 bg-background",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"Mail de DNS-gegevens"}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:`dns-mailto-${a.id}`,children:"E-mailadres van de klant"}),e.jsx(d,{id:`dns-mailto-${a.id}`,type:"email",autoComplete:"off",value:j,onChange:s=>X(s.target.value),className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:`dns-mailcc-${a.id}`,children:"Kopie naar"}),e.jsx(d,{id:`dns-mailcc-${a.id}
6`,type:"email",autoComplete:"off",value:v,onChange:s=>Y(s.target.value),className:"mt-2"})]})]}),e.jsxs(l,{className:"rounded-full font-semibold",disabled:ee,onClick:()=>ve(a),children:[e.jsx(D,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),ee?"Bezig...":"Verstuur de mail"]})]})]},a.id))]})]}):e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-6 md:p-8 max-w-md",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-6",children:[e.jsx(Le,{className:"w-5 h-5 text-primary shrink-0 mt-1","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-1",children:"Inloggen als beheerder"}),e.jsx("p",{className:"text-muted-foreground",children:"Alleen beheerders kunnen DNS-gegevens klaarzetten en mailen."})]})]}),e.jsxs("form",{onSubmit:pe,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"dns-login-email",children:"E-mailadres"}),e.jsx(d,{id:"dns-login-email",type:"email",autoComplete:"username",value:I,onChange:a=>me(a.target.value),className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"dns-login-password",children:"Wachtwoord"}),e.jsx(d,{id:"dns-login-password",type:"password",autoComplete:"current-password",value:F,onChange:a=>ue(a.target.value),"aria-invalid":!!g,"aria-describedby":g?"dns-login-error":void 0,className:"mt-2 max-w-[16rem]"})]}),g&&e.jsx("p",{id:"dns-login-error",className:"text-sm font-medium text-destructive",children:g}),e.jsx(l,{type:"submit",disabled:P,className:"rounded-full font-semibold",children:P?"Inloggen...":"Inloggen"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:["Wachtwoord vergeten?"," ",e.jsx(be,{to:"/auth",className:"underline",children:"Herstel je wachtwoord"})]})]})]})}),e.jsx(Se,{}),e.jsx(ye,{})]})};export{Te 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.