npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yapi-plugin-notifier

v1.0.2

Published

自定义通知机器人,支持多种类型通知

Downloads

29

Readme

yapi-plugin-notifier

自定义通知机器人,支持多种类型通知。使用过程中如果碰到任何bug或有任何好的的建议欢迎issue。

功能

  • [x] 支持webhook
  • [x] 支持企业微信机器人
  • [x] 支持钉钉机器人
  • [x] 支持签名密钥更安全(企业微信不支持)
  • [x] 支持测试发送
  • [x] 支持关键词白名单
  • [ ] 其他机器人

安装

第一步:在config.json这层目录下运行 yapi plugin --name yapi-plugin-notifier安装插件

第二步:修改config.json的配置

{
    "name": "notifier",
    "options": {
      "host": "http://localhost:3000"
    }
}

host必须配置,否则通知中的链接点击无法正常跳转。

第三步: 重启服务器

使用

机器人配置

配置 在每个项目的设置处新增通知设置,根据需求选择相应的配置,直接在通知地址处输入机器人地址或者webhook的url即可。

白名单配置

消息白名单目前检测是markdown格式的消息是否包含任意一个白名单中的关键词。怎么看消息中有哪些关键词?切换到动态中,查找到希望被自定义通知收到的消息,然后选择其中部分文字作为关键词即可。

如果不设置白名单则表示任意消息都会被推送,设置后只有消息中包含白名单中任意关键词才会推送。

关键词示例

注意不要把链接文本和普通文本作为一个关键词,如上图可以公共分类或者添加了接口作为关键词,但是不要使用公共分类 添加了接口作为关键词。

测试发送

机器人配置完成之后,点击测试发送即可发送一条测试信息到目标机器人中。

更新

通过yapi-cli更新插件还是比较麻烦的,直接再执行一次命令并不会更新。因为yapi-cli安装插件实际上就是在vendors目录下执行npm install --registry https://registry.npm.taobao.org yapi-plugin-notifier,所以最后会在package.json文件中记录下开始安装的版本号,再次执行安装的还是同一个版本。

执行如下操作可以进行更新:

  1. 需要先清除ykit的缓存,删除./vendors/node_modules/.ykit_cache文件夹
  2. 修改package.json里面yapi-plugin-notifier的版本或者直接npm i yapi-plugin-notifier@version
  3. ./vendors/目录中执行命令NODE_ENV=production ykit pack -m
  4. 在config.json这层目录下执行命令yapi plugin --name yapi-plugin-notifier后再重启服务器就完成安装指定版本的插件

注意事项

  1. 企业微信每个机器人发送的消息不能超过20条/分钟,最新内容参考消息发送频率限制,建议在配置短时间频繁更改的情况下关闭通知的开关。
  2. 钉钉每个机器人每分钟最多发送20条,参考消息发送频率限制
  3. 由于检测的消息是markdown格式,所以设置时尽量不要设置链接中容易被包含的http之类的,同理一个关键词不要包含链接文本和非链接文本。

感谢https://github.com/zgs225/yapi-plugin-dding提供的参考,一个受欢迎的钉钉机器人推送插件。