mirror of
https://github.com/amiayweb/Hytale-F2P.git
synced 2026-02-26 06:01:45 -03:00
need test - electron updater
This commit is contained in:
@@ -602,38 +602,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="progressOverlay" class="progress-overlay" style="display: none;">
|
||||
<div class="progress-content">
|
||||
<div class="progress-info">
|
||||
<span id="progressText" data-i18n="progress.initializing">Initializing...</span>
|
||||
<span id="progressPercent">0%</span>
|
||||
</div>
|
||||
<div class="progress-bar-container">
|
||||
<div id="progressBarFill" class="progress-bar-fill"></div>
|
||||
</div>
|
||||
<div class="progress-details">
|
||||
<span id="progressSpeed"></span>
|
||||
<span id="progressSize"></span>
|
||||
</div>
|
||||
<div id="progressErrorContainer" class="progress-error-container" style="display: none;">
|
||||
<div id="progressErrorMessage" class="progress-error-message"></div>
|
||||
<div class="progress-retry-section">
|
||||
<span id="progressRetryInfo" class="progress-retry-info"></span>
|
||||
<div class="progress-retry-buttons">
|
||||
<button id="progressJRRetryBtn" class="progress-retry-btn" style="display: none;">
|
||||
Retry Java Download
|
||||
</button>
|
||||
<button id="progressPWRRetryBtn" class="progress-retry-btn" style="display: none;">
|
||||
Retry Game Download
|
||||
</button>
|
||||
<button id="progressRetryBtn" class="progress-retry-btn" style="display: none;">
|
||||
Retry Download
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="progressOverlay" class="progress-overlay" style="display: none;">
|
||||
<div class="progress-content">
|
||||
<div class="progress-info">
|
||||
<span id="progressText" data-i18n="progress.initializing">Initializing...</span>
|
||||
<span id="progressPercent">0%</span>
|
||||
</div>
|
||||
<div class="progress-bar-container">
|
||||
<div id="progressBarFill" class="progress-bar-fill"></div>
|
||||
</div>
|
||||
<div class="progress-details">
|
||||
<span id="progressSpeed"></span>
|
||||
<span id="progressSize"></span>
|
||||
</div>
|
||||
<div id="progressErrorContainer" class="progress-error-container" style="display: none;">
|
||||
<div id="progressErrorMessage" class="progress-error-message"></div>
|
||||
<div class="progress-retry-section">
|
||||
<span id="progressRetryInfo" class="progress-retry-info"></span>
|
||||
<div class="progress-retry-buttons">
|
||||
<button id="progressJRRetryBtn" class="progress-retry-btn" style="display: none;">
|
||||
Retry Java Download
|
||||
</button>
|
||||
<button id="progressPWRRetryBtn" class="progress-retry-btn" style="display: none;">
|
||||
Retry Game Download
|
||||
</button>
|
||||
<button id="progressRetryBtn" class="progress-retry-btn" style="display: none;">
|
||||
Retry Download
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="chatUsernameModal" class="chat-username-modal" style="display: none;">
|
||||
<div class="chat-username-modal-content">
|
||||
@@ -854,6 +854,7 @@
|
||||
<script src="js/i18n.js"></script>
|
||||
<script type="module" src="js/settings.js"></script>
|
||||
<script type="module" src="js/update.js"></script>
|
||||
<script src="js/updater.js"></script>
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
157
GUI/js/updater.js
Normal file
157
GUI/js/updater.js
Normal file
@@ -0,0 +1,157 @@
|
||||
// Launcher Update Manager UI
|
||||
|
||||
let updateModal = null;
|
||||
let downloadProgressBar = null;
|
||||
|
||||
function initUpdater() {
|
||||
// Listen for update events from main process
|
||||
if (window.electronAPI && window.electronAPI.onUpdateAvailable) {
|
||||
window.electronAPI.onUpdateAvailable((updateInfo) => {
|
||||
showUpdateModal(updateInfo);
|
||||
});
|
||||
}
|
||||
|
||||
if (window.electronAPI && window.electronAPI.onUpdateDownloadProgress) {
|
||||
window.electronAPI.onUpdateDownloadProgress((progress) => {
|
||||
updateDownloadProgress(progress);
|
||||
});
|
||||
}
|
||||
|
||||
if (window.electronAPI && window.electronAPI.onUpdateDownloaded) {
|
||||
window.electronAPI.onUpdateDownloaded((info) => {
|
||||
showInstallUpdatePrompt(info);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function showUpdateModal(updateInfo) {
|
||||
if (updateModal) {
|
||||
updateModal.remove();
|
||||
}
|
||||
|
||||
updateModal = document.createElement('div');
|
||||
updateModal.className = 'update-modal-overlay';
|
||||
updateModal.innerHTML = `
|
||||
<div class="update-modal">
|
||||
<div class="update-header">
|
||||
<i class="fas fa-download"></i>
|
||||
<h2>Launcher Update Available</h2>
|
||||
</div>
|
||||
<div class="update-content">
|
||||
<p class="update-version">Version ${updateInfo.newVersion} is available!</p>
|
||||
<p class="current-version">Current version: ${updateInfo.currentVersion}</p>
|
||||
${updateInfo.releaseNotes ? `<div class="release-notes">${updateInfo.releaseNotes}</div>` : ''}
|
||||
</div>
|
||||
<div class="update-progress" style="display: none;">
|
||||
<div class="progress-bar-container">
|
||||
<div class="progress-bar" id="updateProgressBar"></div>
|
||||
</div>
|
||||
<p class="progress-text" id="updateProgressText">Downloading...</p>
|
||||
</div>
|
||||
<div class="update-actions">
|
||||
<button class="btn-secondary" onclick="dismissUpdateModal()">
|
||||
<i class="fas fa-times"></i> Later
|
||||
</button>
|
||||
<button class="btn-primary" onclick="downloadUpdate()">
|
||||
<i class="fas fa-download"></i> Download Update
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(updateModal);
|
||||
}
|
||||
|
||||
async function downloadUpdate() {
|
||||
const downloadBtn = updateModal.querySelector('.btn-primary');
|
||||
const laterBtn = updateModal.querySelector('.btn-secondary');
|
||||
const progressDiv = updateModal.querySelector('.update-progress');
|
||||
|
||||
// Disable buttons and show progress
|
||||
downloadBtn.disabled = true;
|
||||
laterBtn.disabled = true;
|
||||
progressDiv.style.display = 'block';
|
||||
|
||||
try {
|
||||
await window.electronAPI.downloadUpdate();
|
||||
} catch (error) {
|
||||
console.error('Failed to download update:', error);
|
||||
alert('Failed to download update. Please try again later.');
|
||||
dismissUpdateModal();
|
||||
}
|
||||
}
|
||||
|
||||
function updateDownloadProgress(progress) {
|
||||
if (!updateModal) return;
|
||||
|
||||
const progressBar = document.getElementById('updateProgressBar');
|
||||
const progressText = document.getElementById('updateProgressText');
|
||||
|
||||
if (progressBar) {
|
||||
progressBar.style.width = `${progress.percent}%`;
|
||||
}
|
||||
|
||||
if (progressText) {
|
||||
const mbTransferred = (progress.transferred / 1024 / 1024).toFixed(2);
|
||||
const mbTotal = (progress.total / 1024 / 1024).toFixed(2);
|
||||
const speed = (progress.bytesPerSecond / 1024 / 1024).toFixed(2);
|
||||
progressText.textContent = `Downloading... ${mbTransferred}MB / ${mbTotal}MB (${speed} MB/s)`;
|
||||
}
|
||||
}
|
||||
|
||||
function showInstallUpdatePrompt(info) {
|
||||
if (updateModal) {
|
||||
updateModal.remove();
|
||||
}
|
||||
|
||||
updateModal = document.createElement('div');
|
||||
updateModal.className = 'update-modal-overlay';
|
||||
updateModal.innerHTML = `
|
||||
<div class="update-modal">
|
||||
<div class="update-header">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
<h2>Update Downloaded</h2>
|
||||
</div>
|
||||
<div class="update-content">
|
||||
<p>Version ${info.version} has been downloaded and is ready to install.</p>
|
||||
<p class="update-note">The launcher will restart to complete the installation.</p>
|
||||
</div>
|
||||
<div class="update-actions">
|
||||
<button class="btn-secondary" onclick="dismissUpdateModal()">
|
||||
<i class="fas fa-times"></i> Install Later
|
||||
</button>
|
||||
<button class="btn-primary" onclick="installUpdate()">
|
||||
<i class="fas fa-sync-alt"></i> Restart & Install
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(updateModal);
|
||||
}
|
||||
|
||||
async function installUpdate() {
|
||||
try {
|
||||
await window.electronAPI.installUpdate();
|
||||
} catch (error) {
|
||||
console.error('Failed to install update:', error);
|
||||
}
|
||||
}
|
||||
|
||||
function dismissUpdateModal() {
|
||||
if (updateModal) {
|
||||
updateModal.remove();
|
||||
updateModal = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize when DOM is ready
|
||||
document.addEventListener('DOMContentLoaded', initUpdater);
|
||||
|
||||
// Export functions
|
||||
window.UpdaterUI = {
|
||||
showUpdateModal,
|
||||
dismissUpdateModal,
|
||||
downloadUpdate,
|
||||
installUpdate
|
||||
};
|
||||
165
GUI/style.css
165
GUI/style.css
@@ -5990,4 +5990,167 @@ select.settings-input option {
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Launcher Update Modal Styles */
|
||||
.update-modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.85);
|
||||
backdrop-filter: blur(10px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 100000;
|
||||
animation: fadeIn 0.3s ease;
|
||||
}
|
||||
|
||||
.update-modal {
|
||||
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
||||
border: 2px solid rgba(147, 51, 234, 0.3);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
max-width: 500px;
|
||||
width: 90%;
|
||||
box-shadow: 0 20px 60px rgba(147, 51, 234, 0.3);
|
||||
animation: slideUp 0.3s ease;
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
transform: translateY(30px);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.update-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1.5rem;
|
||||
color: #9333ea;
|
||||
}
|
||||
|
||||
.update-header i {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.update-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.update-content {
|
||||
color: #e0e0e0;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.update-version {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
color: #9333ea;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.current-version {
|
||||
color: #888;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.release-notes {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-left: 3px solid #9333ea;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.update-progress {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.progress-bar-container {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 10px;
|
||||
height: 20px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #9333ea 0%, #7c3aed 100%);
|
||||
width: 0%;
|
||||
transition: width 0.3s ease;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
color: #aaa;
|
||||
font-size: 0.9rem;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.update-note {
|
||||
background: rgba(147, 51, 234, 0.1);
|
||||
border: 1px solid rgba(147, 51, 234, 0.3);
|
||||
padding: 0.75rem;
|
||||
border-radius: 8px;
|
||||
font-size: 0.9rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.update-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.update-actions button {
|
||||
padding: 0.75rem 1.5rem;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.update-actions .btn-primary {
|
||||
background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.update-actions .btn-primary:hover:not(:disabled) {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(147, 51, 234, 0.4);
|
||||
}
|
||||
|
||||
.update-actions .btn-secondary {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #e0e0e0;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.update-actions .btn-secondary:hover:not(:disabled) {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.update-actions button:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
@@ -15,12 +15,6 @@ class AppUpdater {
|
||||
}
|
||||
|
||||
setupAutoUpdater() {
|
||||
// Enable dev mode for testing (reads dev-app-update.yml)
|
||||
// Only enable in development, not in production builds
|
||||
if (process.env.NODE_ENV === 'development' || !app.isPackaged) {
|
||||
autoUpdater.forceDevUpdateConfig = true;
|
||||
console.log('Dev update mode enabled - using dev-app-update.yml');
|
||||
}
|
||||
|
||||
// Configure logger for electron-updater
|
||||
// Create a compatible logger interface
|
||||
@@ -176,7 +170,7 @@ class AppUpdater {
|
||||
console.warn('macOS update error: App may not be code-signed. Auto-update requires code signing.');
|
||||
if (this.mainWindow && !this.mainWindow.isDestroyed()) {
|
||||
this.mainWindow.webContents.send('update-error', {
|
||||
message: 'Auto-update requires code signing. Please download manually from GitHub.',
|
||||
message: 'Please download manually from GitHub.',
|
||||
code: err.code,
|
||||
isMacSigningError: true,
|
||||
requiresManualDownload: true,
|
||||
|
||||
73
backend/updateManager.js
Normal file
73
backend/updateManager.js
Normal file
@@ -0,0 +1,73 @@
|
||||
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() {
|
||||
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;
|
||||
92
main.js
92
main.js
@@ -1,6 +1,7 @@
|
||||
const path = require('path');
|
||||
require('dotenv').config({ path: path.join(__dirname, '.env') });
|
||||
const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron');
|
||||
const { autoUpdater } = require('electron-updater');
|
||||
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 { retryPWRDownload } = require('./backend/managers/gameManager');
|
||||
@@ -161,7 +162,60 @@ function createWindow() {
|
||||
// Initialize Discord Rich Presence
|
||||
initDiscordRPC();
|
||||
|
||||
// Auto-updates handled by electron-updater
|
||||
// Configure and initialize electron-updater
|
||||
autoUpdater.autoDownload = false;
|
||||
autoUpdater.autoInstallOnAppQuit = true;
|
||||
|
||||
autoUpdater.on('checking-for-update', () => {
|
||||
console.log('Checking for launcher updates...');
|
||||
});
|
||||
|
||||
autoUpdater.on('update-available', (info) => {
|
||||
console.log('Update available:', info.version);
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.webContents.send('update-available', {
|
||||
currentVersion: app.getVersion(),
|
||||
newVersion: info.version,
|
||||
releaseNotes: info.releaseNotes,
|
||||
releaseDate: info.releaseDate
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
autoUpdater.on('update-not-available', (info) => {
|
||||
console.log('Launcher is up to date:', info.version);
|
||||
});
|
||||
|
||||
autoUpdater.on('error', (err) => {
|
||||
console.error('Error in auto-updater:', err);
|
||||
});
|
||||
|
||||
autoUpdater.on('download-progress', (progressObj) => {
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.webContents.send('update-download-progress', {
|
||||
percent: progressObj.percent,
|
||||
transferred: progressObj.transferred,
|
||||
total: progressObj.total,
|
||||
bytesPerSecond: progressObj.bytesPerSecond
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', (info) => {
|
||||
console.log('Update downloaded:', info.version);
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.webContents.send('update-downloaded', {
|
||||
version: info.version
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Check for updates after 3 seconds
|
||||
setTimeout(() => {
|
||||
autoUpdater.checkForUpdates().catch(err => {
|
||||
console.log('Failed to check for updates:', err.message);
|
||||
});
|
||||
}, 3000);
|
||||
|
||||
mainWindow.webContents.on('devtools-opened', () => {
|
||||
mainWindow.webContents.closeDevTools();
|
||||
@@ -985,14 +1039,38 @@ ipcMain.handle('copy-mod-file', async (event, sourcePath, modsPath) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Auto-updates handled by electron-updater
|
||||
// ipcMain.handle('check-for-updates', ...) - removed
|
||||
// Electron-updater IPC handlers
|
||||
ipcMain.handle('check-for-updates', async () => {
|
||||
try {
|
||||
const result = await autoUpdater.checkForUpdates();
|
||||
return {
|
||||
updateAvailable: result && result.updateInfo,
|
||||
currentVersion: app.getVersion(),
|
||||
updateInfo: result ? result.updateInfo : null
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error checking for updates:', error);
|
||||
return { updateAvailable: false, error: error.message };
|
||||
}
|
||||
});
|
||||
|
||||
// Auto-updates handled by electron-updater
|
||||
// ipcMain.handle('open-download-page', ...) - removed
|
||||
ipcMain.handle('download-update', async () => {
|
||||
try {
|
||||
await autoUpdater.downloadUpdate();
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('Error downloading update:', error);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
});
|
||||
|
||||
// Auto-updates handled by electron-updater
|
||||
// ipcMain.handle('get-update-info', ...) - removed
|
||||
ipcMain.handle('install-update', () => {
|
||||
autoUpdater.quitAndInstall(false, true);
|
||||
});
|
||||
|
||||
ipcMain.handle('get-launcher-version', () => {
|
||||
return app.getVersion();
|
||||
});
|
||||
|
||||
ipcMain.handle('get-gpu-info', () => {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hytale-f2p-launcher",
|
||||
"version": "2.1.0",
|
||||
"version": "2.0.1",
|
||||
"description": "A modern, cross-platform launcher for Hytale with automatic updates and multi-client support",
|
||||
"homepage": "https://github.com/amiayweb/Hytale-F2P",
|
||||
"main": "main.js",
|
||||
|
||||
15
preload.js
15
preload.js
@@ -115,5 +115,20 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
activate: (id) => ipcRenderer.invoke('profile-activate', id),
|
||||
delete: (id) => ipcRenderer.invoke('profile-delete', id),
|
||||
update: (id, updates) => ipcRenderer.invoke('profile-update', id, updates)
|
||||
},
|
||||
|
||||
// Launcher Update API
|
||||
checkForUpdates: () => ipcRenderer.invoke('check-for-updates'),
|
||||
downloadUpdate: () => ipcRenderer.invoke('download-update'),
|
||||
installUpdate: () => ipcRenderer.invoke('install-update'),
|
||||
getLauncherVersion: () => ipcRenderer.invoke('get-launcher-version'),
|
||||
onUpdateAvailable: (callback) => {
|
||||
ipcRenderer.on('update-available', (event, data) => callback(data));
|
||||
},
|
||||
onUpdateDownloadProgress: (callback) => {
|
||||
ipcRenderer.on('update-download-progress', (event, data) => callback(data));
|
||||
},
|
||||
onUpdateDownloaded: (callback) => {
|
||||
ipcRenderer.on('update-downloaded', (event, data) => callback(data));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user