Merge branch 'main' into share

This commit is contained in:
balzack 2023-04-22 17:59:19 -07:00
commit 9539a1f038
2 changed files with 31 additions and 24 deletions

View File

@ -23,7 +23,7 @@ Databag is a self-hosted messaging service. Notable features include:
- Decentralized (direct communication between app and server node)
- Federated (accounts on different nodes can communicate)
- Public-Private key based identity (not bound to any blockchain or hosting domain)
- End-to-End encryption (the hosting admin cannot view sealed topics)
- End-to-End encryption (the hosting admin cannot view sealed topics, deafult unsealed)
- Audio and Video Calls (nat tranversal requires separate relay server)
- Topic based threads (messages organized by topic not contacts)
- Lightweight (server can run on a raspberry pi zero v1.3)

View File

@ -52,12 +52,18 @@ func SendPushEvent(account store.Account, event string) {
ErrMsg(err);
return
}
tokens := make(map[string]bool)
for rows.Next() {
var pushToken string
var messageTitle string
var messageBody string
rows.Scan(&pushToken, &messageTitle, &messageBody)
if _, exists := tokens[pushToken]; !exists {
tokens[pushToken] = true;
url := "https://fcm.googleapis.com/fcm/send"
payload := Payload{ Title: messageTitle, Body: messageBody, Sound: "default" };
message := Message{ Notification: payload, To: pushToken };
@ -84,5 +90,6 @@ func SendPushEvent(account store.Account, event string) {
ErrMsg(errors.New("failed to push notification"));
}
}
}
}