-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcheckAPI.js
More file actions
46 lines (42 loc) · 1.16 KB
/
checkAPI.js
File metadata and controls
46 lines (42 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const axios = require("axios");
const { log } = require("./utils"); // Adjust the path as necessary
const settings = require("./config/config");
const urlChecking = "https://raw.githubusercontent.com/D4rkCipherX/APIs-checking/refs/heads/main/endpoints.json";
async function checkBaseUrl() {
console.log("Checking api...".blue);
if (settings.ADVANCED_ANTI_DETECTION) {
const result = await getBaseApi(urlChecking);
if (result.endpoint) {
log("No change in api!", "success");
return result;
}
} else {
return {
endpoint: settings.BASE_URL,
message:
"Telegram Channel (https://t.me/D4rkCipherX)",
};
}
}
async function getBaseApi(url) {
try {
const response = await axios.get(url);
const content = response.data;
if (content?.magic) {
return { endpoint: content.magic, message: content.copyright };
} else {
return {
endpoint: null,
message:
"Telegram Channel (https://t.me/D4rkCipherX)",
};
}
} catch (e) {
return {
endpoint: null,
message:
"Telegram Channel (https://t.me/D4rkCipherX)",
};
}
}
module.exports = { checkBaseUrl };