Add API key config

This commit is contained in:
Algoinde 2022-07-29 19:59:25 +05:00 committed by GitHub
parent f27735d0e0
commit e6f1621be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,9 @@ 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) {
api += '?key=' + diyCfg.enkaApi.apiKey
}
let headers = {headers: {'User-Agent': diyCfg?.enkaApi?.userAgent || sysCfg.enkaApi.userAgent}}
let req = await fetch(api, headers)
let data = await req.json()