feat: Add browser-only launch mode for Kaspersky bypass

- Add `ui.launchBrowser` config option to launch browser directly
- Fix sidecar_manager to support packaged mode paths
- Set BROWSER_MODE env var for backend sidecar management
- Skip Electron window when browser-only mode enabled

Usage: Set `"ui": { "launchBrowser": true }` in config.json
to bypass Kaspersky blocking by using system browser instead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-22 18:15:45 +08:00
parent 771655e03e
commit fd203ef771
3 changed files with 93 additions and 10 deletions

View File

@@ -2,6 +2,9 @@
"apiBaseUrl": "http://localhost:8000/api",
"uploadTimeout": 600000,
"appTitle": "Meeting Assistant",
"ui": {
"launchBrowser": false
},
"whisper": {
"model": "medium",
"device": "cpu",

View File

@@ -477,6 +477,51 @@ app.whenReady().then(async () => {
// Load configuration first
loadConfig();
const backendConfig = appConfig?.backend || {};
const uiConfig = appConfig?.ui || {};
const launchBrowser = uiConfig.launchBrowser === true;
// Browser-only mode: start backend and open browser, no Electron UI
if (launchBrowser && backendConfig.embedded) {
console.log("=== Browser-Only Mode ===");
// Set BROWSER_MODE so backend manages sidecar
process.env.BROWSER_MODE = "true";
// Start backend sidecar
startBackendSidecar();
// Wait for backend to be ready
const ready = await waitForBackendReady();
if (!ready) {
const { dialog } = require("electron");
dialog.showErrorBox(
"Backend Startup Failed",
"後端服務啟動失敗。請檢查日誌以獲取詳細信息。"
);
app.quit();
return;
}
// Open browser to login page
const host = backendConfig.host || "127.0.0.1";
const port = backendConfig.port || 8000;
const loginUrl = `http://${host}:${port}/login`;
console.log(`Opening browser: ${loginUrl}`);
await shell.openExternal(loginUrl);
// Keep app running in background
// On macOS, we need to handle dock visibility
if (process.platform === "darwin") {
app.dock.hide();
}
console.log("Backend running. Close this window or press Ctrl+C to stop.");
return;
}
// Standard Electron mode
// Grant microphone permission automatically
session.defaultSession.setPermissionRequestHandler((webContents, permission, callback, details) => {
console.log(`Permission request: ${permission}`, details);
@@ -512,7 +557,6 @@ app.whenReady().then(async () => {
startBackendSidecar();
// Wait for backend to be ready before creating window
const backendConfig = appConfig?.backend || {};
if (backendConfig.embedded) {
const ready = await waitForBackendReady();
if (!ready) {