Make sidebar external links configurable

This commit is contained in:
thePR0M3TH3AN committed 2025-10-18 15:53:01 -04:00
1 parent f755349e13
commit 7065075c8b
5 files changed
+112 -25

No files matched your search

+24 -24
View File
@@ -183,6 +183,21 @@
/>
<span class="sidebar-text">Blog</span>
</a>
<a
href="#"
data-nostr-link
class="sidebar-nav-link sidebar-nav-link--sub"
title="Nostr"
rel="noopener noreferrer"
>
<img
src="assets/svg/nostr-icon.svg"
alt=""
aria-hidden="true"
class="sidebar-icon"
/>
<span class="sidebar-text">Nostr</span>
</a>
<a
href="#"
data-community-link
@@ -207,26 +222,11 @@
<span class="sidebar-text">Community</span>
</a>
<a
href="https://primal.net/p/npub13yarr7j6vjqjjkahd63dmr27curypehx45ucue286ac7sft27y0srnpmpe"
target="_blank"
rel="noopener noreferrer"
class="sidebar-nav-link sidebar-nav-link--sub"
title="Nostr"
>
<img
src="assets/svg/nostr-icon.svg"
alt=""
aria-hidden="true"
class="sidebar-icon"
/>
<span class="sidebar-text">Nostr</span>
</a>
<a
href="https://github.com/PR0M3TH3AN/bitvid"
target="_blank"
rel="noopener noreferrer"
href="#"
data-github-link
class="sidebar-nav-link sidebar-nav-link--sub"
title="GitHub"
rel="noopener noreferrer"
>
<img
src="assets/svg/github-icon.svg"
@@ -252,11 +252,11 @@
<span class="sidebar-text">βeacon</span>
</a>
<a
href="https://beta.bitvid.network/"
target="_blank"
rel="noopener noreferrer"
href="#"
data-beta-link
class="sidebar-nav-link sidebar-nav-link--sub"
title="Beta"
rel="noopener noreferrer"
>
<img
src="assets/svg/beta-icon.svg"
@@ -285,11 +285,11 @@
<span class="sidebar-text">IPNS</span>
</a>
<a
href="https://bitvid.network/"
target="_blank"
rel="noopener noreferrer"
href="#"
data-dns-link
class="sidebar-nav-link sidebar-nav-link--sub"
title="DNS"
rel="noopener noreferrer"
>
<img
src="assets/svg/dns-icon.svg"
+36
View File
@@ -64,6 +64,42 @@ export const BLOG_URL =
*/
export const COMMUNITY_URL = null;
/**
* Optional external destination for the Nostr menu link.
*
* Point this at the profile or relay hub you want visitors to land on when
* they tap "Nostr" in the sidebar dropup. Leave empty (null or an empty
* string) to hide the link entirely.
*/
export const NOSTR_URL =
"https://primal.net/p/npub13yarr7j6vjqjjkahd63dmr27curypehx45ucue286ac7sft27y0srnpmpe";
/**
* Optional external destination for the GitHub menu link.
*
* Set this to the repository you want surfaced to operators and contributors.
* Leave empty (null or an empty string) to remove the GitHub entry from the
* sidebar dropup menu.
*/
export const GITHUB_URL = "https://github.com/PR0M3TH3AN/bitvid";
/**
* Optional external destination for the Beta menu link.
*
* Deployments that maintain a staging or beta environment can direct users to
* that surface here. Leave empty (null or an empty string) if there is no
* public beta to advertise.
*/
export const BETA_URL = "https://beta.bitvid.network/";
/**
* Optional external destination for the DNS menu link.
*
* Operators can expose their canonical DNS landing page here. Leave empty
* (null or an empty string) to hide the DNS entry from the sidebar.
*/
export const DNS_URL = "https://bitvid.network/";
/**
* Default image included in automated moderation DMs.
*
+12
View File
@@ -10,6 +10,10 @@ import {
THEME_ACCENT_OVERRIDES,
BLOG_URL,
COMMUNITY_URL,
NOSTR_URL,
GITHUB_URL,
BETA_URL,
DNS_URL,
} from "./instance-config.js";
function assertSuperAdminConfigured(value) {
@@ -115,6 +119,10 @@ function resolveConfig(overrides = {}) {
overrides.THEME_ACCENT_OVERRIDES ?? THEME_ACCENT_OVERRIDES,
blogUrl: overrides.BLOG_URL ?? BLOG_URL,
communityUrl: overrides.COMMUNITY_URL ?? COMMUNITY_URL,
nostrUrl: overrides.NOSTR_URL ?? NOSTR_URL,
githubUrl: overrides.GITHUB_URL ?? GITHUB_URL,
betaUrl: overrides.BETA_URL ?? BETA_URL,
dnsUrl: overrides.DNS_URL ?? DNS_URL,
};
}
@@ -166,4 +174,8 @@ export function validateInstanceConfig(overrides) {
assertThemeAccentOverrides(config.themeAccentOverrides);
assertOptionalHttpUrl(config.blogUrl, "BLOG_URL");
assertOptionalHttpUrl(config.communityUrl, "COMMUNITY_URL");
assertOptionalHttpUrl(config.nostrUrl, "NOSTR_URL");
assertOptionalHttpUrl(config.githubUrl, "GITHUB_URL");
assertOptionalHttpUrl(config.betaUrl, "BETA_URL");
assertOptionalHttpUrl(config.dnsUrl, "DNS_URL");
}
+8
View File
@@ -8,6 +8,10 @@ import {
BITVID_WEBSITE_URL,
BLOG_URL,
COMMUNITY_URL,
NOSTR_URL,
GITHUB_URL,
BETA_URL,
DNS_URL,
MAX_WALLET_DEFAULT_ZAP,
PLATFORM_FEE_PERCENT,
PLATFORM_LUD16_OVERRIDE,
@@ -47,6 +51,10 @@ export { ADMIN_DM_IMAGE_URL };
export { BITVID_WEBSITE_URL };
export { BLOG_URL };
export { COMMUNITY_URL };
export { NOSTR_URL };
export { GITHUB_URL };
export { BETA_URL };
export { DNS_URL };
export { MAX_WALLET_DEFAULT_ZAP };
export { PLATFORM_FEE_PERCENT };
export { PLATFORM_LUD16_OVERRIDE };
+32 -1
View File
@@ -19,7 +19,14 @@ import {
openStaticModal,
closeStaticModal,
} from "./ui/components/staticModalAccessibility.js";
import { BLOG_URL, COMMUNITY_URL } from "./config.js";
import {
BLOG_URL,
COMMUNITY_URL,
NOSTR_URL,
GITHUB_URL,
BETA_URL,
DNS_URL,
} from "./config.js";
validateInstanceConfig();
@@ -239,12 +246,36 @@ async function bootstrapInterface() {
label: "Sidebar blog link",
});
bindOptionalExternalLink({
selector: "[data-nostr-link]",
url: NOSTR_URL,
label: "Sidebar Nostr link",
});
bindOptionalExternalLink({
selector: "[data-community-link]",
url: COMMUNITY_URL,
label: "Sidebar community link",
});
bindOptionalExternalLink({
selector: "[data-github-link]",
url: GITHUB_URL,
label: "Sidebar GitHub link",
});
bindOptionalExternalLink({
selector: "[data-beta-link]",
url: BETA_URL,
label: "Sidebar Beta link",
});
bindOptionalExternalLink({
selector: "[data-dns-link]",
url: DNS_URL,
label: "Sidebar DNS link",
});
const sidebar = document.getElementById("sidebar");
const collapseToggle = document.getElementById("sidebarCollapseToggle");
if (sidebar && !sidebar.hasAttribute("data-footer-state")) {