47 lines
1.4 KiB
TypeScript
47 lines
1.4 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 px-[2ch] py-[1ch]">
|
|
<div class="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>
|
|
<button type="button" id="background-toggle" class="qa-inline-action">motion auto</button>
|
|
<span id="background-status" class="qa-meta" aria-live="polite"></span>
|
|
<span aria-hidden="true">|</span>
|
|
<a href="${mirror.href}">${mirror.label}</a>
|
|
</div>
|
|
</div>`;
|
|
}
|