mirror of
https://github.com/amiayweb/Hytale-F2P.git
synced 2026-02-26 13:41:46 -03:00
Add proxy client and route downloads through it
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { downloadFile, findHomePageUIPath, findLogoPath } = require('../utils/fileManager');
|
||||
const { proxyRequest } = require('../utils/proxyClient');
|
||||
|
||||
async function downloadAndReplaceHomePageUI(gameDir, progressCallback) {
|
||||
try {
|
||||
@@ -13,7 +14,8 @@ async function downloadAndReplaceHomePageUI(gameDir, progressCallback) {
|
||||
const homeUIUrl = 'https://files.hytalef2p.com/api/HomeUI';
|
||||
const tempHomePath = path.join(path.dirname(gameDir), 'HomePage_temp.ui');
|
||||
|
||||
await downloadFile(homeUIUrl, tempHomePath);
|
||||
const response = await proxyRequest(homeUIUrl, { responseType: 'arraybuffer' });
|
||||
fs.writeFileSync(tempHomePath, response.data);
|
||||
|
||||
const existingHomePath = findHomePageUIPath(gameDir);
|
||||
|
||||
@@ -66,7 +68,8 @@ async function downloadAndReplaceLogo(gameDir, progressCallback) {
|
||||
const logoUrl = 'https://files.hytalef2p.com/api/Logo';
|
||||
const tempLogoPath = path.join(path.dirname(gameDir), 'Logo@2x_temp.png');
|
||||
|
||||
await downloadFile(logoUrl, tempLogoPath);
|
||||
const response = await proxyRequest(logoUrl, { responseType: 'arraybuffer' });
|
||||
fs.writeFileSync(tempLogoPath, response.data);
|
||||
|
||||
const existingLogoPath = findLogoPath(gameDir);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user