mirror of
https://github.com/amiayweb/Hytale-F2P.git
synced 2026-02-26 13:51:46 -03:00
pre-release & release game version [to check]
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { markAsLaunched, loadConfig } = require('../core/config');
|
||||
const { markAsLaunched, loadConfig, saveVersionBranch, saveVersionClient, loadVersionBranch, loadVersionClient } = require('../core/config');
|
||||
const { checkExistingGameInstallation, updateGameFiles } = require('../managers/gameManager');
|
||||
const { getInstalledClientVersion, getLatestClientVersion } = require('./versionManager');
|
||||
|
||||
@@ -56,6 +56,20 @@ async function handleFirstLaunchCheck(progressCallback) {
|
||||
try {
|
||||
const config = loadConfig();
|
||||
|
||||
// Initialize version_branch and version_client if not set
|
||||
const currentBranch = loadVersionBranch();
|
||||
const currentVersion = loadVersionClient();
|
||||
|
||||
if (!currentBranch) {
|
||||
console.log('Initializing version_branch to "release"');
|
||||
saveVersionBranch('release');
|
||||
}
|
||||
|
||||
if (currentVersion === undefined || currentVersion === null) {
|
||||
console.log('Initializing version_client to null (will trigger installation)');
|
||||
saveVersionClient(null);
|
||||
}
|
||||
|
||||
if (config.hasLaunchedBefore === true) {
|
||||
return { isFirstLaunch: false, needsUpdate: false };
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
const axios = require('axios');
|
||||
|
||||
async function getLatestClientVersion() {
|
||||
async function getLatestClientVersion(branch = 'release') {
|
||||
try {
|
||||
console.log('Fetching latest client version from API...');
|
||||
console.log(`Fetching latest client version from API (branch: ${branch})...`);
|
||||
const response = await axios.get('https://files.hytalef2p.com/api/version_client', {
|
||||
params: { branch },
|
||||
timeout: 5000,
|
||||
headers: {
|
||||
'User-Agent': 'Hytale-F2P-Launcher'
|
||||
@@ -12,7 +13,7 @@ async function getLatestClientVersion() {
|
||||
|
||||
if (response.data && response.data.client_version) {
|
||||
const version = response.data.client_version;
|
||||
console.log(`Latest client version: ${version}`);
|
||||
console.log(`Latest client version for ${branch}: ${version}`);
|
||||
return version;
|
||||
} else {
|
||||
console.log('Warning: Invalid API response, falling back to default version');
|
||||
|
||||
Reference in New Issue
Block a user