From 1239cbfae783d60a8e32a40567f9566361024733 Mon Sep 17 00:00:00 2001 From: yoimiya-kokomi <592981798@qq.com> Date: Sat, 30 Jul 2022 01:54:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAenka=20api=E7=9A=84=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=AD=E5=A2=9E=E5=8A=A0UA=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/profile-data/enka.js | 4 ++-- config/profile_default.js | 4 +++- config/system/profile.js | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/profile-data/enka.js b/components/profile-data/enka.js index bfe1a6df..7131e98c 100644 --- a/components/profile-data/enka.js +++ b/components/profile-data/enka.js @@ -9,10 +9,10 @@ let Enka = { let url = diyCfg?.enkaApi?.url || sysCfg.enkaApi.url let profileApi = diyCfg?.enkaApi?.listApi || sysCfg.enkaApi.listApi let api = profileApi({ url, uid, avatar }) - if(diyCfg?.enkaApi?.apiKey) { + if (diyCfg?.enkaApi?.apiKey) { api += '?key=' + diyCfg.enkaApi.apiKey } - let headers = {headers: {'User-Agent': diyCfg?.enkaApi?.userAgent || sysCfg.enkaApi.userAgent}} + 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) { diff --git a/config/profile_default.js b/config/profile_default.js index 8bcb0be5..31f5c127 100644 --- a/config/profile_default.js +++ b/config/profile_default.js @@ -7,7 +7,9 @@ /* * Enka面板服务API配置 * * -* 默认地址:https://enka.shinshin.moe/ +* Enka官网:https://enka.shinshin.moe/ +* * +* 其余API待确认后添加 * */ export const enkaApi = { url: 'https://enka.shinshin.moe/', diff --git a/config/system/profile.js b/config/system/profile.js index e8063352..3ff5186c 100644 --- a/config/system/profile.js +++ b/config/system/profile.js @@ -23,6 +23,7 @@ export const miaoApi = { export const enkaApi = { url: 'https://enka.shinshin.moe/', + userAgent: 'Miao-Plugin/3.0', listApi: ({ url, uid }) => { return `${url}u/${uid}/__data.json` }