From 7f1082c68a321b1a6b32473f770554af89e8b3e2 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Mon, 24 Apr 2023 23:41:13 +0700 Subject: [PATCH] I hate electron --- src/rest/APIRequest.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/rest/APIRequest.js b/src/rest/APIRequest.js index b879545..866bd9d 100644 --- a/src/rest/APIRequest.js +++ b/src/rest/APIRequest.js @@ -33,12 +33,18 @@ class APIRequest { make(captchaKey = undefined, captchaRqtoken = undefined) { // Ciphers - const defaultCiphers = tls.DEFAULT_CIPHERS.split(':'); - const temp = _.permutations(defaultCiphers.slice(0, 5), 5).filter( - x => JSON.stringify(x) !== JSON.stringify(defaultCiphers.slice(0, 5)), - ); - tls.DEFAULT_CIPHERS = [...temp[Math.floor(Math.random() * temp.length)], ...defaultCiphers.slice(5)].join(':'); - crypto.constants.defaultCipherList = tls.DEFAULT_CIPHERS; + try { + const defaultCiphers = tls.DEFAULT_CIPHERS.split(':'); + const temp = _.permutations(defaultCiphers.slice(0, 5), 5).filter( + x => JSON.stringify(x) !== JSON.stringify(defaultCiphers.slice(0, 5)), + ); + tls.DEFAULT_CIPHERS = [...temp[Math.floor(Math.random() * temp.length)], ...defaultCiphers.slice(5)].join(':'); + crypto.constants.defaultCipherList = tls.DEFAULT_CIPHERS; + // eslint-disable-next-line no-unused-vars + } catch (_) { + // Ignore + // I hate Electron Node.js + } if (agent === null) { if (typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0) {