remove server chan service

This commit is contained in:
lizheming
2018-03-23 09:53:12 +08:00
parent 3d2f8941f1
commit e38559fd09
3 changed files with 3 additions and 78 deletions
+1 -28
View File
@@ -11,7 +11,7 @@ Drone plugin for sending wechat notifications.
## Description
This drone wechat notification plugin builds base on Wechat for Work. You can config your own wechat corp id, or you can get wechat notification quickly with key from [ServerChan](http://sc.ftqq.com). If you use [ServerChan](http://sc.ftqq.com) you need get `SCKEY` before using. After login with Github account you can get `SCKEY` at http://sc.ftqq.com/?c=code.
This drone wechat notification plugin builds base on Wechat for Work.
Read this in other languages: [English](README.md), [简体中文](README.zh-cn.md).
@@ -32,15 +32,11 @@ Read this in other languages: [English](README.md), [简体中文](README.zh-cn.
- `PLUGIN_SAFE`: encrypt message, default is false
- `PLUGIN_MSG_URL`: The link for the text card click
- `PLUGIN_BTN_TEXT`: The text for the button on the card
- `PLUGIN_SCKEY`: SCKEY get from [ServerChan](http://sc.ftqq.com)
- `WECHAT_SCKEY`: alias for `PLUGIN_SCKEY`
- `PLUGIN_TITLE`: Notification title
- `PLUGIN_MESSAGE`: Notification body message, support markdown.
## Usage
### With wechat corp id
```
docker run --rm \
-e PLUGIN_CORPID=corpid \
@@ -69,26 +65,3 @@ docker run --rm \
-e DRONE_JOB_FINISHED=1477550750 \
lizheming/drone-wechat
```
### With server chan key
```
docker run --rm \
-e PLUGIN_SCKEY=xxxx \
-e PLUGIN_TITLE=xxxx \
-e PLUGIN_MESSAGE=xxx \
-e DRONE_REPO_OWNER=lizheming \
-e DRONE_REPO_NAME=drone-wechat \
-e DRONE_COMMIT_SHA=e5e82b5eb3737205c25955dcc3dcacc839b7be52 \
-e DRONE_COMMIT_BRANCH=master \
-e DRONE_COMMIT_LINK=https://github.com/lizheming/drone-wechat/compare/master... \
-e DRONE_COMMIT_AUTHOR=lizheming \
-e DRONE_COMMIT_AUTHOR_EMAIL=secretlzm007@gmail.com \
-e DRONE_BUILD_NUMBER=1 \
-e DRONE_BUILD_STATUS=success \
-e DRONE_BUILD_LINK=http://github.com/lizheming/drone-wechat \
-e DRONE_TAG=1.0.0 \
-e DRONE_JOB_STARTED=1477550550 \
-e DRONE_JOB_FINISHED=1477550750 \
lizheming/drone-wechat
```
+1 -28
View File
@@ -13,7 +13,7 @@ drone 微信消息通知插件。
## 简介
基于微信企业号封装的 drone 微信消息通知插件。你可以设置自己的企业号,也可以使用 [Server酱]( http://sc.ftqq.com/) 来快速配置微信消息通知功能。如果使用 [Server酱]( http://sc.ftqq.com/) 需要在使用前获取密钥。Github 登录后即可在 [发送消息](http://sc.ftqq.com/?c=code) 页面查看。
基于微信企业号封装的 drone 微信消息通知插件。
## 配置说明
@@ -32,15 +32,11 @@ drone 微信消息通知插件。
- `PLUGIN_SAFE`: 表示是否是保密消息,0表示否,1表示是,默认0
- `PLUGIN_MSG_URL`: 点击后跳转的链接。
- `PLUGIN_BTN_TEXT`: 按钮文字。 默认为“详情”, 不超过4个文字,超过自动截断。
- `PLUGIN_SCKEY`: [Server酱](http://sc.ftqq.com) 申请的密钥
- `WECHAT_SCKEY`: `PLUGIN_SCKEY` 别名
- `PLUGIN_TITLE`: 消息卡片标题
- `PLUGIN_MESSAGE`: 消息卡片正文,支持 Markdown。
## 如何使用
### 自行配置微信企业号
```
docker run --rm \
-e PLUGIN_CORPID=corpid \
@@ -68,27 +64,4 @@ docker run --rm \
-e DRONE_JOB_STARTED=1477550550 \
-e DRONE_JOB_FINISHED=1477550750 \
lizheming/drone-wechat
```
### 使用Server酱快速集成
```
docker run --rm \
-e PLUGIN_SCKEY=xxxx \
-e PLUGIN_TITLE=xxxx \
-e PLUGIN_MESSAGE=xxx \
-e DRONE_REPO_OWNER=lizheming \
-e DRONE_REPO_NAME=drone-wechat \
-e DRONE_COMMIT_SHA=e5e82b5eb3737205c25955dcc3dcacc839b7be52 \
-e DRONE_COMMIT_BRANCH=master \
-e DRONE_COMMIT_LINK=https://github.com/lizheming/drone-wechat/compare/master... \
-e DRONE_COMMIT_AUTHOR=lizheming \
-e DRONE_COMMIT_AUTHOR_EMAIL=secretlzm007@gmail.com \
-e DRONE_BUILD_NUMBER=1 \
-e DRONE_BUILD_STATUS=success \
-e DRONE_BUILD_LINK=http://github.com/lizheming/drone-wechat \
-e DRONE_TAG=1.0.0 \
-e DRONE_JOB_STARTED=1477550550 \
-e DRONE_JOB_FINISHED=1477550750 \
lizheming/drone-wechat
```
+1 -22
View File
@@ -21,30 +21,10 @@ const {
PLUGIN_MSG_URL,
PLUGIN_BTN_TEXT,
PLUGIN_SCKEY,
WECHAT_SERVER_CHAN_KEY,
PLUGIN_TITLE,
PLUGIN_MESSAGE
} = process.env;
function sendMsgFromServerChan() {
const SCKEY = PLUGIN_SCKEY || WECHAT_SERVER_CHAN_KEY;
if (!SCKEY) {
return false;
}
request({
url: `https://sc.ftqq.com/${SCKEY}.send`,
qs: {
text: PLUGIN_TITLE,
desp: render(PLUGIN_MESSAGE)
}
});
return true;
}
function getAccessToken() {
const CORPID = PLUGIN_CORPID || WECHAT_CORPID;
const CORP_SECRET = PLUGIN_CORP_SECRET || WECHAT_CORP_SECRET;
@@ -109,9 +89,8 @@ function sendMsgFromWechat() {
});
}
sendMsgFromServerChan() || sendMsgFromWechat();
sendMsgFromWechat();
module.exports = {
sendMsgFromServerChan,
getAccessToken,
sendMsgFromWork,
sendMsgFromWechat