-
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
Showing
5 changed files
with
149 additions
and
1 deletion.
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,29 @@ | ||
name: AutoSign | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '45 10 * * *' | ||
|
||
jobs: | ||
Sign: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Install Node.js, NPM | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14 | ||
|
||
- name: Check out branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: master | ||
|
||
- name: Sign | ||
env: | ||
WANXIANG_TOKEN: ${{ secrets.WANXIANG_TOKEN }} | ||
WANXIANG_COOKIE: ${{ secrets.WANXIANG_COOKIE }} | ||
YIGE_COOKIE: ${{ secrets.YIGE_COOKIE }} | ||
YIGE_TOKEN: ${{ secrets.YIGE_TOKEN }} | ||
run: | | ||
npm ci | ||
npm run start |
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,8 @@ | ||
# 自动签到定时任务 | ||
当前支持的平台有: | ||
- 通义万相 | ||
- 文心一格 | ||
|
||
## 注意事项 | ||
1. 需要先定义好相应的环境变量, 脚本才能正常运行. 添加私有环境变量的路径在: [settings/secrets/actions/new](../../settings/secrets/actions/new). | ||
2. 私有环境变量的名称, 见 [.githu/workflows/sign.yml](./.github/workflows/sign.yml#L22), 私有环境变量的值, 需要自行从对应平台的签到接口抓包. |
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,73 @@ | ||
const fetch = require('node-fetch') | ||
const wanxiang = async () => { | ||
const token = process.env.WANXIANG_TOKEN | ||
const cookie = process.env.WANXIANG_COOKIE | ||
if (!token || !cookie) return | ||
console.log('通义万相 开始签到') | ||
return fetch('https://wanxiang.aliyun.com/wanx/api/common/inspiration/dailySignReward', { | ||
'headers': { | ||
'accept': 'application/json, text/plain, */*', | ||
'accept-language': 'zh-CN,zh;q=0.9', | ||
'content-type': 'application/json', | ||
'priority': 'u=1, i', | ||
'sec-ch-ua': '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"', | ||
'sec-ch-ua-mobile': '?0', | ||
'sec-ch-ua-platform': '"Windows"', | ||
'sec-fetch-dest': 'empty', | ||
'sec-fetch-mode': 'cors', | ||
'sec-fetch-site': 'same-site', | ||
'x-platform': 'web', | ||
'x-xsrf-token': token, | ||
cookie | ||
}, | ||
'referrer': 'https://tongyi.aliyun.com/wanxiang/', | ||
'referrerPolicy': 'no-referrer-when-downgrade', | ||
'body': '{}', | ||
'method': 'POST', | ||
'mode': 'cors', | ||
'credentials': 'include' | ||
}) | ||
.then(res => res.json()) | ||
.then(console.log) | ||
.catch(console.log) | ||
} | ||
|
||
const yige = async () => { | ||
const token = process.env.YIGE_TOKEN | ||
const cookie = process.env.YIGE_COOKIE | ||
if (!token || !cookie) return | ||
console.log('文心一格 开始签到') | ||
return fetch(`https://yige.baidu.com/api/t2p/points/task_complete?t=${+new Date}&appname=pc&ptask_type=6`, { | ||
'headers': { | ||
'accept': 'application/json, text/plain, */*', | ||
'accept-language': 'zh-CN,zh;q=0.9', | ||
'acs-token': token, | ||
'content-type': '*/*', | ||
'sec-ch-ua': '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"', | ||
'sec-ch-ua-mobile': '?0', | ||
'sec-ch-ua-platform': '"Windows"', | ||
'sec-fetch-dest': 'empty', | ||
'sec-fetch-mode': 'cors', | ||
'sec-fetch-site': 'same-origin', | ||
cookie | ||
}, | ||
'referrer': 'https://yige.baidu.com/personal/center', | ||
'referrerPolicy': 'strict-origin-when-cross-origin', | ||
'body': null, | ||
'method': 'GET', | ||
'mode': 'cors', | ||
'credentials': 'include' | ||
}) | ||
.then(res => res.json()) | ||
.then(console.log) | ||
.catch(console.log) | ||
} | ||
|
||
const main = async (sign) => { | ||
return Object.keys(sign).map(key => sign[key]()) | ||
} | ||
|
||
main({ | ||
wanxiang, | ||
yige | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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