From 286851d531c5eeef03b10425acb60a636f271bed Mon Sep 17 00:00:00 2001 From: Kokomi <102026640+yoimiya-kokomi@users.noreply.github.com> Date: Mon, 28 Nov 2022 03:35:57 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E4=BF=AE=E6=AD=A3enka=20HttpsProxyAgent?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20*=20=E4=BF=AE=E6=AD=A3=E5=9C=A3=E9=81=97?= =?UTF-8?q?=E7=89=A9=E5=88=86=E6=95=B0=E8=AE=A1=E7=AE=97=E6=97=B6=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=A7=92=E8=89=B2=E7=9A=84=E6=80=BB=E5=88=86=E4=B8=8A?= =?UTF-8?q?=E9=99=90=E8=AE=A1=E7=AE=97=E9=81=97=E6=BC=8F=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=AF=BC=E8=87=B4=E6=A1=A3=E4=BD=8D=E7=88=86=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/profile-data/enka.js | 14 ++++++++++++-- resources/character/artis-mark.html | 7 +++++++ resources/character/profile-detail.html | 2 +- resources/meta/artifact/meta.js | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/components/profile-data/enka.js b/components/profile-data/enka.js index 7360d6cf..bab155b0 100644 --- a/components/profile-data/enka.js +++ b/components/profile-data/enka.js @@ -3,6 +3,8 @@ import { Data } from '../index.js' import { ProfileServ } from '../../models/index.js' import EnkaData from './enka-data.js' +let HttpsProxyAgent = '' + export default new ProfileServ({ id: 'enka', cfgKey: 'enkaApi', @@ -14,8 +16,16 @@ export default new ProfileServ({ } let proxy = this.getCfg('proxyAgent') if (proxy) { - let HttpsProxyAgent = await import('https-proxy-agent') - params.agent = new HttpsProxyAgent(proxy) + + if (HttpsProxyAgent === '') { + HttpsProxyAgent = await import('https-proxy-agent').catch((err) => { + logger.error(err) + }) + HttpsProxyAgent = HttpsProxyAgent ? HttpsProxyAgent.default : undefined + } + if (HttpsProxyAgent) { + params.agent = new HttpsProxyAgent(proxy) + } } return { api, params } }, diff --git a/resources/character/artis-mark.html b/resources/character/artis-mark.html index 63d7f449..c3799aca 100644 --- a/resources/character/artis-mark.html +++ b/resources/character/artis-mark.html @@ -101,6 +101,13 @@ <% } %> +{{if changeProfile}} +