From 3fe34545b99a6d4695dfe2e6456ea54bca70f393 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sat, 13 May 2023 11:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=BA=90=E4=BA=8C=E8=BF=9B=E5=88=B6=E6=95=B0=E6=8D=AE=E4=BC=A0?= =?UTF-8?q?=E8=BE=93=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/modules/userApi/renderer/preload.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/modules/userApi/renderer/preload.js b/src/main/modules/userApi/renderer/preload.js index c32787e9..8c5d5dfa 100644 --- a/src/main/modules/userApi/renderer/preload.js +++ b/src/main/modules/userApi/renderer/preload.js @@ -140,11 +140,15 @@ const handleShowUpdateAlert = (data, resolve, reject) => { contextBridge.exposeInMainWorld('lx', { EVENT_NAMES, - request(url, { method = 'get', timeout, headers, body, form, formData }, callback) { + request(url, { method = 'get', timeout, headers, body, form, formData, bodyBinaryBase64 }, callback) { let options = { headers } let data if (body) { data = body + } else if (bodyBinaryBase64) { + try { + data = Buffer.from(bodyBinaryBase64, 'base64') + } catch {} } else if (form) { data = form // data.content_type = 'application/x-www-form-urlencoded' @@ -253,7 +257,7 @@ contextBridge.exposeInMainWorld('lx', { }, }, }, - version: '1.3.0', + version: '1.4.0', // removeEvent(eventName, handler) { // if (!eventNames.includes(eventName)) return Promise.reject(new Error('The event is not supported: ' + eventName)) // let handlers