Merge remote-tracking branch 'origin/master'

This commit is contained in:
yoimiya-kokomi 2022-08-04 01:52:10 +08:00
commit 7b47b5f3bc
2 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import fetch from 'node-fetch'
import EnkaData from './enka-data.js'
import HttpsProxyAgent from "https-proxy-agent";
let Enka = {
key: 'enka',
cd: 5,
@ -11,8 +11,11 @@ let Enka = {
if (diyCfg?.enkaApi?.apiKey) {
api += '?key=' + diyCfg.enkaApi.apiKey
}
let headers = { headers: { 'User-Agent': diyCfg?.enkaApi?.userAgent || sysCfg.enkaApi.userAgent } }
let req = await fetch(api, headers)
let config = { headers: { 'User-Agent': diyCfg?.enkaApi?.userAgent || sysCfg.enkaApi.userAgent } }
if (diyCfg?.enkaApi?.proxyAgent){
config.agent=new HttpsProxyAgent(diyCfg.enkaApi.proxyAgent)
}
let req = await fetch(api, config)
let data = await req.json()
if (!data.playerInfo) {
e.reply(`请求失败:${data.msg || '可能是面板服务并发过高,请稍后重试'}`)

View File

@ -19,10 +19,13 @@
* 推荐使用广州上海节点如访问enka官网相对稳定的话推荐优先使用官方地址
* 感谢@MiniGrayGay 大佬提供的服务(Github: https://github.com/MiniGrayGay)
*
* 使用代理(科学上网)可以配置proxyAgent
* 例如: http://127.0.0.1:1080
* */
export const enkaApi = {
url: 'https://enka.network/'
url: 'https://enka.network/',
proxyAgent:''
}
/*