feat: back-to-search button, retry site search, update checker, nsis installer

This commit is contained in:
2026-03-14 14:25:52 +03:00
parent 14da54f204
commit 6c314b614d
6 changed files with 150 additions and 11 deletions

25
main.js
View File

@@ -157,6 +157,27 @@ async function loadExtensions() {
}
}
// --- Updates ---
async function checkForUpdates() {
try {
const res = await getDirectSession().fetch(
'https://gitea.esh-service.ru/api/v1/repos/public/ESH-Media/releases/latest'
);
if (!res.ok) return;
const data = await res.json();
const latest = (data.tag_name || '').replace(/^v/, '');
const current = app.getVersion();
if (latest && latest !== current) {
mainWindow.webContents.send('update-available', {
version: latest,
url: data.html_url,
assets: (data.assets || []).map(a => ({ name: a.name, url: a.browser_download_url })),
});
}
} catch (_) {}
}
// --- Window ---
async function createWindow() {
@@ -862,6 +883,10 @@ app.whenReady().then(async () => {
getDirectSession();
await loadExtensions();
await createWindow();
mainWindow.webContents.once('did-finish-load', () => {
setTimeout(checkForUpdates, 4000);
});
});
app.on('window-all-closed', () => {