delete updateManager

This commit is contained in:
AMIAY
2026-01-24 12:09:54 +01:00
parent ecae7d2ee5
commit 679f065e24
2 changed files with 7 additions and 121 deletions

View File

@@ -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;

42
main.js
View File

@@ -4,7 +4,6 @@ const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron');
const fs = require('fs'); 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 { 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 logger = require('./backend/logger');
const profileManager = require('./backend/managers/profileManager'); const profileManager = require('./backend/managers/profileManager');
@@ -26,7 +25,6 @@ if (!gotTheLock) {
} }
let mainWindow; let mainWindow;
let updateManager;
let discordRPC = null; let discordRPC = null;
// Discord Rich Presence setup // Discord Rich Presence setup
@@ -162,13 +160,7 @@ function createWindow() {
// Initialize Discord Rich Presence // Initialize Discord Rich Presence
initDiscordRPC(); initDiscordRPC();
updateManager = new UpdateManager(); // Auto-updates handled by electron-updater
setTimeout(async () => {
const updateInfo = await updateManager.checkForUpdates();
if (updateInfo.updateAvailable) {
mainWindow.webContents.send('show-update-popup', updateInfo);
}
}, 3000);
mainWindow.webContents.on('devtools-opened', () => { mainWindow.webContents.on('devtools-opened', () => {
mainWindow.webContents.closeDevTools(); mainWindow.webContents.closeDevTools();
@@ -825,34 +817,14 @@ ipcMain.handle('copy-mod-file', async (event, sourcePath, modsPath) => {
} }
}); });
ipcMain.handle('check-for-updates', async () => { // Auto-updates handled by electron-updater
try { // ipcMain.handle('check-for-updates', ...) - removed
return await updateManager.checkForUpdates();
} catch (error) {
console.error('Error checking for updates:', error);
return { updateAvailable: false, error: error.message };
}
});
ipcMain.handle('open-download-page', async () => { // Auto-updates handled by electron-updater
try { // ipcMain.handle('open-download-page', ...) - removed
await shell.openExternal(updateManager.getDownloadUrl());
setTimeout(() => { // Auto-updates handled by electron-updater
app.quit(); // ipcMain.handle('get-update-info', ...) - removed
}, 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();
});
ipcMain.handle('get-gpu-info', () => { ipcMain.handle('get-gpu-info', () => {
try { try {