import { BrowserWindow } from 'electron'; const UPDATE_HTML = `

Krunker Civilian Client

Checking for updates...
`; const UPDATE_DATA_URL = 'data:text/html;charset=utf-8,' + encodeURIComponent(UPDATE_HTML); export function showUpdateWindow(): { window: BrowserWindow; sendProgress: (message: string, percent?: number) => void } { const win = new BrowserWindow({ width: 450, height: 180, resizable: false, alwaysOnTop: true, backgroundColor: '#1a1a2e', autoHideMenuBar: true, title: 'Krunker Civilian Client - Update', webPreferences: { nodeIntegration: false, contextIsolation: true, sandbox: true, }, }); win.removeMenu(); win.loadURL(UPDATE_DATA_URL); function sendProgress(message: string, percent?: number): void { if (!win.isDestroyed()) { win.webContents.executeJavaScript(`(() => { const s = document.getElementById('status'); const p = document.getElementById('progressBar'); if (s) s.textContent = ${JSON.stringify(message)}; if (p && typeof ${JSON.stringify(percent)} === 'number') p.style.width = ${JSON.stringify(percent)} + '%'; })()`).catch(() => {}); } } return { window: win, sendProgress }; }