Init
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
provider: generic
|
||||||
|
url: https://gitea.tars.tools/brajan_aldana/upda
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
const { app, BrowserWindow, dialog } = require('electron');
|
||||||
|
const { autoUpdater } = require('electron-updater');
|
||||||
|
|
||||||
|
// Configurar para que no descargue automáticamente, respetando tu lógica manual
|
||||||
|
autoUpdater.autoDownload = false;
|
||||||
|
|
||||||
|
// Habilitar actualizaciones en desarrollo (requiere dev-app-update.yml)
|
||||||
|
if (!app.isPackaged) {
|
||||||
|
autoUpdater.forceDevUpdateConfig = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// const server = 'https://tuservidor.com'; // La URL de tu repositorio en Gitea
|
||||||
|
// const feed = `${server}/path/to/your/updates/latest`;
|
||||||
|
|
||||||
|
let mainWindow;
|
||||||
|
|
||||||
|
app.on('ready', () => {
|
||||||
|
mainWindow = new BrowserWindow({ width: 800, height: 600 });
|
||||||
|
|
||||||
|
mainWindow.loadURL('https://google.com');
|
||||||
|
|
||||||
|
// autoUpdater.setFeedURL(feed); // electron-updater lee la configuración de 'publish' en package.json
|
||||||
|
autoUpdater.checkForUpdates();
|
||||||
|
});
|
||||||
|
|
||||||
|
autoUpdater.on('update-available', () => {
|
||||||
|
const choice = dialog.showMessageBoxSync(mainWindow, {
|
||||||
|
type: 'question',
|
||||||
|
buttons: ['Actualizar', 'Más tarde'],
|
||||||
|
title: 'Actualización disponible',
|
||||||
|
message: 'Hay una nueva versión disponible. ¿Deseas actualizar ahora?'
|
||||||
|
});
|
||||||
|
|
||||||
|
if (choice === 0) { // Si el usuario elige "Actualizar"
|
||||||
|
autoUpdater.downloadUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
autoUpdater.on('update-downloaded', () => {
|
||||||
|
const choice = dialog.showMessageBoxSync(mainWindow, {
|
||||||
|
type: 'question',
|
||||||
|
buttons: ['Reiniciar', 'Más tarde'],
|
||||||
|
title: 'Actualizar disponible',
|
||||||
|
message: 'La actualización se ha descargado. ¿Deseas reiniciar para instalarla ahora?'
|
||||||
|
});
|
||||||
|
|
||||||
|
if (choice === 0) { // Si el usuario elige "Reiniciar"
|
||||||
|
autoUpdater.quitAndInstall();
|
||||||
|
}
|
||||||
|
});
|
||||||
Generated
+4469
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "mi-app",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "App de ejemplo con electron-updater y Gitea",
|
||||||
|
"main": "main.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "electron .",
|
||||||
|
"build": "electron-builder"
|
||||||
|
},
|
||||||
|
"author": "yo",
|
||||||
|
"dependencies": {
|
||||||
|
"electron-updater": "^6.1.7"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"electron": "^32.2.0",
|
||||||
|
"electron-builder": "^25.1.8"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"appId": "com.miapp.ejemplo",
|
||||||
|
"productName": "Mi App",
|
||||||
|
"win": {
|
||||||
|
"target": "nsis"
|
||||||
|
},
|
||||||
|
"nsis": {
|
||||||
|
"oneClick": false,
|
||||||
|
"allowToChangeInstallationDirectory": true
|
||||||
|
},
|
||||||
|
"publish": [
|
||||||
|
{
|
||||||
|
"provider": "generic",
|
||||||
|
"url": "https://gitea.tars.tools/brajan_aldana/upda"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user