mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-04 23:17:34 +08:00
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:
@@ -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,
|
||||
|
||||
@@ -38,6 +38,7 @@ export const useGlobalState = createGlobalState(
|
||||
isS3Enabled: false,
|
||||
enableSendMail: false,
|
||||
showGithub: true,
|
||||
showGithubForUser: true,
|
||||
disableAdminPasswordCheck: false,
|
||||
enableAddressPassword: false,
|
||||
enableAgentEmailInfo: false,
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user