Skip to content

🤯 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.

✨ feat: enhance macOS desktop permissions and onboarding (#11016)

Innei9db8da82f611
diff --git a/apps/desktop/electron-builder.js b/apps/desktop/electron-builder.js
index 55f7b632b71..cbe86098518 100644
--- a/apps/desktop/electron-builder.js
+++ b/apps/desktop/electron-builder.js
@@ -165,12 +165,16 @@ const config = {
CFBundleURLSchemes: [protocolScheme],
},
],
+ NSAppleEventsUsageDescription:
+ 'Application needs to control System Settings to help you grant Full Disk Access automatically.',
NSCameraUsageDescription: "Application requests access to the device's camera.",
NSDocumentsFolderUsageDescription:
"Application requests access to the user's Documents folder.",
NSDownloadsFolderUsageDescription:
"Application requests access to the user's Downloads folder.",
NSMicrophoneUsageDescription: "Application requests access to the device's microphone.",
+ NSScreenCaptureUsageDescription:
+ 'Application requests access to record and analyze screen content for AI assistance.',
},
gatekeeperAssess: false,
hardenedRuntime: hasAppleCertificate,
diff --git a/apps/desktop/src/main/controllers/SystemCtr.ts b/apps/desktop/src/main/controllers/SystemCtr.ts
index e15b8ec7530..257e4b15c87 100644
--- a/apps/desktop/src/main/controllers/SystemCtr.ts
+++ b/apps/desktop/src/main/controllers/SystemCtr.ts
@@ -1,11 +1,14 @@
import { ElectronAppState, ThemeMode } from '@lobechat/electron-client-ipc';
import { app, nativeTheme, shell, systemPreferences } from 'electron';
import { macOS } from 'electron-is';
+import { spawn } from 'node:child_process';
+import path from 'node:path';
import process from 'node:process';
import { createLogger } from '@/utils/logger';
import { ControllerModule, IpcMethod } from './index';
+import fullDiskAccessAutoAddScript from './scripts/full-disk-access.applescript?raw';
const logger = createLogger('controllers:SystemCtr');
@@ -76,17 +79,114 @@ export default class SystemController extends ControllerModule {
}
@IpcMethod()
- async requestScreenAccess(): Promise<void> {
- if (!macOS()) return;
- shell.openExternal(
+ async requestScreenAccess(): Promise<boolean> {
+ if (!macOS()) return true;
+
+ // IMPORTANT:
+ // On macOS, the app may NOT appear in "Screen Recording" list until it actually
+ // requests the permission once (TCC needs to register this app).
+ // So we try to proactively request it first, then open System Settings for manual toggle.
+ // 1) Best-effort: try Electron runtime API if available (not typed in Electron 38).
+ try {
+ const status = systemPreferences.getMediaAccessStatus('screen');
+ if (status !== 'granted') {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
+ await (systemPreferences as any).askForMediaAccess?.('screen');
+ }
+ } catch (error) {
+ logger.warn('Failed to request screen recording access via systemPreferences', error);
+ }
+
+ // 2) Reliable trigger: run a one-shot getDisplayMedia in renderer to register TCC entry.
+ // This will show the OS capture picker; once the user selects/cancels, we stop tracks immediately.
+ try {
+ const status = systemPreferences.getMediaAccessStatus('screen');
+ if (status !== 'granted') {
+ const mainWindow = this.app.browserManager.getMainWindow()?.browserWindow;
+ if (mainWindow && !mainWindow.isDestroyed()) {
+ const script = `
+(() => {
+ const stop = (stream) => {
+ try { stream.getTracks().forEach((t) => t.stop()); } catch {}
+ };
+ return navigator.mediaDevices.getDisplayMedia({ video: true, audio: false })
+ .then((stream) => { stop(stream); return true; })
+ .catch(() => false);
+})()
+ `.trim();
+
+ await mainWindow.webContents.executeJavaScript(script, true);
+ }
+ }
+ } catch (error) {
+ logger.warn('Failed to request screen recording access via getDisplayMedia', error);
+ }
+
+ await shell.openExternal(
'x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture',
);
+
+ return systemPreferences.getMediaAccessStatus('screen') === 'granted';
}
@IpcMethod()
- openFullDiskAccessSettings() {
+ openFullDiskAccessSettings(payload?: { autoAdd?: boolean }) {
+ if (!macOS()) return;
+ const { autoAdd = false } = payload || {};
+
+ // NOTE:
+ // - Full Disk Access cannot be requested programmatically like microphone/screen.
+ // - On macOS 13+ (Ventura), System Preferences is replaced by System Settings,
+ // and deep links may differ. We try multiple known schemes for compatibility.
+ const candidates = [
+ // macOS 13+ (System Settings)
+ 'com.apple.settings:Privacy&path=FullDiskAccess',
+ // Older macOS (System Preferences)
+ 'x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles',
+ ];
+ if (autoAdd) this.tryAutoAddFullDiskAccess();
+
+ (async () => {
+ for (const url of candidates) {
+ try {
+ await shell.openExternal(url);
+ return;
+ } catch (error) {
+ logger.warn(`Failed to open Full Disk Access settings via ${url}`, error);
+ }
+ }
+ })();
+ }
+
+ /**
+ * Best-effort UI automation to add this app into Full Disk Access list.
+ *
+ * Limitations:
+ * - This uses AppleScript UI scripting (System Events) and may require the user to grant
+ * additional "Automation" permission (to control System Settings).
+ * - UI structure differs across macOS versions/languages; we fall back silently.
+ */
+ private tryAutoAddFullDiskAccess() {
if (!macOS()) return;
- shell.openExternal('x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles');
+
+ const exePath = app.getPath('exe');
+ // /Applications/App.app/Contents/MacOS/App -> /Applications/App.app
+ const appBundlePath = path.resolve(path.dirname(exePath), '..', '..');
+
+ // Keep the script minimal and resilient; failure should not break onboarding flow.
+ const script = fullDiskAccessAutoAddScript.trim();
+
+ try {
+ const child = spawn('osascript', ['-e', script, appBundlePath], { env: process.env });
+ child.on('error', (error) => {
+ logger.warn('Full Disk Access auto-add (osascript) failed to start', error);
+ });
+ child.on('exit', (code) => {
+ logger.debug('Full Disk Access auto-add (osascript) exited', { code });
+ });
+ } catch (error) {
+ logger.warn('Full Disk Access auto-add failed', error);
+ }
}
@IpcMethod()
diff --git a/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts b/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts
index ff7bb723956..041b3e860a5 100644
--- a/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts
+++ b/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts
@@ -44,6 +44,22 @@ vi.mock('@/utils/logger', () => ({
}),
}));
+const { spawnMock } = vi.hoisted(() => ({
+ spawnMock: vi.fn(() => {
+ const handlers = new Map<string, (...args: any[]) => void>();
+ return {
+ on: vi.fn((event: string, cb: (...args: any[]) => void) => {
+ handlers.set(event, cb);
+ return undefined;
+ }),
+ } as any;
+ }),
+}));
+
+vi.mock('node:child_process', () => ({
+ spawn: (...args: any[]) => spawnMock(...args),
+}));
+
// Mock electron
vi.mock('electron', () => ({
app: {
@@ -61,6 +77,8 @@ vi.mock('electron', () => ({
openExternal: vi.fn().mockResolvedValue(undefined),
},
systemPreferences: {
+ askForMediaAccess: vi.fn(async () => true),
+ getMediaAccessStatus: vi.fn(() => 'not-determined'),
isTrustedAccessibilityClient: vi.fn(() => true),
},
}));
@@ -73,6 +91,14 @@ vi.mock('electron-is', () => ({
// Mock browserManager
const mockBrowserManager = {
broadcastToAllWindows: vi.fn(),
+ getMainWindow: vi.fn(() => ({
+ browserWindow: {
+ isDestroyed: vi.fn(() => false),
+ webContents: {
+ executeJavaScript: vi.fn(async () => true),
+ },
+ },
+ })),
handleAppThemeChange: vi.fn(),
};
@@ -163,6 +189,66 @@ describe('SystemController', () => {
});
});
+ describe('screen recording', () => {
+ it('should request screen recording access and open System Settings on macOS', async () => {
+ const { shell, systemPreferences } = await import('electron');
+
+ const result = await invokeIpc('system.requestScreenAccess');
+
+ expect(systemPreferences.getMediaAccessStatus).toHaveBeenCalledWith('screen');
+ expect(systemPreferences.askForMediaAccess).toHaveBeenCalledWith('screen');
+ expect(mockBrowserManager.getMainWindow).toHaveBeenCalled();
+ expect(shell.openExternal).toHaveBeenCalledWith(
+ 'x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture',
+ );
+ expect(typeof result).toBe('boolean');
+ });
+
+ it('should return true on non-macOS and not open settings', async () => {
+ const { macOS } = await import('electron-is');
+ const { shell, systemPreferences } = await import('electron');
+ vi.mocked(macOS).mockReturnValue(false);
+
+ const result = await invokeIpc('system.requestScreenAccess');
+
+ expect(result).toBe(true);
+ expect(systemPreferences.askForMediaAccess).not.toHaveBeenCalled();
+ expect(shell.openExternal).not.toHaveBeenCalled();
+
+ // Reset
+ vi.mocked(macOS).mockReturnValue(true);
+ });
+ });
+
+ describe('full disk access', () => {
+ it('should try to open Full Disk Access settings with fallbacks', async () => {
+ const { shell } = await import('electron');
+ vi.mocked(shell.openExternal)
+ .mockRejectedValueOnce(new Error('fail first'))
+ .mockResolvedValueOnce(undefined);
+
+ await invokeIpc('system.openFullDiskAccessSettings');
+
+ expect(shell.openExternal).toHaveBeenCalledWith('com.apple.settings:Privacy&path=FullDiskAccess');
+ expect(shell.openExternal).toHaveBeenCalledWith(
+ 'x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles',
+ );
+ });
+
+ it('should spawn osascript when autoAdd is enabled', async () => {
+ const { shell } = await import('electron');
+ vi.mocked(shell.openExternal).mockResolvedValueOnce(undefined);
+
+ await invokeIpc('system.openFullDiskAccessSettings', { autoAdd: true });
+
+ expect(spawnMock).toHaveBeenCalledWith(
+ 'osascript',
+ expect.arrayContaining(['-e', expect.any(String), expect.any(String)]),
+ expect.objectContaining({ env: expect.any(Object) }),
+ );
+ });
+ });
+
describe('openExternalLink', () => {
it('should open external link', async () => {
const { shell } = await import('electron');
diff --git a/apps/desktop/src/main/controllers/scripts/full-disk-access.applescript b/apps/desktop/src/main/controllers/scripts/full-disk-access.applescript
new file mode 100644
index 00000000000..8161c5f1859
--- /dev/null
+++ b/apps/desktop/src/main/controllers/scripts/full-disk-access.applescript
@@ -0,0 +1,85 @@
+on run argv
+ set appBundlePath to item 1 of argv
+
+ set settingsBundleIds to {"com.apple.SystemSettings", "com.apple.systempreferences"}
+
+ -- Bring System Settings/Preferences to front (Ventura+ / older). If it doesn't exist, ignore.
+ repeat with bundleId in settingsBundleIds
+ try
+ tell application id bundleId to activate
+ exit repeat
+ end try
+ end repeat
+
+ tell application "System Events"
+ set settingsProcess to missing value
+ repeat 30 times
+ repeat with bundleId in settingsBundleIds
+ try
+ if exists (first process whose bundle identifier is bundleId) then
+ set settingsProcess to first process whose bundle identifier is bundleId
+ exit repeat
+ end if
+ end try
+ end repeat
+
+ if settingsProcess is not missing value then exit repeat
+ delay 0.2
+ end repeat
+
+ if settingsProcess is missing value then return "no-settings-process"
+
+ tell settingsProcess
+ set frontmost to true
+
+ repeat 30 times
+ if exists window 1 then exit repeat
+ delay 0.2
+ end repeat
+ if not (exists window 1) then return "no-window"
+
+ -- Best-effort: find an "add" button in the front window and click it.
+ set clickedAdd to false
+ repeat 30 times
+ try
+ repeat with b in (buttons of window 1)
+ set bDesc to ""
+ set bName to ""
+ set bTitle to ""
+ try set bDesc to description of b end try
+ try set bName to name of b end try
+ try set bTitle to title of b end try
+
+ if (bDesc is "Add") or (bTitle is "Add") or (bName is "+") or (bTitle is "+") then
+ click b
+ set clickedAdd to true
+ exit repeat
+ end if
+ end repeat
+ end try
+
+ if clickedAdd is true then exit repeat
+ delay 0.2
+ end repeat
+
+ if clickedAdd is false then return "no-add-button"
+
+ -- Wait for open panel / sheet
+ repeat 30 times
+ if exists sheet 1 of window 1 then exit repeat
+ delay 0.2
+ end repeat
+ if not (exists sheet 1 of window 1) then return "no-sheet"
+
+ -- Open "Go to the folder" and input the app bundle path, then confirm.
+ keystroke "G" using {command down, shift down}
+ delay 0.3
+ keystroke appBundlePath
+ key code 36
+ delay 0.6
+ -- Confirm "Open" in the panel (Enter usually triggers default)
+ key code 36
+ return "ok"
+ end tell
+ end tell
+end run
diff --git a/locales/en-US/desktop-onboarding.json b/locales/en-US/desktop-onboarding.json
index f8ffb6f8da7..553e2c5c8bf 100644
--- a/locales/en-US/desktop-onboarding.json
+++ b/locales/en-US/desktop-onboarding.json
@@ -1,4 +1,8 @@
{
+ "authResult.failed.desc": "Please try again or switch to a different login method",
+ "authResult.failed.title": "Authorization Failed",
+ "authResult.success.desc": "Please click the Start button below to continue using LobeHub Desktop",
+ "authResult.success.title": "Authorization Successful",
"navigation.next": "Continue",
"screen1.description": "AI-powered productivity platform with intelligent agents",
"screen1.navigation.next": "Start Setting Up",
diff --git a/locales/zh-CN/desktop-onboarding.json b/locales/zh-CN/desktop-onboarding.json
index 7a33a7f4d37..a08b13b1d92 100644
--- a/locales/zh-CN/desktop-onboarding.json
+++ b/locales/zh-CN/desktop-onboarding.json
@@ -1,4 +1,8 @@
{
+ "authResult.failed.desc": "请重试,或切换其他登录方式",
+ "authResult.failed.title": "授权失败",
+ "authResult.success.desc": "点击下方「开始」继续使用 LobeHub 桌面端",
+ "authResult.success.title": "授权成功",
"navigation.next": "继续",
"screen1.description": "AI 驱动的生产力平台,内置智能助理",
"screen1.navigation.next": "开始设置",
diff --git a/src/app/[variants]/(main)/_layout/DesktopLayoutContainer/style.ts b/src/app/[variants]/(main)/_layout/DesktopLayoutContainer/style.ts
index 1fae59bb32d..2ea59464777 100644
--- a/src/app/[variants]/(main)/_layout/DesktopLayoutContainer/style.ts
+++ b/src/app/[variants]/(main)/_layout/DesktopLayoutContainer/style.ts
@@ -1,5 +1,7 @@
import { createStaticStyles } from 'antd-style';
+import { isDesktop } from '@/const/version';
+
export const styles = createStaticStyles(({ css, cssVar }) => ({
// 内层容器
innerContainer: css`
@@ -22,6 +24,6 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
padding-block-start: var(--container-padding-top, 8px);
padding-inline-start: var(--container-padding-left, 8px);
- background: ${cssVar.colorBgLayout};
+ background: ${isDesktop ? 'transparent' : cssVar.colorBgLayout};
`,
}));
diff --git a/src/features/DesktopOnboarding/OnboardingContainer.tsx b/src/features/DesktopOnboarding/OnboardingContainer.tsx
index bc43d5ef524..f8c199b8ac9 100644
--- a/src/features/DesktopOnboarding/OnboardingContainer.tsx
+++ b/src/features/DesktopOnboarding/OnboardingContainer.tsx
@@ -6,6 +6,7 @@ import { AnimatePresence, motion } from 'motion/react';
import React, { useCallback, useEffect, useState } from 'react';
import { TITLE_BAR_HEIGHT } from '@/features/ElectronTitlebar';
+import { electronSystemService } from '@/services/electron/system';
import { electronStylish } from '@/styles/electron';
import { Navigation } from './Navigation';
@@ -75,7 +76,14 @@ interface OnboardingContainerProps {
onComplete: () => void;
}
-const screens = [Screen1, Screen2, Screen3, Screen4, Screen5];
+const getIsMacFromNavigator = () => {
+ if (typeof navigator === 'undefined') return true;
+ // Electron (and most browsers) expose "MacIntel" for macOS.
+ return /Mac/i.test(navigator.platform);
+};
+
+const macScreens = [Screen1, Screen2, Screen3, Screen4, Screen5];
+const nonMacScreens = [Screen1, Screen2, Screen4, Screen5];
// 统一的屏幕配置接口
interface ScreenConfig {
@@ -100,20 +108,24 @@ interface ScreenConfig {
}
export const OnboardingContainer: React.FC<OnboardingContainerProps> = ({ onComplete }) => {
+ const [isMac, setIsMac] = useState(getIsMacFromNavigator);
+ const screens = isMac ? macScreens : nonMacScreens;
+
// 从 URL hash 获取初始屏幕索引
- const getInitialStep = () => {
- const hash = window.location.hash;
- const match = hash.match(/^#(\d+)$/);
- if (match) {
- const step = parseInt(match[1], 10) - 1; // URL 使用 1-4,内部使用 0-3
- if (step >= 0 && step < screens.length) {
- return step;
+ const getInitialStep = useCallback(
+ (totalSteps: number) => {
+ const hash = window.location.hash;
+ const match = hash.match(/^#(\d+)$/);
+ if (match) {
+ const step = parseInt(match[1], 10) - 1; // URL 使用 1-based,内部使用 0-based
+ if (step >= 0 && step < totalSteps) return step;
}
- }
- return 0; // 默认第一屏
- };
+ return 0; // 默认第一屏
+ },
+ [],
+ );
- const [currentStep, setCurrentStep] = useState(getInitialStep());
+ const [currentStep, setCurrentStep] = useState(() => getInitialStep(screens.length));
const [screenConfig, setScreenConfig] = useState<ScreenConfig>({
background: undefined,
navigation: {},
@@ -122,6 +134,29 @@ export const OnboardingContainer: React.FC<OnboardingContainerProps> = ({ onComp
const [previousStep, setPreviousStep] = useState(currentStep);
const totalSteps = screens.length;
+ // 检测平台:非 macOS 直接跳过 Screen3(权限页)
+ useEffect(() => {
+ let mounted = true;
+ const detectPlatform = async () => {
+ try {
+ const state = await electronSystemService.getAppState();
+ if (!mounted) return;
+ setIsMac(state.platform === 'darwin');
+ } catch {
+ // Fallback: keep navigator-based decision
+ }
+ };
+ void detectPlatform();
+ return () => {
+ mounted = false;
+ };
+ }, []);
+
+ // 当总步数改变时(例如非 macOS 过滤掉 Screen3),避免当前 step 越界
+ useEffect(() => {
+ setCurrentStep((step) => Math.min(step, Math.max(0, totalSteps - 1)));
+ }, [totalSteps]);
+
// 监听 hash 变化
useEffect(() => {
const handleHashChange = () => {
@@ -129,7 +164,7 @@ export const OnboardingContainer: React.FC<OnboardingContainerProps> = ({ onComp
const match = hash.match(/^#(\d+)$/);
if (match) {
const step = parseInt(match[1], 10) - 1;
- if (step >= 0 && step < screens.length && step !== currentStep) {
+ if (step >= 0 && step < totalSteps && step !== currentStep) {
setCurrentStep(step);
}
}
@@ -137,7 +172,7 @@ export const OnboardingContainer: React.FC<OnboardingContainerProps> = ({ onComp
window.addEventListener('hashchange', handleHashChange);
return () => window.removeEventListener('hashchange', handleHashChange);
- }, [currentStep]);
+ }, [currentStep, totalSteps]);
// 当 currentStep 改变时的处理
useEffect(() => {
diff --git a/src/features/DesktopOnboarding/common/AuthResult.tsx b/src/features/DesktopOnboarding/common/AuthResult.tsx
index 78a2cf09bbe..d9dcf14a424 100644
--- a/src/features/DesktopOnboarding/common/AuthResult.tsx
+++ b/src/features/DesktopOnboarding/common/AuthResult.tsx
@@ -1,6 +1,7 @@
import { createStaticStyles, cx } from 'antd-style';
import { Check, X } from 'lucide-react';
import { motion } from 'motion/react';
+import { useTranslation } from 'react-i18next';
import { LogoBrand } from './LogoBrand';
@@ -138,10 +139,10 @@ interface AuthResultProps {
export const AuthResult = ({ success, title, description, animated = true }: AuthResultProps) => {
const styles = authResultStyles;
- const defaultTitle = success ? 'Authorization Successful' : 'Authorization Failed';
- const defaultDescription = success
- ? 'Please click the Start button below to continue using LobeHub Desktop'
- : 'Please try again or switch to a different login method';
+ const { t } = useTranslation('desktop-onboarding');
+
+ const defaultTitle = t(success ? 'authResult.success.title' : 'authResult.failed.title');
+ const defaultDescription = t(success ? 'authResult.success.desc' : 'authResult.failed.desc');
const content = (
<>
diff --git a/src/features/DesktopOnboarding/screens/Screen3.tsx b/src/features/DesktopOnboarding/screens/Screen3.tsx
index 61e550f3899..579b10b9dff 100644
--- a/src/features/DesktopOnboarding/screens/Screen3.tsx
+++ b/src/features/DesktopOnboarding/screens/Screen3.tsx
@@ -289,7 +289,7 @@ export const Screen3 = ({ onScreenConfigChange }: Screen3Props) => {
break;
}
case 2: {
- await ipc.system.openFullDiskAccessSettings();
+ await ipc.system.openFullDiskAccessSettings({ autoAdd: true });
break;
}
case 3: {
diff --git a/src/features/DesktopOnboarding/screens/Screen5.tsx b/src/features/DesktopOnboarding/screens/Screen5.tsx
index 8765789a9e0..d0dba8f9fd7 100644
--- a/src/features/DesktopOnboarding/screens/Screen5.tsx
+++ b/src/features/DesktopOnboarding/screens/Screen5.tsx
@@ -53,7 +53,7 @@ const screen4Styles = createStaticStyles(({ css, cssVar }) => ({
border-radius: ${cssVar.borderRadius};
font-size: ${cssVar.fontSize};
- color: ${cssVar.colorTextBase};
+ color: #fff;
background: rgba(255, 255, 255, 5%);
outline: none;
@@ -692,6 +692,12 @@ export const Screen5 = ({ onScreenConfigChange }: Screen5Props) => {
initial={{ opacity: 0, y: 30 }}
key="selfhost-input"
onChange={(e) => setEndpoint(e.target.value)}
+ onContextMenu={async (e) => {
+ if (!isDesktop) return;
+ e.preventDefault();
+ const { electronSystemService } = await import('@/services/electron/system');
+ await electronSystemService.showContextMenu('edit');
+ }}
placeholder={t('screen5.selfhost.endpointPlaceholder')}
transition={{ delay: 0.5, duration: 0.5 }}
type="text"
diff --git a/src/features/ElectronTitlebar/hooks/useWatchThemeUpdate.ts b/src/features/ElectronTitlebar/hooks/useWatchThemeUpdate.ts
index 10640899102..c1af971c887 100644
--- a/src/features/ElectronTitlebar/hooks/useWatchThemeUpdate.ts
+++ b/src/features/ElectronTitlebar/hooks/useWatchThemeUpdate.ts
@@ -41,8 +41,10 @@ export const useWatchThemeUpdate = () => {
if (!isAppStateInit || !isMac) return;
document.documentElement.style.background = 'none';
- // https://x.com/alanblogsooo/status/1939208908993896684
+ const lobeApp = document.querySelector('#lobe-ui-theme-app');
+ if (!lobeApp) return;
+ const hexColor = getComputedStyle(lobeApp).getPropertyValue('--ant-color-bg-layout');
- document.body.style.background = `color-mix(in srgb, ${cssVar.colorBgLayout} 66%, transparent)`;
+ document.body.style.background = `color-mix(in srgb, ${hexColor} 86%, transparent)`;
}, [systemAppearance, isAppStateInit, isMac]);
};
diff --git a/src/locales/default/desktop-onboarding.ts b/src/locales/default/desktop-onboarding.ts
index c040ed03acb..c37c47c8030 100644
--- a/src/locales/default/desktop-onboarding.ts
+++ b/src/locales/default/desktop-onboarding.ts
@@ -1,4 +1,10 @@
export default {
+ 'authResult.failed.desc': 'Please try again or switch to a different login method',
+ 'authResult.failed.title': 'Authorization Failed',
+ 'authResult.success.desc':
+ 'Please click the Start button below to continue using LobeHub Desktop',
+ 'authResult.success.title': 'Authorization Successful',
+
'navigation.next': 'Continue',
'screen1.description': 'AI-powered productivity platform with intelligent agents',
diff --git a/src/utils/i18n/loadI18nNamespaceModule.ts b/src/utils/i18n/loadI18nNamespaceModule.ts
index 43354dc4143..1981387fb64 100644
--- a/src/utils/i18n/loadI18nNamespaceModule.ts
+++ b/src/utils/i18n/loadI18nNamespaceModule.ts
@@ -10,13 +10,13 @@ export interface LoadI18nNamespaceModuleParams {
export const loadI18nNamespaceModule = async (params: LoadI18nNamespaceModuleParams) => {
const { defaultLang, normalizeLocale, lng, ns } = params;
- // Desktop-only namespaces should never be loaded in web runtime.
- // This is a defensive guard: the desktop router already prevents reaching those pages on web.
- if (!isDesktop && ns === 'desktop-onboarding') return { default: {} };
-
if (lng === defaultLang) return import(`@/locales/default/${ns}`);
- return import(`@/../locales/${normalizeLocale(lng)}/${ns}.json`);
+ try {
+ return import(`@/../locales/${normalizeLocale(lng)}/${ns}.json`);
+ } catch (error) {
+ return import(`@/locales/default/${ns}`);
+ }
};
export interface LoadI18nNamespaceModuleWithFallbackParams extends LoadI18nNamespaceModuleParams {