Skip to content
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
5 changes: 2 additions & 3 deletions .github/workflows/pause.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- cron: '0 16 * * *'

jobs:
build:
pause:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -22,5 +22,4 @@ jobs:
run: |
node main.js
env:
LEISHEN_USERNAME: ${{ secrets.LEISHEN_USERNAME }}
LEISHEN_PASSWORD: ${{ secrets.LEISHEN_PASSWORD }}
LEISHEN_ACCOUNT_TOKEN: ${{ secrets.LEISHEN_ACCOUNT_TOKEN }}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## 📐部署

1. Fork 仓库
3. 设置雷神账号密码
3. 设置雷神账号的 account_token
3. 启用 Action


Expand All @@ -20,18 +20,18 @@

- 将仓库默认分支设置为 master 分支

### 2. 设置雷神账号密码

### 2. 设置雷神账号的 account_token
- 使用电脑登录雷神加速器官网,点击右上角头像,然后按 F12 打开开发者工具,找到`Application`选项卡,点击左侧`Storage`-->`Local Storage`-->`https://vip.leigod.com`,找到`account_token`,复制其值
- ![image.png](https://s2.loli.net/2025/01/22/tnp6wIjDWaeSBkN.png)
- 选择`账号设置`,在`账号设置`页面找到`账号Token`,点击`复制`按钮
- 回到项目页面,依次点击`Settings`-->`Secrets`-->`New secret`

![new-secret.png](https://i.loli.net/2020/10/28/sxTuBFtRvzSgUaA.png)

![add-secret](https://i.loli.net/2021/04/08/ZtAw6Qmcrq2S5de.png)
![new-secret.png](https://s2.loli.net/2025/01/22/ZLcmqzhpMUPBODf.png)
![add-secret](https://s2.loli.net/2025/01/23/C9EdjuWvQDsgRGl.png)

- LEISHEN_USERNAME 账号
- LEISHEN_PASSWORD 密码
- LEISHEN_ACCOUNT_TOKEN 账户Token

依次配置 账号密码
配置好 account_token

### 3. 启用 Actions

Expand Down
10 changes: 1 addition & 9 deletions api/auth.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
const request = require('../utils/request');

function login(data) {
return request({
url: '/api/auth/login/v1',
method: 'post',
data
})
}

function pause(data) {
return request({
url: '/api/user/pause',
Expand All @@ -16,4 +8,4 @@ function pause(data) {
})
}

module.exports = {login, pause}
module.exports = {pause}
86 changes: 18 additions & 68 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,32 @@
md5 = require('js-md5');
crypto = require('crypto');

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

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


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

const sign_user_request = sign(user)
login(sign_user_request).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.data.code + ':' + res2.data.msg);
console.log('🌀雷神加速器暂停助手 成功-------')
try {
const res = await pause({"account_token": account_token, "lang": "zh_CN"});

})
} else {
console.log('🌀雷神加速器暂停助手 失败-------')
if (res.data.code !== 0) {
if (res.data.code === 400803) { // 400803 - 账号已经停止加速,请不要重复操作
console.warn(`🟡雷神加速器暂停成功: ${res.data.code} - ${res.data.msg}`);
return;
}
console.error(`🔴雷神加速器暂停失败: ${res.data.code} - ${res.data.msg}`);
process.exit(1); // 非零退出码可以让 GitHub Action 失败
}
console.log('🌀雷神加速器暂停助手 结束运行-------')
})


}

function sign(t) {
const a = Math.floor((new Date).getTime() / 1e3).toString()
, n = {
ts: a,
...t
console.log(res.data.code + ':' + res.data.msg);
console.log('🌀雷神加速器暂停助手 成功-------')
} catch (error) {
console.error('🔴雷神加速器暂停失败:', error.message);
process.exit(1);
}
, s = Object.keys(n).sort()
, o = {};
for (const t of s)
o[t] = n[t];
const r = queryString({
...o,
key: "5C5A639C20665313622F51E93E3F2783"
}, !1).toString();
return console.log("signal", r),
{
...t,
ts: a,
sign: hexMD5(r)
}

console.log('🌀雷神加速器暂停助手 结束运行-------')
}
function queryString(t, e = true) {
return Object.entries(t)
.map(([t, i]) => `${t}=${e ? encodeURIComponent(i) : i}`)
.join("&");
}

function hexMD5(str) {
return crypto.createHash('md5').update(str).digest('hex');
}


start(Secrets.username, Secrets.password);
start(Secrets.account_token);
37 changes: 26 additions & 11 deletions package-lock.json

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

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