From 24492fae93d9b5e175291c337ff7c3fe1441a6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asger=20Geel=20Weirs=C3=B8e?= Date: Fri, 12 Jun 2026 17:06:00 +0200 Subject: [PATCH] =?UTF-8?q?chat:=20linkific=C3=A9r=20svar=20(escape-then-l?= =?UTF-8?q?ink)=20+=20ret=20kontakt-email=20til=20asger@weirsoe.dk=20overa?= =?UTF-8?q?lt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- public/.well-known/security.txt | 2 +- public/cv.txt | 2 +- public/humans.txt | 2 +- src/components/Palette.astro | 2 +- src/consts.ts | 4 ++-- src/pages/chat.astro | 16 ++++++++++++++-- src/pages/colophon.astro | 2 +- 7 files changed, 21 insertions(+), 9 deletions(-) diff --git a/public/.well-known/security.txt b/public/.well-known/security.txt index 1140cc2..dd0564d 100644 --- a/public/.well-known/security.txt +++ b/public/.well-known/security.txt @@ -1,4 +1,4 @@ -Contact: mailto:asger@weircon.dk +Contact: mailto:asger@weirsoe.dk Expires: 2027-06-30T22:00:00.000Z Preferred-Languages: da, en Canonical: https://asger.xn--weirse-fya.dk/.well-known/security.txt diff --git a/public/cv.txt b/public/cv.txt index 8d6db0b..9f432fb 100644 --- a/public/cv.txt +++ b/public/cv.txt @@ -30,7 +30,7 @@ KONTAKT ------- Web: https://asger.weirsøe.dk - Email: asger@weircon.dk + Email: asger@weirsoe.dk LinkedIn: linkedin.com/in/ag-weirsøe Mastodon: @asgerweirsoee@mastodon.social Git: gitea.weircon.dk/agw diff --git a/public/humans.txt b/public/humans.txt index 8791eb3..7254f85 100644 --- a/public/humans.txt +++ b/public/humans.txt @@ -1,6 +1,6 @@ /* TEAM */ Alt det her: Asger Geel Weirsøe - Kontakt: asger@weircon.dk + Kontakt: asger@weirsoe.dk Mastodon: @asgerweirsoee@mastodon.social Lokation: Nørresundby, Danmark diff --git a/src/components/Palette.astro b/src/components/Palette.astro index 964fd55..1bf50bf 100644 --- a/src/components/Palette.astro +++ b/src/components/Palette.astro @@ -57,7 +57,7 @@ { type: 'action', title: 'Tema: mørkt', run: () => setTheme('dark') }, { type: 'action', title: 'Tema: lyst', run: () => setTheme('light') }, { type: 'action', title: 'Tema: terminal', run: () => setTheme('terminal') }, - { type: 'action', title: 'Kopiér email (asger@weircon.dk)', run: () => navigator.clipboard?.writeText('asger@weircon.dk') }, + { type: 'action', title: 'Kopiér email (asger@weirsoe.dk)', run: () => navigator.clipboard?.writeText('asger@weirsoe.dk') }, { type: 'link', title: 'LinkedIn ↗', url: 'https://www.linkedin.com/in/ag-weirs%C3%B8e/', ext: true }, { type: 'link', title: 'Mastodon ↗', url: 'https://mastodon.social/@asgerweirsoee', ext: true }, { type: 'link', title: 'Gitea ↗', url: 'https://gitea.weircon.dk/agw', ext: true }, diff --git a/src/consts.ts b/src/consts.ts index 3da3954..a6d7629 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -4,7 +4,7 @@ export const SITE = { description: 'Asger Weirsøe er datalog (cand.scient. fra Aalborg Universitet) og Technical Solution Architect hos Digisense. Peppol, NemHandel, e-faktura, selvhosting, Proxmox og AI.', url: 'https://asger.xn--weirse-fya.dk', lang: 'da', - email: 'asger@weircon.dk', + email: 'asger@weirsoe.dk', location: 'Nørresundby, Danmark', giteaUser: 'agw', giteaBase: 'https://gitea.weircon.dk', @@ -21,7 +21,7 @@ export const SOCIALS = [ { href: 'https://www.linkedin.com/in/ag-weirs%C3%B8e/', label: 'LinkedIn' }, { href: 'https://mastodon.social/@asgerweirsoee', label: 'Mastodon' }, { href: 'https://gitea.weircon.dk/agw', label: 'Gitea' }, - { href: 'mailto:asger@weircon.dk', label: 'Email' }, + { href: 'mailto:asger@weirsoe.dk', label: 'Email' }, ]; // Styr hvad der vises på /projekter. diff --git a/src/pages/chat.astro b/src/pages/chat.astro index 3f37e0c..e7c13df 100644 --- a/src/pages/chat.astro +++ b/src/pages/chat.astro @@ -24,12 +24,24 @@ import Base from '../layouts/Base.astro'; var form = document.getElementById('chat-form'); if (!form || form.__wired) return; form.__wired = true; var history = []; + function esc(s) { + return s.replace(/&/g, '&').replace(//g, '>'); + } + // Escape FØRST, linkificér så — rene URL'er og e-mails bliver klikbare, intet HTML slipper igennem. + function linkify(text) { + var html = esc(text); + html = html.replace(/\b(https?:\/\/[^\s<]+[^\s<.,!?:;)])/g, + '$1'); + html = html.replace(/\b([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,})\b/g, + '$1'); + return html; + } function bubble(role, text) { var log = document.getElementById('chat-log'); var d = document.createElement('div'); d.className = 'rounded-2xl border border-border p-4 text-sm whitespace-pre-wrap ' + (role === 'user' ? 'bg-surface-2 ml-8' : 'bg-surface/60 mr-8'); - d.textContent = text; + if (role === 'user') d.textContent = text; else d.innerHTML = linkify(text); log.appendChild(d); d.scrollIntoView({ behavior: 'smooth', block: 'end' }); return d; @@ -50,7 +62,7 @@ import Base from '../layouts/Base.astro'; }); var data = await r.json(); if (!r.ok) { wait.textContent = data.error || 'Chatten er offline lige nu — prøv senere.'; return; } - wait.textContent = data.reply; + wait.innerHTML = linkify(data.reply); history.push({ role: 'assistant', content: data.reply }); } catch (_) { wait.textContent = 'Kunne ikke nå chatten — prøv igen om lidt.'; diff --git a/src/pages/colophon.astro b/src/pages/colophon.astro index 61b4da5..75356f0 100644 --- a/src/pages/colophon.astro +++ b/src/pages/colophon.astro @@ -38,7 +38,7 @@ const stack = [

Sikkerhed

- Fundet noget der ser forkert ud? Skriv til asger@weircon.dk + Fundet noget der ser forkert ud? Skriv til asger@weirsoe.dk — der ligger også en security.txt (RFC 9116). Og ja, der er en humans.txt til de nysgerrige.