🌳
pt0/peatsite/hostBannerAI.mjs
3const ensGatewayTlds = ['demokluster.com', 'limo', 'link', 'xyz', 'wtf']
4const ensDomains = ensGatewayTlds.map(t => `${ossEnsName}.${t}`)
5export const canonicalEnsGateway = ensDomains[0]
7const ensNameEsc = ossEnsName.replace('.', '\\.')
8const cloneRewriteScript = `<script>(function(){var h=window.location.hostname;if(!h||h.indexOf('${ossEnsName}.')!==0)return;var cloneRe=/git clone https:\\/\\/${ensNameEsc}\\.[a-z.]+/g;var linkRe=new RegExp('^https:\\/\\/${ensNameEsc}\\\\.[a-z.]+');document.querySelectorAll('code').forEach(function(el){el.innerHTML=el.innerHTML.replace(cloneRe,'git clone https://'+h)});document.querySelectorAll('a[href]').forEach(function(a){var href=a.getAttribute('href');if(!href)return;if(a.closest('.host-banner')){if(href==='https://'+h)a.classList.add('current-host');return}if(linkRe.test(href))a.setAttribute('href',href.replace(linkRe,'https://'+h))})})()</script>`
10export const hostBannerHtml = `<div class="host-banner">(this website is hosted on: ${ensDomains.map(d => `<a href="https://${d}">${d}</a>`).join(' ')} using its own code, via ipfs!)</div><style>.host-banner{text-align:center;font-size:12px;color:#888;padding:2px var(--banner-clear-right) 0 var(--banner-clear-left);margin-bottom:8px}.host-banner a{color:#5b9bd5;text-decoration:none;margin:0 6px;white-space:nowrap}.host-banner a:hover{text-decoration:underline}.host-banner a.current-host{font-weight:bold;color:violet}</style>${cloneRewriteScript}`