fix: timeout getLatestClient

fixes #138
This commit is contained in:
Fazri Gading
2026-01-29 03:01:38 +08:00
committed by GitHub
parent bf29112848
commit a07f0f1de1

View File

@@ -5,7 +5,7 @@ async function getLatestClientVersion(branch = 'release') {
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,
timeout: 40000, // fixed from 5000 to 40000 to make sure the client trying to connect on the server with slow internet
headers: {
'User-Agent': 'Hytale-F2P-Launcher'
}
@@ -16,13 +16,13 @@ async function getLatestClientVersion(branch = 'release') {
console.log(`Latest client version for ${branch}: ${version}`);
return version;
} else {
console.log('Warning: Invalid API response, falling back to default version');
return '4.pwr';
console.log('Warning: Invalid API response, falling back to latest known version (7.pwr - 2026-01-29)'); // added latest version fallback and latest known version as per today
return '7.pwr';
}
} catch (error) {
console.error('Error fetching client version:', error.message);
console.log('Warning: API unavailable, falling back to default version');
return '4.pwr';
console.log('Warning: API unavailable, falling back to latest known version (7.pwr - 2026-01-29)');
return '7.pwr';
}
}