fix: handle download not found exception in HttpDownloader and enforce IPv4 in HTTP agents

This commit is contained in:
Moyasee
2026-01-03 01:08:25 +02:00
parent 2bc0266775
commit de483da51c
5 changed files with 29 additions and 1 deletions

View File

@@ -1,4 +1,6 @@
import axios from "axios";
import http from "http";
import https from "https";
import {
HOSTER_USER_AGENT,
extractHosterFilename,
@@ -28,6 +30,12 @@ export class BuzzheavierApi {
await axios.get(baseUrl, {
headers: { "User-Agent": HOSTER_USER_AGENT },
timeout: 30000,
httpAgent: new http.Agent({
family: 4, // Force IPv4
}),
httpsAgent: new https.Agent({
family: 4, // Force IPv4
}),
});
const downloadUrl = `${baseUrl}/download`;
@@ -43,6 +51,12 @@ export class BuzzheavierApi {
validateStatus: (status) =>
status === 200 || status === 204 || status === 301 || status === 302,
timeout: 30000,
httpAgent: new http.Agent({
family: 4, // Force IPv4
}),
httpsAgent: new https.Agent({
family: 4, // Force IPv4
}),
});
const hxRedirect = headResponse.headers["hx-redirect"];

View File

@@ -1,4 +1,5 @@
import axios from "axios";
import https from "https";
import { logger } from "../logger";
interface UnlockResponse {
@@ -33,6 +34,9 @@ export class VikingFileApi {
maxRedirects: 0,
validateStatus: (status) =>
status === 301 || status === 302 || status === 200,
httpsAgent: new https.Agent({
family: 4, // Force IPv4
}),
});
if (