部署自己的私人推送服务。
源码:
https://github.com/Finb/bark-server
服务器端:
docker run -dt --name bark -p 8080:8080 -v /root/bark-data:/data finab/bark-server
Nginx 反代:
location / {
log_not_found on;
proxy_pass http://127.0.0.1:8080;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
Windows 生成配置,针对手机端 token:
bark-cli.exe --host=https://localhost -k=oJrNy4mDNQDFu0kyoU config set
路径为:
C:\Users\Administrator\bark-cli\bark-cli.json
使用配置:
bark-cli.exe -f=C:\Users\Administrator\bark-cli\bark-cli.json
测试:-X POST
/-X GET
# bark
bark-cli -X POST --host=https://localhost -p=443 -k=oJrNy4mDNQDFu0kyoU -t=文本 -b=测试 bark
# url
bark-cli -X POST --host=https://localhost -p=443 -k=oJrNy4mDNQDFu0kyoU -t=链接 -b=测试 -u=https://google.com url
# copy
bark-cli -X POST --host=https://localhost -p=443 -k=oJrNy4mDNQDFu0kyoU -t=复制 -b=测试9527 -c=9527 -a=true copy
iOS:
https://apps.apple.com/cn/app/bark-customed-notifications/id1403753865
Chrome 插件(选定文字+当前 Page url 推送):
https://chrome.google.com/webstore/detail/bark/pmlkbdbpglkgbgopghdcmohdcmladeii
Windows 的 BarkHelper
https://github.com/HsuDan/BarkHelper
不能指定私人服务。
bark.py 代码块
# 安装 pyperclip
# pip install urllib3
# pip install pyperclip
from urllib.request import quote
item = pyperclip.paste()
utf8item = item.encode('utf-8')
url = 'https://localhost/oJrNy4mDNQDFu0kyoU/'+quote(utf8item)
res = requests.get(url)
jsonres = json.loads(res.text)
result = jsonres['code']
if result == 200:
print('推送成功!')
else:
print('推送失败!')
input()
安卓:
https://github.com/xlvecle/PushLite
Handoff4Windows:
https://github.com/authorTp/Handoff4Windows
更新 2020-06-27