mirror of
https://github.com/dream-pep/koring-launcher.git
synced 2026-09-12 05:45:18 +08:00
Replace the Tauri/sidecar architecture with an Electron main process. Adds an electron/ directory (main, preload, handlers, core integrations for @xmcl/*), electron-builder.yml, TypeScript electron config and declarations, and updated IPC utilities (ipc.ts) so frontend uses ipcRenderer/ipcMain. Removes Tauri sidecar and src-tauri artifacts, deletes sidecar sources and keys, updates .gitignore, VSCode recommendations, package scripts and icons, and updates documentation (README, AGENTS, DEV) and frontend stores/apis to reflect the Electron-based architecture and config/auth persistence changes.
71 lines
2.1 KiB
JavaScript
71 lines
2.1 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.registerSystemHandlers = registerSystemHandlers;
|
|
const electron_1 = __importDefault(require("electron"));
|
|
const child_process_1 = require("child_process");
|
|
const { ipcMain, app } = electron_1.default;
|
|
function getBiosId() {
|
|
if (process.platform !== 'win32')
|
|
return 'N/A (non-Windows)';
|
|
try {
|
|
const output = (0, child_process_1.execSync)('powershell -NoProfile -Command "(Get-CimInstance Win32_BIOS).SerialNumber"', {
|
|
encoding: 'utf-8',
|
|
timeout: 5000,
|
|
});
|
|
return output.trim() || 'Unknown';
|
|
}
|
|
catch {
|
|
return 'Unknown';
|
|
}
|
|
}
|
|
function getOsVersion() {
|
|
if (process.platform !== 'win32')
|
|
return 'N/A (non-Windows)';
|
|
try {
|
|
const output = (0, child_process_1.execSync)('powershell -NoProfile -Command "[System.Environment]::OSVersion.VersionString"', {
|
|
encoding: 'utf-8',
|
|
timeout: 5000,
|
|
});
|
|
return output.trim() || 'Unknown';
|
|
}
|
|
catch {
|
|
return 'Unknown';
|
|
}
|
|
}
|
|
function getOsName() {
|
|
if (process.platform !== 'win32')
|
|
return 'N/A (non-Windows)';
|
|
try {
|
|
const output = (0, child_process_1.execSync)('powershell -NoProfile -Command "(Get-CimInstance Win32_OperatingSystem).Caption"', {
|
|
encoding: 'utf-8',
|
|
timeout: 5000,
|
|
});
|
|
return output.trim() || 'Unknown';
|
|
}
|
|
catch {
|
|
return 'Unknown';
|
|
}
|
|
}
|
|
function registerSystemHandlers() {
|
|
ipcMain.handle('system:info', () => {
|
|
try {
|
|
return {
|
|
success: true,
|
|
data: {
|
|
app_version: app.getVersion(),
|
|
bios_id: getBiosId(),
|
|
os_version: getOsVersion(),
|
|
os_name: getOsName(),
|
|
},
|
|
error: null,
|
|
};
|
|
}
|
|
catch (e) {
|
|
return { success: false, data: null, error: String(e) };
|
|
}
|
|
});
|
|
}
|