diff --git a/.env.beta b/.env.beta index 8ec26a1..eb23526 100644 --- a/.env.beta +++ b/.env.beta @@ -1,7 +1,2 @@ VITE_BUILD_MODE=beta VITE_APP_ICON=/beta.png - -VITE_START_POP=true -VITE_START_POP_TITLE="你正在使用 UI 预览版本" -VITE_START_POP_INFO="此版本是专门用于进行检测是否有 UI 问题的版本,因此功能将会缺失" -VITE_START_POP_BOUTTON="我已了解" \ No newline at end of file diff --git a/.env.development b/.env.development index aed8c10..468d727 100644 --- a/.env.development +++ b/.env.development @@ -1,7 +1,2 @@ VITE_BUILD_MODE=dev VITE_APP_ICON=/dev.png - -VITE_START_POP=true -VITE_START_POP_TITLE="你正在使用 UI 预览版本" -VITE_START_POP_INFO="此版本是专门用于进行检测是否有UI问题的版本,因此功能将会缺失" -VITE_START_POP_BOUTTON="我已了解" \ No newline at end of file diff --git a/.env.production b/.env.production index 1be13d2..ce78263 100644 --- a/.env.production +++ b/.env.production @@ -1,7 +1,2 @@ VITE_BUILD_MODE=run VITE_APP_ICON=/run.png - -VITE_START_POP=false -VITE_START_POP_TITLE="你正在使用 UI 预览版本" -VITE_START_POP_INFO="此版本是专门用于进行检测是否有UI问题的版本,因此功能将会缺失" -VITE_START_POP_BOUTTON="我已了解" \ No newline at end of file diff --git a/CRASH_MONITOR_PLAN.md b/CRASH_MONITOR_PLAN.md deleted file mode 100644 index 1805e90..0000000 --- a/CRASH_MONITOR_PLAN.md +++ /dev/null @@ -1,144 +0,0 @@ -# Crash Monitor Implementation Plan - -## 1. Architecture Overview - -``` -┌─────────────────────────────────────────────────────────┐ -│ Main Process │ -│ ┌──────────────────────────────────────────────────┐ │ -│ │ Crash Logger (file-based, survives crashes) │ │ -│ │ - ipcMain.on('renderer-error') → write to file │ │ -│ │ - process.on('uncaughtException') → write to file │ │ -│ │ - app.on('render-process-gone') → write to file │ │ -│ │ - app.on('child-process-gone') → write to file │ │ -│ └──────────────────────────────────────────────────┘ │ -│ ┌──────────────────────────────┐ │ -│ │ UtilityProcess (monitor) │ ← isolated process │ -│ │ - Watches crash log file │ survives window │ -│ │ - Sends crash events via │ crashes │ -│ │ MessagePort to main │ │ -│ └──────────────────────────────┘ │ -│ ┌──────────────────────────────┐ │ -│ │ Crash Monitor Window │ ← separate window │ -│ │ - Shows crash dialogs │ custom UI │ -│ │ - Log viewer window │ │ -│ └──────────────────────────────┘ │ -└─────────────────────────────────────────────────────────┘ - ↕ IPC (contextBridge) -┌─────────────────────────────────────────────────────────┐ -│ Renderer (Main Window) │ -│ - window.onerror → ipcRenderer.send('renderer-error') │ -│ - unhandledrejection → ipcRenderer.send(...) │ -│ - webContents 'render-process-gone' → recover │ -└─────────────────────────────────────────────────────────┘ -``` - -## 2. Implementation Steps - -### Step 1: Create Crash Logger Module -**File:** `electron/core/crash-logger.ts` -- Initialize crash log path (`koring-crash.log` next to executable) -- Write crash events synchronously to survive crashes -- Buffer recent events for breadcrumb trail -- Log rotation (keep last 1000 lines) - -### Step 2: Create Crash Monitor Window -**File:** `electron/handlers/crash-monitor.ts` -- Separate BrowserWindow (hidden by default) -- Listens for crash events from main process -- Shows custom crash dialog UI -- Can be opened from developer tools - -### Step 3: Create Log Viewer Window -**File:** `electron/handlers/log-viewer.ts` -- Separate BrowserWindow for viewing logs -- Real-time log streaming via IPC -- Filter by log level (error, warn, info) -- Export logs functionality - -### Step 4: Create Crash Dialog UI -**File:** `src/components/crash/CrashDialog.tsx` -- Custom styled crash dialog -- Shows error details, stack trace -- Options: Restart, View Logs, Close -- Uses existing UI components (shadcn/ui) - -### Step 5: Create Log Viewer UI -**File:** `src/components/crash/LogViewer.tsx` -- Log list with syntax highlighting -- Search/filter functionality -- Real-time updates - -### Step 6: Update Main Process -**File:** `electron/main.ts` -- Initialize crash logger early -- Set up crash event handlers -- Create crash monitor window - -### Step 7: Update Preload Script -**File:** `electron/preload.ts` -- Add renderer error capture -- Expose crash-related IPC methods - -## 3. Key Features - -1. **Crash Detection:** - - Renderer crashes (`render-process-gone`) - - Main process errors (`uncaughtException`, `unhandledRejection`) - - GPU/utility crashes (`child-process-gone`) - - Unresponsive detection (`unresponsive` event) - -2. **Crash Dialog:** - - Custom styled UI matching launcher theme - - Error message and stack trace display - - One-click restart option - - View logs option - -3. **Log Viewer:** - - Can be opened from developer tools - - Real-time log streaming - - Search and filter capabilities - - Export functionality - -4. **Process Isolation:** - - Crash monitor runs in separate window - - Main window crashes don't affect monitor - - Monitor can restart main window - -## 4. Files to Create/Modify - -**New Files:** -- `electron/core/crash-logger.ts` -- `electron/handlers/crash-monitor.ts` -- `electron/handlers/log-viewer.ts` -- `src/components/crash/CrashDialog.tsx` -- `src/components/crash/LogViewer.tsx` -- `src/pages/crash/index.tsx` - -**Modified Files:** -- `electron/main.ts` - Add crash monitoring initialization -- `electron/preload.ts` - Add error capture and IPC methods -- `src/types/electron.d.ts` - Add new IPC method types - -## 5. UI Design - -The crash dialog and log viewer will use the existing design system: -- Glass effects with backdrop-filter -- Dark theme compatible -- Consistent spacing and typography -- Uses shadcn/ui components where appropriate - -## 6. Testing Plan - -1. Test crash detection by triggering intentional errors -2. Verify crash dialog appears correctly -3. Test log viewer functionality -4. Verify main window can be restarted from crash dialog -5. Test log export functionality - -## 7. Questions for User - -1. What specific crash scenarios should we prioritize? -2. Do you want the log viewer always accessible or only in dev mode? -3. Should crash reports be sent to a server or just stored locally? -4. Any specific UI preferences for the crash dialog beyond the existing design system? diff --git a/Koring.yml b/Koring.yml new file mode 100644 index 0000000..055ce30 --- /dev/null +++ b/Koring.yml @@ -0,0 +1 @@ +oobe: false diff --git a/crash.html b/crash.html new file mode 100644 index 0000000..930ac6c --- /dev/null +++ b/crash.html @@ -0,0 +1,12 @@ + + +
+ + +{description}
++ 我们已记录此错误,接下来您想做什么? +
++ 您可能是在一些奇怪的地方触发了内容导致崩溃,我们已准备好日志,你可以直接复制将其发送给支持人员,你也可以点击下方的重启按钮再次启动,如果还是不行您可以点击强还原配置按钮进行还原。(注意,还原只会清除启动器数据,并不会影响实例,请放心使用) +
+ + {/* 按钮组 */} +测试崩溃检测、崩溃弹窗与恢复功能
+ +
+ 调用 forcefullyCrashRenderer() 强制销毁渲染进程,触发 render-process-gone 事件,崩溃弹窗应自动弹出。
+
+ 不会真正崩溃,直接弹出崩溃弹窗 UI,用于验证窗口样式、按钮功能是否正常。 +
+ +
+ 读取 koring-crash.log 文件内容,可复制发送给开发人员。
+
+ {log}
+
+ )}
+
+ 删除 Koring.yml、
+ koring-auth.json 和背景缓存。
+ 不会影响实例数据。
+
{status}
+ )} +- 这是 OOBE(开箱体验)页面。在这里可以引导用户完成初始设置。 -
+export function Oobe() { + const navigate = useRouteStore((s) => s.navigate); + return ( +您需要同意才可以继续
+
+ {text}
+
+ 您需要同意才可以继续
+
+ {text}
+
+ + 您正在使用测试版本,它并不稳定,不建议用于正式游戏体验,具体内容请以发行版本为准。 +
+ )} + + {/* 更新内容 */} +
+ {changelog}
+
+