Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update some #52

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,7 @@ jobs:
id: run
uses: nick-fields/retry@v2
env:
TY_USER_NAME: ${{secrets.TY_USER_NAME}}
TY_PASSWORD: ${{secrets.TY_PASSWORD}}
TY_USER_NAME1: ${{secrets.TY_USER_NAME1}}
TY_PASSWORD1: ${{secrets.TY_PASSWORD1}}
TY_USER_NAME2: ${{secrets.TY_USER_NAME2}}
TY_PASSWORD2: ${{secrets.TY_PASSWORD2}}
TY_USER_NAME3: ${{secrets.TY_USER_NAME3}}
TY_PASSWORD3: ${{secrets.TY_PASSWORD3}}
TY_USER_NAME4: ${{secrets.TY_USER_NAME4}}
TY_PASSWORD4: ${{secrets.TY_PASSWORD4}}
ACCOUNTS_189CLOUD: ${{ secrets.ACCOUNTS_189CLOUD }}
# Server
SENDKEY: ${{secrets.SENDKEY}}
# Telegram
Expand All @@ -44,6 +35,8 @@ jobs:
# WxPusher
WX_PUSHER_APP_TOKEN: ${{secrets.WX_PUSHER_APP_TOKEN}}
WX_PUSHER_UID: ${{secrets.WX_PUSHER_UID}}
# PushPlus
PUSHPLUS_TOKEN: ${{secrets.PUSHPLUS_TOKEN}}
with:
timeout_minutes: 10
max_attempts: 3
Expand Down
37 changes: 12 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
### 设置账号密码
新版本的git Action 需要创建environment来配合使用,创建一个名为user的环境。
![](https://cdn.jsdelivr.net/gh/wes-lin/Cloud189Checkin/image/env.png)
创建好后编辑user环境,添加两个变量TY_USER_NAME 是你的天翼网盘账号,TY_PASSWORD 是的你密码。现已支持多账户,最多可添加5个账户,第二个账户用户名变量是TY_USER_NAME1,密码变量是TY_PASSWORD1,以此类推,最多到TY_USER_NAME4,TY_PASSWORD4。
![](https://cdn.jsdelivr.net/gh/wes-lin/Cloud189Checkin/image/account.jpg)
创建好后编辑user环境,添加变量ACCOUNTS_189CLOUD,内容是`账号----密码`,一行一个,不要有多余字符。示例如下:
```shell
173xxxxxxxx----aaaabbbb
155xxxxxxxx----aaaabbbb
181xxxxxxxx----aaaabbbb
```
### 设置推送
#### Server酱
为了考虑到不同客户端兼容性,采用了Server酱,只需多配置下SENDKEY
Expand All @@ -25,12 +29,14 @@
- `WECOM_BOT_TELPHONE ` *接收推送手机号*
[群机器人配置说明](https://developer.work.weixin.qq.com/document/path/91770)
#### WxPusher推送
- `WX_PUSHER_APP_TOKEN ` *WxPuser推送AppToken*
- `WX_PUSHER_UID ` *接收推送UID*
- `WX_PUSHER_APP_TOKEN` *WxPuser推送AppToken*
- `WX_PUSHER_UID` *接收推送UID*
默认使用是我的WxPusher,你也可以改成你自己wxPusher开发者账户,修改WX_PUSHER_APP_TOKEN. 如果想直接使用我的wxPush应用,请扫描底下二维码进行关联.
https://wxpusher.zjiecode.com/api/qrcode/4Ix7noqD3L7DMBoSlvig3t4hqjFWzPkdHqAYsg8IzkPreW7d8uGUHi9LJO4EcyJg.jpg
然后拿到UID后,把WX_PUSHER_UID配成你拿到的UID.
![](https://cdn.jsdelivr.net/gh/wes-lin/Cloud189Checkin/image/wxpusher.jpg)
### pushplus推送
- `PUSHPLUS_TOKEN` *pushplus token*
### 执行任务
1. 点击**Action**,再点击**I understand my workflows, go ahead and enable them**
2. 给自己仓库点个start或者修改任意文件后提交一次
Expand Down Expand Up @@ -58,29 +64,10 @@ cd Cloud189Checkin
npm install
```
### 运行
​修改源码中accounts.js 中userName和password为你的天翼账号和密码,不想改动源码,也可以直接把账号密码写到你电脑的环境变量TY_USER_NAME和TY_PASSWORD
``` javascript
module.exports = [{
userName: process.env.TY_USER_NAME || 'userName',
password: process.env.TY_PASSWORD || 'password',
}, {
userName: process.env.TY_USER_NAME1,
password: process.env.TY_PASSWORD1,
}, {
userName: process.env.TY_USER_NAME2,
password: process.env.TY_PASSWORD2,
}, {
userName: process.env.TY_USER_NAME3,
password: process.env.TY_PASSWORD3,
}, {
userName: process.env.TY_USER_NAME4,
password: process.env.TY_PASSWORD4,
}];
```
![](https://cdn.jsdelivr.net/gh/wes-lin/Cloud189Checkin/image/local.png)
​修改源码accounts.js中userName----password为你的天翼账号和密码,不想改动源码,也可以直接把账号密码写到你电脑的环境变量ACCOUNTS_189CLOUD。多账号直接换行。

### 推送
修改serverChan.js 或者添加环境变量SENDKEY
修改serverChan.js或者添加环境变量SENDKEY。

执行命令
``` bash
Expand Down
33 changes: 11 additions & 22 deletions accounts.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
module.exports = [
{
userName: process.env.TY_USER_NAME || "userName",
password: process.env.TY_PASSWORD || "password",
},
{
userName: process.env.TY_USER_NAME1,
password: process.env.TY_PASSWORD1,
},
{
userName: process.env.TY_USER_NAME2,
password: process.env.TY_PASSWORD2,
},
{
userName: process.env.TY_USER_NAME3,
password: process.env.TY_PASSWORD3,
},
{
userName: process.env.TY_USER_NAME4,
password: process.env.TY_PASSWORD4,
},
];
let accountsText = process.env.ACCOUNTS_189CLOUD || `userName----password`;

accountsText = accountsText.trim().replace('\r', '\n').replace('\n\n', '\n').split('\n');

let accounts = [];
for (let i=0; i<accountsText.length; i++) {
a = accountsText[i].split('----');
accounts.push({ userName: a[0], password: a[1] });
}

module.exports = accounts;
29 changes: 29 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const serverChan = require("./push/serverChan");
const telegramBot = require("./push/telegramBot");
const wecomBot = require("./push/wecomBot");
const wxpush = require("./push/wxPusher");
const pushPlus = require("./push/pushPlus");
const accounts = require("../accounts");
const config = require("../config");

Expand Down Expand Up @@ -477,11 +478,39 @@ const pushWxPusher = (title, desp) => {
});
};

const pushPushplus = (title, desp) => {
if (!pushPlus.token) {
return;
}
const data = {
template: "html",
token: pushPlus.token,
title,
content: desp,
};
superagent
.post("http://www.pushplus.plus/send")
.send(data)
.end((err, res) => {
if (err) {
logger.error(`pushPlus推送失败:${JSON.stringify(err)}`);
return;
}
const json = JSON.parse(res.text);
if (json.code !== 200) {
logger.error(`pushPlus推送失败:${JSON.stringify(json)}`);
} else {
logger.info("pushPlus推送成功");
}
});
};

const push = (title, desp) => {
pushServerChan(title, desp);
pushTelegramBot(title, desp);
pushWecomBot(title, desp);
pushWxPusher(title, desp);
pushPushplus(title, desp);
};

// 开始执行程序
Expand Down
3 changes: 3 additions & 0 deletions src/push/pushPlus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
token: process.env.PUSHPLUS_TOKEN || '',
};