From 679f065e242cead3dd67024a06520f1b47381ed6 Mon Sep 17 00:00:00 2001 From: AMIAY Date: Sat, 24 Jan 2026 12:09:54 +0100 Subject: [PATCH] delete updateManager --- backend/updateManager.js | 86 ---------------------------------------- main.js | 42 ++++---------------- 2 files changed, 7 insertions(+), 121 deletions(-) delete mode 100644 backend/updateManager.js diff --git a/backend/updateManager.js b/backend/updateManager.js deleted file mode 100644 index e7894e9..0000000 --- a/backend/updateManager.js +++ /dev/null @@ -1,86 +0,0 @@ -const axios = require('axios'); - -const UPDATE_CHECK_URL = 'https://files.hytalef2p.com/api/version_launcher'; -const CURRENT_VERSION = '2.0.2'; -const GITHUB_DOWNLOAD_URL = 'https://github.com/amiayweb/Hytale-F2P/'; - -class UpdateManager { - constructor() { - this.updateAvailable = false; - this.remoteVersion = null; - } - - async checkForUpdates() { - // Disabled: Using electron-updater for automatic updates instead - console.log('Update check skipped - using electron-updater'); - console.log(`Current version: ${CURRENT_VERSION}`); - - return { - updateAvailable: false, - currentVersion: CURRENT_VERSION, - newVersion: CURRENT_VERSION, - message: 'Using electron-updater for automatic updates' - }; - - /* kept for reference - try { - console.log('Checking for updates...'); - console.log(`Local version: ${CURRENT_VERSION}`); - - const response = await axios.get(UPDATE_CHECK_URL, { - timeout: 5000, - headers: { - 'User-Agent': 'Hytale-F2P-Launcher' - } - }); - - if (response.data && response.data.launcher_version) { - this.remoteVersion = response.data.launcher_version; - console.log(`Remote version: ${this.remoteVersion}`); - - if (this.remoteVersion !== CURRENT_VERSION) { - this.updateAvailable = true; - console.log('Update available!'); - return { - updateAvailable: true, - currentVersion: CURRENT_VERSION, - newVersion: this.remoteVersion, - downloadUrl: GITHUB_DOWNLOAD_URL - }; - } else { - console.log('Launcher is up to date'); - return { - updateAvailable: false, - currentVersion: CURRENT_VERSION, - newVersion: this.remoteVersion - }; - } - } else { - throw new Error('Invalid API response'); - } - } catch (error) { - console.error('Error checking for updates:', error.message); - return { - updateAvailable: false, - error: error.message, - currentVersion: CURRENT_VERSION - }; - } - */ - } - - getDownloadUrl() { - return GITHUB_DOWNLOAD_URL; - } - - getUpdateInfo() { - return { - updateAvailable: this.updateAvailable, - currentVersion: CURRENT_VERSION, - remoteVersion: this.remoteVersion, - downloadUrl: this.getDownloadUrl() - }; - } -} - -module.exports = UpdateManager; \ No newline at end of file diff --git a/main.js b/main.js index d47d94c..891f594 100644 --- a/main.js +++ b/main.js @@ -4,7 +4,6 @@ const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron'); const fs = require('fs'); const { launchGame, launchGameWithVersionCheck, installGame, saveUsername, loadUsername, saveChatUsername, loadChatUsername, saveChatColor, loadChatColor, saveJavaPath, loadJavaPath, saveInstallPath, loadInstallPath, saveDiscordRPC, loadDiscordRPC, saveLanguage, loadLanguage, saveCloseLauncherOnStart, loadCloseLauncherOnStart, isGameInstalled, uninstallGame, repairGame, getHytaleNews, handleFirstLaunchCheck, proposeGameUpdate, markAsLaunched } = require('./backend/launcher'); -const UpdateManager = require('./backend/updateManager'); const logger = require('./backend/logger'); const profileManager = require('./backend/managers/profileManager'); @@ -26,7 +25,6 @@ if (!gotTheLock) { } let mainWindow; -let updateManager; let discordRPC = null; // Discord Rich Presence setup @@ -162,13 +160,7 @@ function createWindow() { // Initialize Discord Rich Presence initDiscordRPC(); - updateManager = new UpdateManager(); - setTimeout(async () => { - const updateInfo = await updateManager.checkForUpdates(); - if (updateInfo.updateAvailable) { - mainWindow.webContents.send('show-update-popup', updateInfo); - } - }, 3000); + // Auto-updates handled by electron-updater mainWindow.webContents.on('devtools-opened', () => { mainWindow.webContents.closeDevTools(); @@ -825,34 +817,14 @@ ipcMain.handle('copy-mod-file', async (event, sourcePath, modsPath) => { } }); -ipcMain.handle('check-for-updates', async () => { - try { - return await updateManager.checkForUpdates(); - } catch (error) { - console.error('Error checking for updates:', error); - return { updateAvailable: false, error: error.message }; - } -}); +// Auto-updates handled by electron-updater +// ipcMain.handle('check-for-updates', ...) - removed -ipcMain.handle('open-download-page', async () => { - try { - await shell.openExternal(updateManager.getDownloadUrl()); +// Auto-updates handled by electron-updater +// ipcMain.handle('open-download-page', ...) - removed - setTimeout(() => { - app.quit(); - }, 1000); - - - return { success: true }; - } catch (error) { - console.error('Error opening download page:', error); - return { success: false, error: error.message }; - } -}); - -ipcMain.handle('get-update-info', async () => { - return updateManager.getUpdateInfo(); -}); +// Auto-updates handled by electron-updater +// ipcMain.handle('get-update-info', ...) - removed ipcMain.handle('get-gpu-info', () => { try {