mirror of
https://github.com/dream-pep/koring-launcher.git
synced 2026-09-12 05:45:18 +08:00
Introduce crash monitoring and an OOBE onboarding flow. Adds a crash logger (koring-crash.log), crash-monitor handler/window, preload-crash bridge, crash UI (crash.html, src/crash.tsx, pages/crash) and a debug page. Main process now sets up crash listeners, startup checks (first-launch, .minecraft), and a config reset/factory-reset that removes Koring.yml, koring-auth.json and background cache and can relaunch the app. Exposes config preloading to renderer, adds OOBE pages/layout, confirm dialog store/UI, trims Silk renderer settings, bumps version to 1.0.1 and adds motion dependency, and registers crash.html in Vite. Various related type and config updates included.
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import electron from 'electron';
|
|
const { ipcMain, app } = electron;
|
|
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
import { loadConfig, saveConfig, type AppConfig, configPath } from '../config';
|
|
|
|
export function registerConfigHandlers() {
|
|
ipcMain.handle('config:get', () => {
|
|
try {
|
|
const config = loadConfig();
|
|
return { success: true, data: config, error: null };
|
|
} catch (e: unknown) {
|
|
return { success: false, data: null, error: String(e) };
|
|
}
|
|
});
|
|
|
|
ipcMain.handle('config:save', (_event, config: AppConfig) => {
|
|
try {
|
|
saveConfig(config);
|
|
return { success: true, data: null, error: null };
|
|
} catch (e: unknown) {
|
|
return { success: false, data: null, error: String(e) };
|
|
}
|
|
});
|
|
|
|
ipcMain.handle('config:reset', () => {
|
|
try {
|
|
const filePath = configPath();
|
|
if (fs.existsSync(filePath)) {
|
|
fs.unlinkSync(filePath);
|
|
}
|
|
app.relaunch();
|
|
app.exit(0);
|
|
return { success: true, data: null, error: null };
|
|
} catch (e: unknown) {
|
|
return { success: false, data: null, error: String(e) };
|
|
}
|
|
});
|
|
}
|