Add smart proxy with direct-fallback and logging

This commit is contained in:
AMIAY
2026-02-01 19:46:22 +01:00
parent 7c8a106f06
commit 3ac2f25955
4 changed files with 395 additions and 71 deletions

View File

@@ -2,7 +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 { smartRequest } = require('../utils/proxyClient');
const BASE_PATCH_URL = 'https://game-patches.hytale.com/patches';
const MANIFEST_API = 'https://files.hytalef2p.com/api/patch_manifest';
@@ -10,7 +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 proxyRequest(`https://files.hytalef2p.com/api/version_client?branch=${branch}`, {
const response = await smartRequest(`https://files.hytalef2p.com/api/version_client?branch=${branch}`, {
timeout: 40000,
headers: {
'User-Agent': 'Hytale-F2P-Launcher'
@@ -66,7 +66,7 @@ async function fetchPatchManifest(branch = 'release') {
try {
const os = getOS();
const arch = getArch();
const response = await proxyRequest(`${MANIFEST_API}?branch=${branch}&os=${os}&arch=${arch}`, {
const response = await smartRequest(`${MANIFEST_API}?branch=${branch}&os=${os}&arch=${arch}`, {
timeout: 10000
});
return response.data.patches || {};