|
@@ -3,12 +3,13 @@ package server
|
|
|
import (
|
|
import (
|
|
|
"context"
|
|
"context"
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
|
|
+ "fmt"
|
|
|
|
|
+ "strings"
|
|
|
|
|
+
|
|
|
firebase "firebase.google.com/go"
|
|
firebase "firebase.google.com/go"
|
|
|
"firebase.google.com/go/messaging"
|
|
"firebase.google.com/go/messaging"
|
|
|
- "fmt"
|
|
|
|
|
"google.golang.org/api/option"
|
|
"google.golang.org/api/option"
|
|
|
"heckel.io/ntfy/auth"
|
|
"heckel.io/ntfy/auth"
|
|
|
- "strings"
|
|
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
const (
|
|
@@ -111,8 +112,13 @@ func toFirebaseMessage(m *message, auther auth.Auther) (*messaging.Message, erro
|
|
|
data["attachment_expires"] = fmt.Sprintf("%d", m.Attachment.Expires)
|
|
data["attachment_expires"] = fmt.Sprintf("%d", m.Attachment.Expires)
|
|
|
data["attachment_url"] = m.Attachment.URL
|
|
data["attachment_url"] = m.Attachment.URL
|
|
|
}
|
|
}
|
|
|
|
|
+ apnsData := make(map[string]interface{})
|
|
|
|
|
+ for k, v := range data {
|
|
|
|
|
+ apnsData[k] = v
|
|
|
|
|
+ }
|
|
|
apnsConfig = &messaging.APNSConfig{
|
|
apnsConfig = &messaging.APNSConfig{
|
|
|
Payload: &messaging.APNSPayload{
|
|
Payload: &messaging.APNSPayload{
|
|
|
|
|
+ CustomData: apnsData,
|
|
|
Aps: &messaging.Aps{
|
|
Aps: &messaging.Aps{
|
|
|
MutableContent: true,
|
|
MutableContent: true,
|
|
|
Alert: &messaging.ApsAlert{
|
|
Alert: &messaging.ApsAlert{
|