From f27735d0e0fc2033d921d3b556f538fdd34c349d Mon Sep 17 00:00:00 2001 From: Algoinde Date: Fri, 29 Jul 2022 19:51:10 +0500 Subject: [PATCH] Update enka.js --- components/profile-data/enka.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/profile-data/enka.js b/components/profile-data/enka.js index de8cb570..d5e5beaf 100644 --- a/components/profile-data/enka.js +++ b/components/profile-data/enka.js @@ -9,7 +9,8 @@ let Enka = { let url = diyCfg?.enkaApi?.url || sysCfg.enkaApi.url let profileApi = diyCfg?.enkaApi?.listApi || sysCfg.enkaApi.listApi let api = profileApi({ url, uid, avatar }) - let req = await fetch(api) + let headers = {headers: {'User-Agent': diyCfg?.enkaApi?.userAgent || sysCfg.enkaApi.userAgent}} + let req = await fetch(api, headers) let data = await req.json() if (!data.playerInfo) { e.reply(`请求失败:${data.msg || '可能是面板服务并发过高,请稍后重试'}`)