Update profile.js
This commit is contained in:
@@ -3,15 +3,29 @@ const axios = require('axios');
|
|||||||
// Функция для запроса профиля Anixart
|
// Функция для запроса профиля Anixart
|
||||||
async function getProfileFromAnixart(profileId, token = '') {
|
async function getProfileFromAnixart(profileId, token = '') {
|
||||||
const url = `https://api.anixart.tv/profile/${profileId}${token ? `?token=${token}` : ''}`;
|
const url = `https://api.anixart.tv/profile/${profileId}${token ? `?token=${token}` : ''}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(url);
|
const response = await axios.get(url);
|
||||||
const data = response.data;
|
const data = response.data;
|
||||||
|
|
||||||
// Здесь можно модифицировать структуру данных, если нужно
|
// По умолчанию флаг is_verified — false
|
||||||
|
data.is_verified = false;
|
||||||
|
|
||||||
|
// Проверка, есть ли ID в списке verified
|
||||||
|
const verifiedResponse = await axios.get('https://anixart.seele.su/api/is_verified');
|
||||||
|
const verifiedList = verifiedResponse.data;
|
||||||
|
|
||||||
|
if (Array.isArray(verifiedList) && verifiedList.includes(profileId.toString())) {
|
||||||
|
data.is_verified = true;
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
} catch (error) {
|
} catch {
|
||||||
console.error("Ошибка при запросе профиля Anixart:", error.message);
|
return {
|
||||||
throw new Error("Ошибка при получении данных профиля из Anixart API");
|
code: 2,
|
||||||
|
profile: null,
|
||||||
|
is_my_profile: false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user