Add proxy client and route downloads through it

This commit is contained in:
AMIAY
2026-02-01 17:23:00 +01:00
parent fc91560acb
commit cd25f124bd
5 changed files with 127 additions and 42 deletions

View File

@@ -2,6 +2,7 @@ const axios = require('axios');
const crypto = require('crypto');
const fs = require('fs');
const { getOS, getArch } = require('../utils/platformUtils');
const { proxyRequest } = require('../utils/proxyClient');
const BASE_PATCH_URL = 'https://game-patches.hytale.com/patches';
const MANIFEST_API = 'https://files.hytalef2p.com/api/patch_manifest';
@@ -9,8 +10,7 @@ const MANIFEST_API = 'https://files.hytalef2p.com/api/patch_manifest';
async function getLatestClientVersion(branch = 'release') {
try {
console.log(`Fetching latest client version from API (branch: ${branch})...`);
const response = await axios.get('https://files.hytalef2p.com/api/version_client', {
params: { branch },
const response = await proxyRequest(`https://files.hytalef2p.com/api/version_client?branch=${branch}`, {
timeout: 40000,
headers: {
'User-Agent': 'Hytale-F2P-Launcher'
@@ -66,8 +66,7 @@ async function fetchPatchManifest(branch = 'release') {
try {
const os = getOS();
const arch = getArch();
const response = await axios.get(MANIFEST_API, {
params: { branch, os, arch },
const response = await proxyRequest(`${MANIFEST_API}?branch=${branch}&os=${os}&arch=${arch}`, {
timeout: 10000
});
return response.data.patches || {};