From 100ab9626ad514b7c038e5b48a18e068716a5a46 Mon Sep 17 00:00:00 2001 From: CaoMeiYouRen <996881204@qq.com> Date: Fri, 18 Feb 2022 20:25:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20colors=20=E5=9C=A8?= =?UTF-8?q?=E9=9D=9E=20Node=20=E7=AB=AF=E7=9A=84=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=EF=BC=9B=E4=BC=98=E5=8C=96=E6=96=87=E6=A1=A3=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- package.json | 2 +- src/utils/helper.ts | 20 +++++++++++++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f416f3d..3e01f1e 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@

-> Push All In One!支持 Server酱、酷推、邮件、钉钉机器人、企业微信机器人、企业微信应用、pushplus、iGot 等多种推送方式。 +> Push All In One!支持 Server酱、酷推、邮件、钉钉机器人、企业微信机器人、企业微信应用、pushplus、iGot 、Qmsg、息知等多种推送方式。 > -> 温馨提示:出于安全考虑,**所有**推送方式请在**服务端**使用!请勿在**客户端**使用! +> 温馨提示:出于安全考虑,**所有**推送方式请在**服务端**使用!请勿在**客户端(网页端)**使用!网页端使用还将额外产生跨域问题。 ### 🏠 [主页](https://github.com/CaoMeiYouRen/push-all-in-one#readme) diff --git a/package.json b/package.json index 88ca6f9..712168d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "push-all-in-one", "version": "2.1.0", - "description": "Push All In One!支持 Server酱、酷推、邮件、钉钉机器人、企业微信机器人、企业微信应用、pushplus、iGot等多种推送方式", + "description": "Push All In One!支持 Server酱、酷推、邮件、钉钉机器人、企业微信机器人、企业微信应用、pushplus、iGot 、Qmsg、息知等多种推送方式", "author": "CaoMeiYouRen", "license": "MIT", "main": "dist/index.js", diff --git a/src/utils/helper.ts b/src/utils/helper.ts index 02ecdb7..40f6f8d 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -1,9 +1,23 @@ -import colors from 'colors' +// import colors from 'colors' + +let colors: any + +if (globalThis.process && typeof globalThis.process.on === 'function') { + import('colors').then((value) => { + colors = value.default + }).catch(console.error) +} export function warn(text: any): void { - console.warn(colors.yellow(text)) + if (colors) { + text = colors.yellow(text) + } + console.warn(text) } export function error(text: any): void { - console.error(colors.red(text)) + if (colors) { + text = colors.red(text) + } + console.error(text) }