From 37f4086bf34a503f7ac0a6c1213454f6924c8139 Mon Sep 17 00:00:00 2001 From: DURAND Malo Date: Sat, 24 Feb 2024 15:29:43 +0100 Subject: [PATCH] fixing the user agents cfx=>mozilla to fix the 403 error --- dist/models/CfxStatus.js | 2 +- dist/modules/CfxCitizenServer.module.js | 3 ++- dist/modules/CfxPinnedServers.module.js | 2 +- dist/modules/CfxStatus.module.js | 2 +- dist/modules/CfxUnresolvedIncidents.module.js | 2 +- src/models/CfxStatus.ts | 2 +- src/modules/CfxCitizenServer.module.ts | 4 ++-- src/modules/CfxPinnedServers.module.ts | 2 +- src/modules/CfxStatus.module.ts | 2 +- src/modules/CfxUnresolvedIncidents.module.ts | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dist/models/CfxStatus.js b/dist/models/CfxStatus.js index aa94487..8e25416 100644 --- a/dist/models/CfxStatus.js +++ b/dist/models/CfxStatus.js @@ -17,7 +17,7 @@ class CfxStatus { } async fetchComponents() { const response = await axios_1.default.get(types_1.CFX_STATUS_COMPONENTS, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }); if (response.status !== 200) throw new Error("Cannot retrieve Cfx.re components status"); diff --git a/dist/modules/CfxCitizenServer.module.js b/dist/modules/CfxCitizenServer.module.js index 9ca24b0..fe17894 100644 --- a/dist/modules/CfxCitizenServer.module.js +++ b/dist/modules/CfxCitizenServer.module.js @@ -14,9 +14,10 @@ class CfxCitizenServerModule { return this.instance; } async retrieve(id) { + console.log(`${types_1.CFX_MASTERLIST}${id}`); try { const response = await axios_1.default.get(types_1.CFX_MASTERLIST + id, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }); return new CfxCitizenServer_1.default(response.data); } diff --git a/dist/modules/CfxPinnedServers.module.js b/dist/modules/CfxPinnedServers.module.js index 2ad6518..352be79 100644 --- a/dist/modules/CfxPinnedServers.module.js +++ b/dist/modules/CfxPinnedServers.module.js @@ -16,7 +16,7 @@ class CfxPinnedServersModule { async retrieve() { try { const response = await axios_1.default.get(types_1.CFX_PINNED_SERVERS, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }); return new CfxPinnedServers_1.default(response.data); } diff --git a/dist/modules/CfxStatus.module.js b/dist/modules/CfxStatus.module.js index 709d02c..a1971ac 100644 --- a/dist/modules/CfxStatus.module.js +++ b/dist/modules/CfxStatus.module.js @@ -16,7 +16,7 @@ class CfxStatusModule { async retrieve() { try { const response = await axios_1.default.get(types_1.CFX_STATUS_SUMMARY, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }); return new CfxStatus_1.default(response.data); } diff --git a/dist/modules/CfxUnresolvedIncidents.module.js b/dist/modules/CfxUnresolvedIncidents.module.js index 8579fc2..9663346 100644 --- a/dist/modules/CfxUnresolvedIncidents.module.js +++ b/dist/modules/CfxUnresolvedIncidents.module.js @@ -16,7 +16,7 @@ class CfxUnresolvedIncidentsModule { async retrieve() { try { const response = await axios_1.default.get(types_1.CFX_STATUS_UNRESOLVED, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }); return new CfxUnresolvedIncidents_1.default(response.data); } diff --git a/src/models/CfxStatus.ts b/src/models/CfxStatus.ts index 10e3c5f..41e39c6 100644 --- a/src/models/CfxStatus.ts +++ b/src/models/CfxStatus.ts @@ -20,7 +20,7 @@ export default class CfxStatus { async fetchComponents(): Promise { const response = await axios.get(CFX_STATUS_COMPONENTS, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }) if (response.status !== 200) throw new Error("Cannot retrieve Cfx.re components status") diff --git a/src/modules/CfxCitizenServer.module.ts b/src/modules/CfxCitizenServer.module.ts index bec3187..81c7a4f 100644 --- a/src/modules/CfxCitizenServer.module.ts +++ b/src/modules/CfxCitizenServer.module.ts @@ -11,11 +11,11 @@ export default class CfxCitizenServerModule { } async retrieve(id: string): Promise { + console.log(`${CFX_MASTERLIST}${id}`) try { const response = await axios.get(CFX_MASTERLIST + id, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }) - return new CfxCitizenServer(response.data) } catch (error) { throw new Error("Server not found or internal error occurred") diff --git a/src/modules/CfxPinnedServers.module.ts b/src/modules/CfxPinnedServers.module.ts index 32baca2..8d671f6 100644 --- a/src/modules/CfxPinnedServers.module.ts +++ b/src/modules/CfxPinnedServers.module.ts @@ -13,7 +13,7 @@ export default class CfxPinnedServersModule { async retrieve(): Promise { try { const response = await axios.get(CFX_PINNED_SERVERS, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }) return new CfxPinnedServers(response.data) diff --git a/src/modules/CfxStatus.module.ts b/src/modules/CfxStatus.module.ts index 8f37d28..56f48b8 100644 --- a/src/modules/CfxStatus.module.ts +++ b/src/modules/CfxStatus.module.ts @@ -13,7 +13,7 @@ export default class CfxStatusModule { async retrieve(): Promise { try { const response = await axios.get(CFX_STATUS_SUMMARY, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }) return new CfxStatus(response.data) diff --git a/src/modules/CfxUnresolvedIncidents.module.ts b/src/modules/CfxUnresolvedIncidents.module.ts index c14ae6d..0a384aa 100644 --- a/src/modules/CfxUnresolvedIncidents.module.ts +++ b/src/modules/CfxUnresolvedIncidents.module.ts @@ -13,7 +13,7 @@ export default class CfxUnresolvedIncidentsModule { async retrieve(): Promise { try { const response = await axios.get(CFX_STATUS_UNRESOLVED, { - headers: { "User-Agent": "cfx" }, + headers: { "User-Agent": "Mozilla" }, }) return new CfxUnresolvedIncidents(response.data)