feat: hide GitHub links for normal users

Add DISABLE_SHOW_GITHUB_FOR_USER to hide the Header GitHub/version entry from normal users while keeping it visible to admin users. Refs #1041
This commit is contained in:
Dream Hunter
2026-05-21 23:38:49 +08:00
committed by GitHub
parent 2221342560
commit 44b29aa646
12 changed files with 21 additions and 5 deletions
+1
View File
@@ -104,6 +104,7 @@ const getOpenSettings = async (message, notification) => {
cfTurnstileSiteKey: res["cfTurnstileSiteKey"] || "",
enableWebhook: res["enableWebhook"] || false,
isS3Enabled: res["isS3Enabled"] || false,
showGithubForUser: res["showGithubForUser"] ?? openSettings.value.showGithubForUser,
enableAddressPassword: res["enableAddressPassword"] || false,
enableAgentEmailInfo: res["enableAgentEmailInfo"] || false,
smtpImapProxyConfig: res["smtpImapProxyConfig"] || openSettings.value.smtpImapProxyConfig,
+1
View File
@@ -38,6 +38,7 @@ export const useGlobalState = createGlobalState(
isS3Enabled: false,
enableSendMail: false,
showGithub: true,
showGithubForUser: true,
disableAdminPasswordCheck: false,
enableAddressPassword: false,
enableAgentEmailInfo: false,
+7 -2
View File
@@ -103,6 +103,11 @@ const changeLocale = async (lang) => {
}
const version = import.meta.env.PACKAGE_VERSION ? `v${import.meta.env.PACKAGE_VERSION}` : "";
const showGithubForCurrentUser = computed(() => {
if (!openSettings.value.showGithub) return false;
if (openSettings.value.showGithubForUser) return true;
return showAdminPage.value;
});
const menuOptions = computed(() => [
{
@@ -270,7 +275,7 @@ onMounted(async () => {
</n-button>
</n-dropdown>
<n-button
v-if="!isMobile && openSettings.showGithub"
v-if="!isMobile && showGithubForCurrentUser"
text
size="small"
class="header-version-button"
@@ -298,7 +303,7 @@ onMounted(async () => {
</button>
</n-dropdown>
<a
v-if="openSettings.showGithub"
v-if="showGithubForCurrentUser"
class="mobile-menu-utility-button"
target="_blank"
rel="noopener noreferrer"