为enka api的系统配置中增加UA字段

This commit is contained in:
yoimiya-kokomi 2022-07-30 01:54:09 +08:00
parent f58ad4fd81
commit 1239cbfae7
3 changed files with 6 additions and 3 deletions

View File

@ -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) {

View File

@ -7,7 +7,9 @@
/*
* Enka面板服务API配置
* *
* 默认地址https://enka.shinshin.moe/
* Enka官网https://enka.shinshin.moe/
* *
* 其余API待确认后添加
* */
export const enkaApi = {
url: 'https://enka.shinshin.moe/',

View File

@ -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`
}