mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
fix(ui): handle headless execution in credits and upgrade dialogs (#21850)
This commit is contained in:
@@ -44,6 +44,7 @@ vi.mock('../telemetry/index.js', () => ({
|
||||
}));
|
||||
vi.mock('../utils/secure-browser-launcher.js', () => ({
|
||||
openBrowserSecurely: vi.fn(),
|
||||
shouldLaunchBrowser: vi.fn().mockReturnValue(true),
|
||||
}));
|
||||
|
||||
// Mock debugLogger to prevent console pollution and allow spying
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
|
||||
import type { Config } from '../config/config.js';
|
||||
import { AuthType } from '../core/contentGenerator.js';
|
||||
import { openBrowserSecurely } from '../utils/secure-browser-launcher.js';
|
||||
import {
|
||||
openBrowserSecurely,
|
||||
shouldLaunchBrowser,
|
||||
} from '../utils/secure-browser-launcher.js';
|
||||
import { debugLogger } from '../utils/debugLogger.js';
|
||||
import { getErrorMessage } from '../utils/errors.js';
|
||||
import type { FallbackIntent, FallbackRecommendation } from './types.js';
|
||||
@@ -112,6 +115,12 @@ export async function handleFallback(
|
||||
}
|
||||
|
||||
async function handleUpgrade() {
|
||||
if (!shouldLaunchBrowser()) {
|
||||
debugLogger.log(
|
||||
`Cannot open browser in this environment. Please visit: ${UPGRADE_URL_PAGE}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await openBrowserSecurely(UPGRADE_URL_PAGE);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user