🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat: support Apple Smart App Banner via APPLE_APP_STORE_ID (#17813)
Innei4010d952728d
diff --git a/packages/business/const/src/branding.ts b/packages/business/const/src/branding.tsindex 34a5cf94db0..3ebab947643 100644--- a/packages/business/const/src/branding.ts+++ b/packages/business/const/src/branding.ts@@ -37,5 +37,7 @@ export const BRANDING_EMAIL = {export const BRANDING_PROVIDER = 'lobehub';+export const APPLE_APP_STORE_ID = '';+export const COPYRIGHT = `© ${new Date().getFullYear()} ${ORG_NAME}`;export const COPYRIGHT_FULL = `${COPYRIGHT}. All rights reserved.`;diff --git a/src/app/[variants]/metadata.ts b/src/app/[variants]/metadata.tsindex 644e56ef3dd..1f118ea5e61 100644--- a/src/app/[variants]/metadata.ts+++ b/src/app/[variants]/metadata.ts@@ -1,4 +1,9 @@-import { BRANDING_LOGO_URL, BRANDING_NAME, ORG_NAME } from '@lobechat/business-const';+import {+ APPLE_APP_STORE_ID,+ BRANDING_LOGO_URL,+ BRANDING_NAME,+ ORG_NAME,+} from '@lobechat/business-const';import { OG_URL } from '@lobechat/const';import { DEFAULT_LANG } from '@/const/locale';@@ -30,6 +35,7 @@ export const generateMetadata = async (props: DynamicLayoutProps) => {icon: isDev ? '/favicon-dev.ico' : '/favicon.ico?v=1',shortcut: isDev ? '/favicon-32x32-dev.ico' : '/favicon-32x32.ico?v=1',},+ ...(APPLE_APP_STORE_ID ? { itunes: { appId: APPLE_APP_STORE_ID } } : {}),manifest: '/manifest.json',metadataBase: new URL(OFFICIAL_URL),openGraph: {diff --git a/src/app/spa-auth/[locale]/[[...path]]/seoMeta.ts b/src/app/spa-auth/[locale]/[[...path]]/seoMeta.tsindex 894e5ab4bc1..519662969dc 100644--- a/src/app/spa-auth/[locale]/[[...path]]/seoMeta.ts+++ b/src/app/spa-auth/[locale]/[[...path]]/seoMeta.ts@@ -1,4 +1,4 @@-import { BRANDING_NAME, ORG_NAME } from '@lobechat/business-const';+import { APPLE_APP_STORE_ID, BRANDING_NAME, ORG_NAME } from '@lobechat/business-const';import { OG_URL } from '@lobechat/const';import urlJoin from 'url-join';@@ -47,7 +47,7 @@ export async function buildSeoMeta(locale: string, pathname: string): Promise<stconst { title, description, canonicalPath } = await buildAuthSeoEntry(lng, pathname);const ogUrl = canonicalPath ? urlJoin(OFFICIAL_URL, canonicalPath) : OFFICIAL_URL;- return [+ const metas = [`<title>${title}</title>`,`<meta name="description" content="${description}" />`,`<meta property="og:title" content="${title}" />`,@@ -62,5 +62,11 @@ export async function buildSeoMeta(locale: string, pathname: string): Promise<st`<meta name="twitter:description" content="${description}" />`,`<meta name="twitter:image" content="${OG_URL}" />`,`<meta name="twitter:site" content="${isCustomORG ? `@${ORG_NAME}` : '@lobehub'}" />`,- ].join('\n ');+ ];++ if (APPLE_APP_STORE_ID) {+ metas.push(`<meta name="apple-itunes-app" content="app-id=${APPLE_APP_STORE_ID}" />`);+ }++ return metas.join('\n ');}diff --git a/src/app/spa/[variants]/[[...path]]/route.ts b/src/app/spa/[variants]/[[...path]]/route.tsindex e955b59c8a8..c46ef44ef28 100644--- a/src/app/spa/[variants]/[[...path]]/route.ts+++ b/src/app/spa/[variants]/[[...path]]/route.ts@@ -1,4 +1,4 @@-import { BRANDING_NAME, ORG_NAME } from '@lobechat/business-const';+import { APPLE_APP_STORE_ID, BRANDING_NAME, ORG_NAME } from '@lobechat/business-const';import { OG_URL } from '@lobechat/const';import { getServerFeatureFlagsValue } from '@/config/featureFlags';@@ -50,12 +50,12 @@ function buildClientEnv(): SPAClientEnv {};}-async function buildSeoMeta(locale: string): Promise<string> {+async function buildSeoMeta(locale: string, isMobile: boolean): Promise<string> {const { t } = await translation('metadata', locale);const title = t('chat.title', { appName: BRANDING_NAME });const description = t('chat.description', { appName: BRANDING_NAME });- return [+ const metas = [`<title>${title}</title>`,`<meta name="description" content="${description}" />`,`<meta property="og:title" content="${title}" />`,@@ -70,7 +70,13 @@ async function buildSeoMeta(locale: string): Promise<string> {`<meta name="twitter:description" content="${description}" />`,`<meta name="twitter:image" content="${OG_URL}" />`,`<meta name="twitter:site" content="${isCustomORG ? `@${ORG_NAME}` : '@lobehub'}" />`,- ].join('\n ');+ ];++ if (isMobile && APPLE_APP_STORE_ID) {+ metas.push(`<meta name="apple-itunes-app" content="app-id=${APPLE_APP_STORE_ID}" />`);+ }++ return metas.join('\n ');}export async function GET(@@ -89,7 +95,7 @@ export async function GET(};const template = await getTemplate(isMobile);- const seoMeta = await buildSeoMeta(locale);+ const seoMeta = await buildSeoMeta(locale, isMobile);return renderSpaHtml(template, { seoMeta, serverConfig: spaConfig });}