46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
const CLEARNET_HOST = "jetpham.com";
|
|
const ONION_HOST =
|
|
"jet7tetd43snvjx3ng5jrhuwm2yhyp76tjtct5mtofg64apokcgq7fqd.onion";
|
|
const REPO_URL = "https://git.extremist.software/jet/website";
|
|
|
|
function isOnionHost(hostname: string): boolean {
|
|
return hostname.endsWith(".onion");
|
|
}
|
|
|
|
function getMirrorLink() {
|
|
if (isOnionHost(location.hostname)) {
|
|
return {
|
|
href: `https://${CLEARNET_HOST}`,
|
|
label: "clearnet",
|
|
};
|
|
}
|
|
|
|
return {
|
|
href: `http://${ONION_HOST}`,
|
|
label: ".onion",
|
|
};
|
|
}
|
|
|
|
export function renderFooter() {
|
|
const footer = document.getElementById("site-footer");
|
|
if (!footer) return;
|
|
|
|
const mirror = getMirrorLink();
|
|
|
|
footer.innerHTML = `
|
|
<div class="site-panel-frame px-[2ch] py-[1ch]">
|
|
<div class="site-panel-frost" aria-hidden="true"></div>
|
|
<div class="site-panel-border" aria-hidden="true"></div>
|
|
<div class="site-panel-content site-footer-inner">
|
|
<a href="${REPO_URL}">Src</a>
|
|
<span aria-hidden="true">|</span>
|
|
<a href="/qa/rss.xml" data-native-link>RSS</a>
|
|
<span aria-hidden="true">|</span>
|
|
<a href="/pgp.txt" data-native-link>PGP</a>
|
|
<span aria-hidden="true">|</span>
|
|
<a href="/ssh.txt" data-native-link>SSH</a>
|
|
<span aria-hidden="true">|</span>
|
|
<a href="${mirror.href}">${mirror.label}</a>
|
|
</div>
|
|
</div>`;
|
|
}
|