Skip to content

Commit

Permalink
登录逻辑变更
Browse files Browse the repository at this point in the history
  • Loading branch information
himcs committed Apr 8, 2021
1 parent 87f8283 commit 9ca0e73
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pause.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: 雷神自动停止加速
on:
push:
schedule:
# 定时任务,北京时间24点执行任务 16 + 8 = 24
- cron: '0 16 * * *'

jobs:
Expand All @@ -17,7 +18,7 @@ jobs:
- name: npm install
run: |
npm install
- name: "运行 【暂停】"
- name: "雷神加速器暂停脚本"
run: |
node main.js
env:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
雷神加速器 自动暂停API
## 🌀简介

为了防止自己忘记关闭加速器,浪费宝贵的时间(Money),于是了这个项目,实现每日自动暂停加速
为了防止自己忘记关闭加速器,浪费宝贵的时间(Money),于是了这个项目,实现每天0点自动暂停加速

## 📐部署

Expand Down Expand Up @@ -38,5 +38,6 @@
> Actions 默认为关闭状态,Fork 之后需要手动执行一次,若成功运行其才会激活。
返回项目主页面,点击上方的`Actions`,再点击左侧的`雷神自动停止加速`,再点击`Run workflow`


类似下图
![run](https://i.loli.net/2020/10/28/5ylvgdYf9BDMqAH.png)
31 changes: 22 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,47 @@
md5 = require('js-md5');


const login = require("./api/auth").login;
const pause = require("./api/auth").pause;

const Secrets = {
username: process.env.LEISHEN_USERNAME,
password: process.env.LEISHEN_PASSWORD
password: md5(process.env.LEISHEN_PASSWORD)
}


function start(username, password) {
console.log('🌀雷神加速器暂停助手 开始运行-------')
if (!username || !password) {
console.log("Empty username or password");
return;
}
const user = {
"username": username,
"password": password,
"user_type": "0",
"src_channel": "guanwang",
"lang": "zh_CN",
"region_code": 1
account_token: null,
country_code: 86,
lang: "zh_CN",
password: Secrets.password,
region_code: 1,
src_channel: "guanwang",
user_type: "0",
username: Secrets.username
};

login(user).then(res => {
if (res.data.code == 0) {
let account_token = res.data.data.login_info.account_token;
pause({"account_token": account_token, "lang": "zh_CN"}).then(res2 => {
console.log(res2);
pause({ "account_token": account_token, "lang": "zh_CN" }).then(res2 => {
console.log(res2.data.code + ':' + res2.data.msg);
console.log('🌀雷神加速器暂停助手 成功-------')

})
} else {
console.log('🌀雷神加速器暂停助手 失败-------')
}
console.log('🌀雷神加速器暂停助手 结束运行-------')
})


}


Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": {
"axios": "^0.21.0"
"axios": "^0.21.0",
"js-md5": "^0.7.3"
}
}

0 comments on commit 9ca0e73

Please sign in to comment.