Update profile.js
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const axios = require('axios');
|
||||
|
||||
// Функция для запроса профиля Anixart
|
||||
async function getProfileFromAnixart(profileId, token = '') {
|
||||
const url = `https://api.anixart.tv/profile/${profileId}${token ? `?token=${token}` : ''}`;
|
||||
|
||||
@@ -7,23 +8,36 @@ async function getProfileFromAnixart(profileId, token = '') {
|
||||
const response = await axios.get(url);
|
||||
const profileData = response.data;
|
||||
|
||||
// Изначально предполагаем, что не верифицирован
|
||||
let isVerified = false;
|
||||
|
||||
// Проверка верификации
|
||||
try {
|
||||
const verifiedResponse = await axios.get('https://anixart.seele.su/api/is_verified');
|
||||
const verifiedList = verifiedResponse.data;
|
||||
|
||||
if (Array.isArray(verifiedList) && verifiedList.includes(profileId.toString())) {
|
||||
isVerified = true;
|
||||
profileData.profile.is_verified = true; // Обновляем в профиле
|
||||
profileData.profile.is_verified = true;
|
||||
}
|
||||
} catch {
|
||||
// Не удалось проверить верификацию — игнорируем
|
||||
// Ошибку верификации игнорируем
|
||||
}
|
||||
|
||||
// Тестовая вставка (можно отключить закомментировав строку ниже)
|
||||
// profileData.profile.privilege_level = 3;
|
||||
// Подгружаем кастомные роли по URL
|
||||
try {
|
||||
const rolesResponse = await axios.get('https://anixart.seele.su/api/is_roles');
|
||||
const rolesList = rolesResponse.data;
|
||||
|
||||
const userRoles = rolesList.find(entry => entry.id === Number(profileId));
|
||||
if (userRoles && Array.isArray(userRoles.roles)) {
|
||||
profileData.profile.roles = userRoles.roles;
|
||||
}
|
||||
} catch {
|
||||
// Ошибку загрузки ролей игнорируем
|
||||
}
|
||||
|
||||
// // Тестовое поле privilege_level (можно отключить)
|
||||
// profileData.profile.privilege_level = 0;
|
||||
|
||||
return {
|
||||
...profileData,
|
||||
|
||||
Reference in New Issue
Block a user