mirror of
https://git.sanhost.net/sanasol/hytale-f2p
synced 2026-02-26 09:21:48 -03:00
delete updateManager
This commit is contained in:
@@ -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
42
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 {
|
||||
|
||||
Reference in New Issue
Block a user