GithubHelp home page GithubHelp logo

finb / bark-server Goto Github PK

View Code? Open in Web Editor NEW
2.3K 2.3K 369.0 491 KB

Backend of Bark

Home Page: https://bark.day.app

License: MIT License

Go 92.05% Dockerfile 2.96% Shell 0.26% Lua 0.57% Procfile 0.13% Smarty 4.03%

bark-server's People

Contributors

adams549659584 avatar baksili avatar citizen233 avatar dependabot[bot] avatar finb avatar guanguans avatar harryzcy avatar metrue avatar mritd avatar oslo254804746 avatar vayci avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bark-server's Issues

求教:docker兄弟容器访问bark-server如何配置呢?

场景描述:

  • 群晖docker下搭建了bark-server容器1,外网设备a可以注册并成功推送
  • 群晖docker下搭建了另一个容器2,支持bark推送服务
  • 求教,如何配置容器2的推送地址,让设备a可以收到推送通知呢?
    尝试填写docker容器互访的host.docker.internal方案失败
    尝试填写docker容器桥接的子网段地址172.x.x.x方案失败
    尝试填写路由器分配给群晖的192.168.x.x方案失败

关于API V2的几点疑问

1、/register获取的device_key有效期是多久?

2、/push时一直提示"device key is empty"这是哪里出问题了?

{ "body": "Test Bark Server", "device_key": "lfcepdbexuhyqapx", "title": "bleem", "ext_params": { "url": "https://mritd.com" }, "category": "category", "sound": "minuet.caf" }

{ "code": 400, "message": "device key is empty", "timestamp": 1614328454 }

3、API_V2.md 中 /push 的java示例 addHeader("Authorization", "Basic Og==") 这个值是哪里来的?

https://github.com/Finb/bark-server/blob/master/docs/API_V2.md

群晖自建bark-server推送404

----这是路由器插件的推送代码-----
serverchan_send_title="${send_title} 路由器状态信息" serverchan_send_content=$(cat ${serverchan_info_text}) sckey_nu=$(dbus list serverchan_config_sckey | sort -n -t "_" -k 4 | cut -d "=" -f 1 | cut -d "_" -f 4) for nu in ${sckey_nu}; do serverchan_config_sckey=$(dbus get serverchan_config_sckey_${nu}) url="https://www.baidu.comz:8087/${serverchan_config_sckey}/" result=$(wget --no-check-certificate --post-data "title=${serverchan_send_title}&body=${serverchan_send_content}" -qO- ${url}) if [ -n $(echo $result | grep "success") ]; then [ "${serverchan_info_logger}" == "1" ] && logger "[ServerChan]: 路由器状态信息推送到 SCKEY No.${nu} 成功!" else [ "${serverchan_info_logger}" == "1" ] && logger "[ServerChan]: 路由器状态信息推送到 SCKEY No.${nu} 失败,请检查网络及配置!" fi done

--------------------这是bark-server的日志------
` 2021-03-10 09:45:32 INFO 192.168.50.100 -> [404] POST 17.311µs / => /i00ddddddddddddddddr title=RT-AX86U 路由器状态信息&body=###### 本次信息推送:手动推送.

系统运行状态:

系统名称:
系统当前时间: 2021年03月10日 17点45分28秒
固件版本: 386.1_2
系统模式: 无线路由器
系统运行时间: 2天 23小时 58分钟 12秒
平均负载(1,5,15min): 1.08, 1.06, 1.02
总内存: 912.17MB 空闲数: 491.62MB
虚拟内存: 0.00 / 0.00 MB
JFFS: 15.8 / 47.0 MB

温度传感器状况:

2.4GHz: 45°C | 5GHz: 50°C | CPU: 70.4°C

网络状态信息:

WAN0状态信息:
联机类型: pppoe `

serverless deployment

Can bark-server deploy to aws lambda or other severless fuction sevices which has golang runtime.
是否可部署在 AWS lambda 或其他支持 go 运行时的云函数计算服务上

Merge log lines as per requests

For the log output of the server app, one or multiple log lines will be generated for single request. It's really confusing when multiple requests reach the server at the same.

Have you ever considered about merging them into one, or give them a request ID?

What about modern logger like uber/zap?

window服务端部署,运行问题

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0x60d073]

goroutine 1 [running]:
crypto/x509.(*CertPool).addCertFunc(...)
crypto/x509/cert_pool.go:188
crypto/x509.(*CertPool).AppendCertsFromPEM(0x0, 0xc000131800,
d)
crypto/x509/cert_pool.go:226 +0x2f3
github.com/finb/bark-server/v2/apns.init.0()
github.com/finb/bark-server/v2/apns/apns.go:45 +0x1e5

