PulseCanvas / website · pulsecanvas.ai / public-links.js
| 1 | import { siteConfig } from './site.config.js'; |
| 2 | |
| 3 | function 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 | |
| 12 | export function configurePublicLinks() { |
| 13 | const sourceUrl = httpsUrl(siteConfig.sourceUrl, 'https://branchwell.ai/pulsecanvas/app'); |
| 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 | } |