快速概括
#
将安卓上副卡接收到的短信和 linux 下代码运行结果转发到其他的手机上。
工具
#
消息接收 Bark
#
基础 api 格式(除 key 和内容外都可省略)
GET
#
1
| https://api.day.app/YOUR***KEY/[标题]/[内容]/?group=分组1&isArchive=1&sound=alarm&autoCopy=1©=复制内容
|
POST
#
1
2
3
4
5
6
7
8
9
10
11
12
13
| curl -X "POST" "https://api.day.app" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"body": "Test Bark Server",
"device_key": "ynJ5Ft4***eo2PAvFhF",
"title": "bleem",
"badge": 1,
"category": "category",
"sound": "minuet.caf",
"icon": "https://day.app/assets/images/avatar.jpg",
"group": "test",
"url": "https://mritd.com"
}'
|
短信转发 SmsForwarder
#
短信转发器——监控Android手机短信、来电、APP通知,并根据指定规则转发到其他手机:钉钉机器人、企业微信群机器人、飞书机器人、企业微信应用消息、邮箱、bark、webhook、Telegram机器人、Server酱、PushPlus、手机短信等。
apk 下载 https://www.coolapk.com/apk/com.idormy.sms.forwarder
Bark 对接设置 https://github.com/pppscn/SmsForwarder/wiki/2.%E5%8F%91%E9%80%81%E9%80%9A%E9%81%93#barkios%E6%9C%80%E4%BD%B3%E4%BD%93%E9%AA%8C
linux 结果转发
#
这里使用 function 来获取执行结果:
1
2
3
4
5
| bark(){
output=$($* 2>&1 | tee >(cat 1>&2) | sed -r 's/\x1b\[[0-9;]*[a-zA-Z]//g')
curl --silent --output /dev/null --show-error --fail -G https://api.day.app/YOUR***KEY/?group=linux --data-urlencode "title=$*" --data-urlencode "body=${output:0:1800}" --data-urlencode "copy=$*";
}
export -f bark
|
git push 通知
#
Github Action 通知
#
在 secret 中创建 BARK_KEY,并将 bark 的 key 填入保存。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| name: github pages
on:
push:
branches:
[main, master] # Set a branch to deploy
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true # Fetch * themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup *
uses: peaceiris/actions-*@v2
with:
*-version: 'latest'
extended: true
- name: Build
run: * --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
external_repository: user*/user*.github.io
publish_branch: master
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- name: Bark Notify
run: |
curl -G https://api.day.app/${{ secrets.BARK_KEY }}/?group=action \
--data-urlencode "title=Action [${{ github.event.repository.name }}]" \
--data-urlencode "body=${{ job.status }} -> $(git rev-parse --short "$GITHUB_SHA") ${GITHUB_REF#refs/heads/}"
|
时空乱流记录