mirror of
https://git.sanhost.net/sanasol/hytale-f2p
synced 2026-02-26 10:31:47 -03:00
fix
This commit is contained in:
@@ -49,9 +49,6 @@ function showUpdateModal(updateInfo) {
|
|||||||
<p class="progress-text" id="updateProgressText">Downloading...</p>
|
<p class="progress-text" id="updateProgressText">Downloading...</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="update-actions">
|
<div class="update-actions">
|
||||||
<button class="btn-secondary" onclick="dismissUpdateModal()">
|
|
||||||
<i class="fas fa-times"></i> Later
|
|
||||||
</button>
|
|
||||||
<button class="btn-primary" onclick="downloadUpdate()">
|
<button class="btn-primary" onclick="downloadUpdate()">
|
||||||
<i class="fas fa-download"></i> Download Update
|
<i class="fas fa-download"></i> Download Update
|
||||||
</button>
|
</button>
|
||||||
@@ -64,12 +61,10 @@ function showUpdateModal(updateInfo) {
|
|||||||
|
|
||||||
async function downloadUpdate() {
|
async function downloadUpdate() {
|
||||||
const downloadBtn = updateModal.querySelector('.btn-primary');
|
const downloadBtn = updateModal.querySelector('.btn-primary');
|
||||||
const laterBtn = updateModal.querySelector('.btn-secondary');
|
|
||||||
const progressDiv = updateModal.querySelector('.update-progress');
|
const progressDiv = updateModal.querySelector('.update-progress');
|
||||||
|
|
||||||
// Disable buttons and show progress
|
// Disable button and show progress
|
||||||
downloadBtn.disabled = true;
|
downloadBtn.disabled = true;
|
||||||
laterBtn.disabled = true;
|
|
||||||
progressDiv.style.display = 'block';
|
progressDiv.style.display = 'block';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -117,9 +112,6 @@ function showInstallUpdatePrompt(info) {
|
|||||||
<p class="update-note">The launcher will restart to complete the installation.</p>
|
<p class="update-note">The launcher will restart to complete the installation.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="update-actions">
|
<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()">
|
<button class="btn-primary" onclick="installUpdate()">
|
||||||
<i class="fas fa-sync-alt"></i> Restart & Install
|
<i class="fas fa-sync-alt"></i> Restart & Install
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,73 +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() {
|
|
||||||
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;
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hytale-f2p-launcher",
|
"name": "hytale-f2p-launcher",
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"description": "A modern, cross-platform launcher for Hytale with automatic updates and multi-client support",
|
"description": "A modern, cross-platform launcher for Hytale with automatic updates and multi-client support",
|
||||||
"homepage": "https://github.com/amiayweb/Hytale-F2P",
|
"homepage": "https://github.com/amiayweb/Hytale-F2P",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user