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

@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');
const { downloadFile, findHomePageUIPath, findLogoPath } = require('../utils/fileManager');
const { proxyRequest } = require('../utils/proxyClient');
const { smartRequest } = require('../utils/proxyClient');
async function downloadAndReplaceHomePageUI(gameDir, progressCallback) {
try {
@@ -14,7 +14,7 @@ async function downloadAndReplaceHomePageUI(gameDir, progressCallback) {
const homeUIUrl = 'https://files.hytalef2p.com/api/HomeUI';
const tempHomePath = path.join(path.dirname(gameDir), 'HomePage_temp.ui');
const response = await proxyRequest(homeUIUrl, { responseType: 'arraybuffer' });
const response = await smartRequest(homeUIUrl, { responseType: 'arraybuffer' });
fs.writeFileSync(tempHomePath, response.data);
const existingHomePath = findHomePageUIPath(gameDir);
@@ -68,7 +68,7 @@ async function downloadAndReplaceLogo(gameDir, progressCallback) {
const logoUrl = 'https://files.hytalef2p.com/api/Logo';
const tempLogoPath = path.join(path.dirname(gameDir), 'Logo@2x_temp.png');
const response = await proxyRequest(logoUrl, { responseType: 'arraybuffer' });
const response = await smartRequest(logoUrl, { responseType: 'arraybuffer' });
fs.writeFileSync(tempLogoPath, response.data);
const existingLogoPath = findLogoPath(gameDir);