From cdcbae2de91cf0548a040d92e214e7cd97d31970 Mon Sep 17 00:00:00 2001 From: Folltoshe Date: Wed, 5 Apr 2023 12:50:42 +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=90zlib=E6=A8=A1=E5=9D=97=E7=9A=84=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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/modules/userApi/renderer/preload.js b/src/main/modules/userApi/renderer/preload.js index 8e9a52c9..a6964e79 100644 --- a/src/main/modules/userApi/renderer/preload.js +++ b/src/main/modules/userApi/renderer/preload.js @@ -1,5 +1,6 @@ const { contextBridge, ipcRenderer } = require('electron') const needle = require('needle') +const zlib = require('zlib') const { createCipheriv, publicEncrypt, constants, randomBytes, createHash } = require('crypto') const USER_API_RENDERER_EVENT_NAME = require('../rendererEvent/name') @@ -233,8 +234,16 @@ contextBridge.exposeInMainWorld('lx', { return Buffer.from(buf, 'binary').toString(format) }, }, + zlib: { + inflate(...args) { + return zlib.inflateSync(...args) + }, + deflate(...args) { + return zlib.deflateSync(...args) + }, + }, }, - version: '1.2.0', + version: '1.2.1', // removeEvent(eventName, handler) { // if (!eventNames.includes(eventName)) return Promise.reject(new Error('The event is not supported: ' + eventName)) // let handlers @@ -255,4 +264,4 @@ contextBridge.exposeInMainWorld('lx', { // handlers.splice(0, handlers.length) // } // }, -}) +}) \ No newline at end of file