diff --git a/app/layouts/public.vue b/app/layouts/public.vue
index b068c25..e2f6c27 100644
--- a/app/layouts/public.vue
+++ b/app/layouts/public.vue
@@ -7,7 +7,7 @@ import {
import { unwrapApiBody, type ApiResponse } from '../utils/http/factory'
const route = useRoute()
-const { loggedIn, refresh, initialized } = useAuthSession()
+const { loggedIn, user, refresh, initialized } = useAuthSession()
const { siteName } = useGlobalConfig()
const showPublicLayoutToggle = computed(() => /^\/@[^/]+$/.test(route.path))
@@ -16,6 +16,19 @@ const profileSlug = computed(() => {
return typeof s === 'string' && s.length ? s : ''
})
+/** 顶栏「控制台」仅在看自己的 /@slug 时显示;浏览他人主页时隐藏 */
+const showPublicConsoleLink = computed(() => {
+ if (!loggedIn.value || !user.value) {
+ return false
+ }
+ const slug = profileSlug.value.trim().toLowerCase()
+ if (!slug) {
+ return true
+ }
+ const mine = user.value.publicSlug?.trim().toLowerCase() ?? ''
+ return mine !== '' && mine === slug
+})
+
type PublicHomeHeaderPayload = { title: string; iconUrl: string | null }
const { data: publicHomeHeader } = await useAsyncData(
@@ -152,7 +165,7 @@ onMounted(() => {