Skip to content

Commit

Permalink
fixing the user agents cfx=>mozilla to fix the 403 error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximaz committed Feb 24, 2024
1 parent 0e796f7 commit 37f4086
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dist/models/CfxStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion dist/modules/CfxCitizenServer.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/modules/CfxPinnedServers.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/modules/CfxStatus.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/modules/CfxUnresolvedIncidents.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/CfxStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class CfxStatus {

async fetchComponents(): Promise<CfxStatusComponentData[]> {
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")
Expand Down
4 changes: 2 additions & 2 deletions src/modules/CfxCitizenServer.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export default class CfxCitizenServerModule {
}

async retrieve(id: string): Promise<CfxCitizenServer | undefined> {
console.log(`${CFX_MASTERLIST}${id}`)

Check failure on line 14 in src/modules/CfxCitizenServer.module.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected console statement
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")
Expand Down
2 changes: 1 addition & 1 deletion src/modules/CfxPinnedServers.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class CfxPinnedServersModule {
async retrieve(): Promise<CfxPinnedServers | undefined> {
try {
const response = await axios.get(CFX_PINNED_SERVERS, {
headers: { "User-Agent": "cfx" },
headers: { "User-Agent": "Mozilla" },
})

return new CfxPinnedServers(response.data)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/CfxStatus.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class CfxStatusModule {
async retrieve(): Promise<CfxStatus | undefined> {
try {
const response = await axios.get(CFX_STATUS_SUMMARY, {
headers: { "User-Agent": "cfx" },
headers: { "User-Agent": "Mozilla" },
})

return new CfxStatus(response.data)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/CfxUnresolvedIncidents.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class CfxUnresolvedIncidentsModule {
async retrieve(): Promise<CfxUnresolvedIncidents | undefined> {
try {
const response = await axios.get(CFX_STATUS_UNRESOLVED, {
headers: { "User-Agent": "cfx" },
headers: { "User-Agent": "Mozilla" },
})

return new CfxUnresolvedIncidents(response.data)
Expand Down

0 comments on commit 37f4086

Please sign in to comment.