windows部署的时候,报异常,不知道为什么?

关于Post请求

目前的Get和Post请求都是将title/body/category等内容放在URL里面,我感觉对于Post请求,将它们封装为json payload更为合适

curl -d '{"title":"123", "body": "hello world"}' -H "Content-Type: application/json" -X POST https://api.day.app/:key/

docker是不是没有arm64啊?单文件该如何解决苹果推送失败呢?

已经更新到最新版本v1.0.2,还是提示:

{"code":400,"data":null,"message":"与苹果推送服务器传输数据失败: Post "https://api.push.apple.com/3/device/59bb9d89c76709bbdad15d1401c83a2cd7b4ff3589334363410fe67018a07be2\": x509: certificate signed by unknown authority"}

教程里说到:

`当你需要集成Bark到自己的系统或重新实现后端代码时可能需要推送证书

有效期到: 永久

Key ID: LH4T9V5U4R

TeamID: 5U8LBRXG3A

AuthKey_LH4T9V5U4R_5U8LBRXG3A.p8`

这个该怎么用啊?
有知道的吗?
谢谢。

How to compile from source?

Hi,

Could you please let us know (or write it down in README.md) how to compile the binary from source?

Thank you very much!

Support delay message?

What about the three types of delay message:

  • Delay - Send to client after X seconds
  • Schedule - Send to client on scheduled time
  • Repeat - Send to client for every X seconds or scheduled time repeatedly, ends after Y times or until exactly time

bug

当 content中带%号的时候,会出现400 Bad Request⏎

Hello,about startup parameter problems

when i try to start bark-server,it return

flag provided but not defined: -p
Usage of ./bark:
-dev
develop推送,请忽略此参数,设置此参数为True会导致推送失败
-ip string
http listen ip (default "0.0.0.0")
-port int
http listen port (default 8080)

here is my start bash:
nohup /root/barkServer/bark -l 0.0.0.0 -p 81 -d /root/barkServer > /root/barkServer/bark.log &

can you help me to fix this problem,thx!

Log IP of Requester?

I use self-hosted bark server, and sometimes I received some strange notifications after I sent single one. And I didn't know who did this or watched on my network traffic.

Can you please add IP address of the requests in logging, so everyone can get more details about the requester/device sent the request?

INFO[2021-02-07 03:23:04] 200 AE11B12A-D229-D4BC-2E26-CD8E591D37A9
INFO[2021-02-07 03:23:08]  ==========================
INFO[2021-02-07 03:23:08] key:  XXXXXXXXXXXXXX
INFO[2021-02-07 03:23:08] category:
INFO[2021-02-07 03:23:08] title:
INFO[2021-02-07 03:23:08] body:  无推送文字内容
INFO[2021-02-07 03:23:08] params:  map[automaticallycopy:* copy:* sound:*]
INFO[2021-02-07 03:23:08]  ==========================

注册设备失败

请求
register?devicetoken=bdfd19d89e66d7d1e265f2c240b68894326e37d1534735c6ec834af037d5ba87

返回:
{
"code": 400,
"message": "failed to get device token: failed to get [register] device token from database",
"timestamp": 1614847171
}

device key is empty

用的最新版的docker
使用时碰到提示,一直是这个提示。没有发送成功过。麻烦帮忙看一下。
{ "code": 400, "message": "device key is empty", "timestamp": 1614612016 }

命令:
curl -X "POST" "http://*****/push" \ -H 'Content-Type: application/json; charset=utf-8' \ -u ':' \ -d $'{ "body": "te", "device_key": "vysnnvzowlzekezu", "title": "bleem", "category": "category" }'
日志:
`
┌───────────────────────────────────────────────────┐
│ Fiber v2.5.0 │
http://127.0.0.1:8080
│ │
│ Handlers ............ 24 Processes ........... 1 │
│ Prefork ....... Disabled PID ................. 1 │
└───────────────────────────────────────────────────┘

2021-03-01 15:20:15 INFO 10.39.1.141 -> [400] POST 330.801µs /push => /push {
"body": "te",
"device_key": "vysnnvzowlzekezu",
"title": "bleem",
"category": "category"
}`

群辉docker自建服务,启动成功,iOS APP端注册设备获取不到key

搭建环境:群辉docker,反向代理开启https,端口转发到外网

通过 curl https://ip:port/ping 测试成功
{
"code": 200,
"message": "pong",
"timestamp": 1614750513
}

在iOS app里添加服务器成功,不过不能获取到key
https://ip:端口/Your Key/这里改成你自己的推送内容
app提示服务器错误,不能使用推送服务

下面是docker容器的log

2021-03-03 05:58:14 stdout 2021-03-03 05:58:14 INFO 172.17.0.1 -> [400] GET 38.411µs /:device_key => /register?devicetoken=46f32b2b7710db1f8cc255ca1cbf68b2e020923618784db9d25b6ff8557a3ec1
2021-03-03 05:48:34 stdout 2021-03-03 05:48:33 INFO 172.17.0.1 -> [400] GET 31.416µs /:device_key => /favicon.ico
2021-03-03 05:48:33 stdout 2021-03-03 05:48:33 INFO 172.17.0.1 -> [200] GET 27.83µs /ping => /ping
2021-03-03 05:45:10 stdout 2021-03-03 05:45:10 INFO 172.17.0.1 -> [200] GET 32.742µs /ping => /ping
2021-03-03 05:43:58 stdout 2021-03-03 05:43:58 INFO 172.17.0.1 -> [400] GET 60.598µs /:device_key => /register?devicetoken=46f32b2b7710db1f8cc255ca1cbf68b2e020923618784db9d25b6ff8557a3ec1
2021-03-03 05:43:55 stdout 2021-03-03 05:43:55 INFO 172.17.0.1 -> [200] GET 9.492µs /ping => /ping
2021-03-03 05:43:54 stdout 2021-03-03 05:43:54 INFO 172.17.0.1 -> [200] GET 25.558µs /ping => /ping
2021-03-03 05:43:05 stdout 2021-03-03 05:43:05 INFO 172.17.0.1 -> [200] GET 134.216µs /ping => /ping
2021-03-03 05:41:22 stdout
2021-03-03 05:41:22 stdout �[90m └───────────────────────────────────────────────────┘�[0m
2021-03-03 05:41:22 stdout �[90m │ Prefork ....... Disabled PID ................. �[96m1�[90m │
2021-03-03 05:41:22 stdout �[90m │ Handlers ............ �[96m26�[90m Processes ........... �[96m1�[90m │
2021-03-03 05:41:22 stdout �[90m │ │
2021-03-03 05:41:22 stdout �[90m │ http://127.0.0.1:8080 │
2021-03-03 05:41:22 stdout �[90m │ �[96m Fiber v2.5.0�[90m │
2021-03-03 05:41:22 stdout �[90m�[90m ┌───────────────────────────────────────────────────┐
2021-03-03 05:41:22 stdout
2021-03-03 05:41:22 stdout 2021-03-03 05:41:22 INFO Bark Server Listen at: 0.0.0.0:8080
2021-03-03 05:41:21 stdout 2021-03-03 05:41:21 INFO init database [/data]...
2021-03-03 05:41:21 stdout 2021-03-03 05:41:21 INFO load route [register_compat] success...
2021-03-03 05:41:21 stdout 2021-03-03 05:41:21 INFO load route [push_compat] success...
2021-03-03 05:41:21 stdout 2021-03-03 05:41:21 INFO load route [register] success...
2021-03-03 05:41:21 stdout 2021-03-03 05:41:21 INFO load route [push] success...
2021-03-03 05:41:21 stdout 2021-03-03 05:41:21 INFO load route [misc] success...
2021-03-03 05:41:21 stdout 2021-03-03 05:41:21 INFO init apns client success...

Problems when using reverse proxy to enable HTTPS

Hi, I met a problem when deploying by docker and reverse proxy to provide HTTPS support.

The app returned with an error code 0 when adding by https, but no problem when adding by http.

Maybe there's something wrong with the configuration of nginx, may you help me fix it? Many thanks.
{3713834C-46DB-4213-B804-E78FBCCB5965} png

使用APNs Provider API

目前在写一个bark-server的Node.js版本,方便其他写前端比较顺手的朋友集成bark推送到自己的项目中。

看到Finb提供的还是p12的证书,好像没有使用「新」的APNs Provider API。因为我这边用到的APNs包都只支持了APNs Provider API,老的cert-key模式已经完全移除...所以请问是否考虑换用新的APNs协议?

切换应该没有什么特别要处理的地方,bark-server使用的apns2包已经支持,只需要到苹果开发者网站申请.p8证书,再在初始化apns2时提供下keyId和teamId即可。

换到新的协议最大的好处是不用再定期更新证书了。

参考: https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.