From 0f586692defb89bbe0149c96a419eb0ab80344fa Mon Sep 17 00:00:00 2001 From: Alichs Date: Mon, 22 Feb 2021 21:09:15 +0800 Subject: [PATCH 1/2] fixed --- lib/client.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/client.js b/lib/client.js index 78ab1a5..bf6c5de 100644 --- a/lib/client.js +++ b/lib/client.js @@ -12,6 +12,9 @@ let defaultScriptUrl = '//res.wx.qq.com/open/js/jweixin-1.4.0.js'; //default apis with share-on-moment and share-on-chat const defaultApiList = ['onMenuShareTimeline', 'onMenuShareAppMessage']; +// default opentags wx-open-subscribe and wx-open-audio +const defaultopenTagList = ['wx-open-subscribe', 'wx-open-audio']; + class WechatJSSDK { /** * Initialize the WechatJSSDK instance @@ -36,6 +39,7 @@ class WechatJSSDK { this.sdkUrl = this.config.customUrl; } let apiList = this.config.jsApiList; + let tagList = this.config.openTagList; //add more apis if passed in if (!apiList || apiList.length <= 0) { this.config.jsApiList = defaultApiList; @@ -49,6 +53,19 @@ class WechatJSSDK { } } } + //add more tags if passed in + if (!tagList || tagList.length <= 0) { + this.config.openTagList = defaultopenTagList; + } else { + let i = 0; + const length = defaultopenTagList.length; + for (; i < length; i++) { + const defaultItem = defaultopenTagList[i]; + if (tagList.indexOf(defaultItem) < 0) { + tagList.push(defaultItem); + } + } + } this.debug = !!this.config.debug; return this; } @@ -79,6 +96,10 @@ class WechatJSSDK { nonceStr: config.nonceStr || selfConfig.nonceStr, signature: config.signature || selfConfig.signature, jsApiList: selfConfig.jsApiList.slice(0, selfConfig.jsApiList.length), + openTagList: selfConfig.openTagList.slice( + 0, + selfConfig.openTagList.length + ), }; const debug = this.debug; return new Promise((resolve, reject) => { From 3a8cb387bebaf51b9e1dee7f20412788ab6de753 Mon Sep 17 00:00:00 2001 From: Alichs Date: Mon, 22 Feb 2021 21:10:13 +0800 Subject: [PATCH 2/2] v5.0.7 for yuntun --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b6d030e..9f9e03c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wechat-jssdk", - "version": "5.0.6", + "version": "5.0.7", "description": "Next-Generation WeChat JS-SDK integration with NodeJS", "main": "./lib/index.js", "source": "./lib/client.js",