Branchwell

PulseCanvas / website · pulsecanvas.ai / public-links.js

Raw 630 B on 0cef5bc007bcecc69010c0ad24efe67f29d0dada
1import { siteConfig } from './site.config.js';
2
3function httpsUrl(value, fallback) {
4 try {
5 const url = new URL(value);
6 return url.protocol === 'https:' ? url.href : fallback;
7 } catch {
8 return fallback;
9 }
10}
11
12export function configurePublicLinks() {
13 const sourceUrl = httpsUrl(siteConfig.sourceUrl, 'https://github.com/projectatomai/pulsecanvas');
14 const newsletterUrl = httpsUrl(siteConfig.newsletterUrl, '/download/');
15 document.querySelectorAll('[data-source]').forEach(link => { link.href = sourceUrl; });
16 document.querySelectorAll('[data-newsletter]').forEach(link => { link.href = newsletterUrl; });
17}