feat: hide GitHub links for normal users
Some checks failed
Upstream Sync / Sync latest commits from upstream repo (push) Has been cancelled

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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 21 additions and 5 deletions

View File

@ -10,6 +10,7 @@
### Features
- feat: |Frontend| 新增 `DISABLE_SHOW_GITHUB_FOR_USER` 配置,可仅对普通用户隐藏 Header 的 GitHub/版本入口admin 仍可见issue #1041
- feat: |Frontend| 将邮箱地址凭证弹窗升级为“地址凭证与连接方式”,复用普通用户与 admin 创建邮箱结果弹窗;支持通过 `ENABLE_AGENT_EMAIL_INFO` 展示 AI Agent 接入信息,并通过 `SMTP_IMAP_PROXY_CONFIG` 展示 SMTP/IMAP 客户端连接信息
- docs: |随机子域名| 在前端“启用随机子域名”提示与 `subdomain` / `worker-vars` 文档(中英)中明确说明:要让 `name@<随机>.abc.com` 真正收到邮件,必须在基础域名 DNS 中为 `*` 子域添加通配 MX 记录Email Routing 子域不继承父域配置issue #1035

View File

@ -10,6 +10,7 @@
### Features
- feat: |Frontend| Add `DISABLE_SHOW_GITHUB_FOR_USER` to hide the Header GitHub/version entry from normal users while keeping it visible to admin users (issue #1041)
- feat: |Frontend| Upgrade the address credential dialog to "Address Credentials & Connection Methods" and reuse it for both normal users and admin-created addresses; support showing AI Agent access via `ENABLE_AGENT_EMAIL_INFO` and SMTP/IMAP client settings via `SMTP_IMAP_PROXY_CONFIG`
- docs: |Random Subdomain| Clarify in the "Use Random Subdomain" frontend tip and the `subdomain` / `worker-vars` docs (zh & en) that receiving mail on `name@<random>.abc.com` requires a wildcard `*` MX record under the base domain in DNS, because Cloudflare Email Routing does not inherit the apex configuration onto subdomains (issue #1035)

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,

View File

@ -38,6 +38,7 @@ export const useGlobalState = createGlobalState(
isS3Enabled: false,
enableSendMail: false,
showGithub: true,
showGithubForUser: true,
disableAdminPasswordCheck: false,
enableAddressPassword: false,
enableAgentEmailInfo: false,

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"

View File

@ -123,6 +123,7 @@ ENABLE_AUTO_REPLY = false
# Footer text
# COPYRIGHT = "Dream Hunter"
# DISABLE_SHOW_GITHUB = true # Disable Show GitHub link
# DISABLE_SHOW_GITHUB_FOR_USER = true # Hide GitHub link for normal users only
# default send balance, if not set, it will be 0
# DEFAULT_SEND_BALANCE = 1
# the role which can send emails without limit, multiple roles can be separated by ,

View File

@ -156,7 +156,8 @@
| `ALWAYS_SHOW_ANNOUNCEMENT` | Text/JSON | Whether to always show announcement (even if unchanged), default `false` | `true` |
| `COPYRIGHT` | Text | Custom frontend footer text, supports html | `Dream Hunter` |
| `ADMIN_CONTACT` | Text | Admin contact information, can be any string, hidden if not configured | `xxx@gmail.com` |
| `DISABLE_SHOW_GITHUB` | Text/JSON | Whether to show GitHub link | `true` |
| `DISABLE_SHOW_GITHUB` | Text/JSON | Globally hide the GitHub link | `true` |
| `DISABLE_SHOW_GITHUB_FOR_USER` | Text/JSON | Hide the GitHub link for normal users while keeping it visible to admin users | `true` |
| `STATUS_URL` | Text | Status monitoring page URL, shows Status menu button when configured | `https://status.example.com` |
| `CF_TURNSTILE_SITE_KEY` | Text/Secret | Turnstile CAPTCHA configuration (for new address creation, registration code, etc.) | `xxx` |
| `CF_TURNSTILE_SECRET_KEY` | Text/Secret | Turnstile CAPTCHA configuration (for new address creation, registration code, etc.) | `xxx` |

View File

@ -150,7 +150,8 @@
| `ALWAYS_SHOW_ANNOUNCEMENT` | 文本/JSON | 是否总是显示公告(即使无更改), 默认 `false` | `true` |
| `COPYRIGHT` | 文本 | 自定义前端界面页脚文本,支持 html | `Dream Hunter` |
| `ADMIN_CONTACT` | 文本 | admin 联系方式,可配置任意字符串, 不配置则不显示 | `xxx@gmail.com` |
| `DISABLE_SHOW_GITHUB` | 文本/JSON | 是否显示 GitHub 链接 | `true` |
| `DISABLE_SHOW_GITHUB` | 文本/JSON | 是否全局隐藏 GitHub 链接 | `true` |
| `DISABLE_SHOW_GITHUB_FOR_USER` | 文本/JSON | 是否仅对普通用户隐藏 GitHub 链接admin 仍显示 | `true` |
| `STATUS_URL` | 文本 | 状态监控页面 URL配置后显示 Status 菜单按钮 | `https://status.example.com` |
| `CF_TURNSTILE_SITE_KEY` | 文本/Secret | Turnstile 人机验证配置(用于新建邮箱、注册验证码等) | `xxx` |
| `CF_TURNSTILE_SECRET_KEY` | 文本/Secret | Turnstile 人机验证配置(用于新建邮箱、注册验证码等) | `xxx` |

View File

@ -45,7 +45,8 @@ export default {
"ENABLE_WEBHOOK": utils.getBooleanValue(c.env.ENABLE_WEBHOOK),
"S3_ENABLED": isS3Enabled(c),
"VERSION": CONSTANTS.VERSION,
"DISABLE_SHOW_GITHUB": !utils.getBooleanValue(c.env.DISABLE_SHOW_GITHUB),
"DISABLE_SHOW_GITHUB": utils.getBooleanValue(c.env.DISABLE_SHOW_GITHUB),
"DISABLE_SHOW_GITHUB_FOR_USER": utils.getBooleanValue(c.env.DISABLE_SHOW_GITHUB_FOR_USER),
"DISABLE_ADMIN_PASSWORD_CHECK": utils.getBooleanValue(c.env.DISABLE_ADMIN_PASSWORD_CHECK),
"ENABLE_CHECK_JUNK_MAIL": utils.getBooleanValue(c.env.ENABLE_CHECK_JUNK_MAIL),
"JUNK_MAIL_CHECK_LIST": utils.getStringArray(c.env.JUNK_MAIL_CHECK_LIST),

View File

@ -48,6 +48,7 @@ api.get('/open_api/settings', async (c) => {
"enableSendMail": isAnySendMailEnabled(c),
"version": CONSTANTS.VERSION,
"showGithub": !utils.getBooleanValue(c.env.DISABLE_SHOW_GITHUB),
"showGithubForUser": !utils.getBooleanValue(c.env.DISABLE_SHOW_GITHUB_FOR_USER),
"disableAdminPasswordCheck": utils.getBooleanValue(c.env.DISABLE_ADMIN_PASSWORD_CHECK),
"enableAddressPassword": utils.getBooleanValue(c.env.ENABLE_ADDRESS_PASSWORD),
"enableAgentEmailInfo": utils.getBooleanValue(c.env.ENABLE_AGENT_EMAIL_INFO),

View File

@ -67,6 +67,7 @@ type Bindings = {
COPYRIGHT: string | undefined
STATUS_URL: string | undefined
DISABLE_SHOW_GITHUB: string | boolean | undefined
DISABLE_SHOW_GITHUB_FOR_USER: string | boolean | undefined
FORWARD_ADDRESS_LIST: string | string[] | undefined
ENABLE_CHECK_JUNK_MAIL: string | boolean | undefined

View File

@ -93,6 +93,7 @@ ENABLE_AUTO_REPLY = false
# Footer text
# COPYRIGHT = "Dream Hunter"
# DISABLE_SHOW_GITHUB = true
# DISABLE_SHOW_GITHUB_FOR_USER = true
# Status monitoring page URL
# STATUS_URL = "https://status.example.com"
# default send balance, auto initialized when users open settings or send mail; if not set, it will be 0