forked from himcs/LeishenAuto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
himcs
committed
Nov 2, 2020
1 parent
d14177b
commit 66798dc
Showing
5 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: 雷神自动停止加速 | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.event.repository.owner.id == github.event.sender.id | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Use Node.js 10.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 10.x | ||
- name: npm install | ||
run: | | ||
npm install | ||
- name: "运行 【暂停】" | ||
run: | | ||
node main.js | ||
env: | ||
USERNAME: ${{ secrets.LEISHEN_USERNAME }} | ||
PASSWORD: ${{ secrets.LEISHEN_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const request = require('../utils/request'); | ||
|
||
function login(data) { | ||
return request({ | ||
url: '/api/auth/login', | ||
method: 'post', | ||
data | ||
}) | ||
} | ||
|
||
function pause(data) { | ||
return request({ | ||
url: '/api/user/pause', | ||
method: 'post', | ||
data | ||
}) | ||
} | ||
|
||
module.exports = {login, pause} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const login = require("./api/auth").login; | ||
const pause = require("./api/auth").pause; | ||
|
||
const Secrets = { | ||
username: process.env.LEISHEN_USERNAME, | ||
password: process.env.LEISHEN_PASSWORD | ||
} | ||
|
||
|
||
function start(username, password) { | ||
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 | ||
}; | ||
|
||
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); | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
|
||
start(Secrets.username, Secrets.password); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"axios": "^0.21.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const axios = require('axios'); | ||
const service = axios.create({ | ||
//https://webapi.leigod.com | ||
baseURL: process.env.VUE_APP_BASE_API || "https://webapi.leigod.com/", // url = base url + request url | ||
// withCredentials: true, // send cookies when cross-domain requests | ||
timeout: 5000 // request timeout | ||
}) | ||
|
||
module.exports = service |