Skip to content

Commit 967990a

Browse files
authored
Merge pull request #116 from blinklabs-io/feat-update-push
fix: api listen to all interfaces
2 parents 82f6d82 + f58b998 commit 967990a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func New(debug bool, options ...APIOption) *APIv1 {
5656
once.Do(func() {
5757
apiInstance = &APIv1{
5858
engine: ConfigureRouter(debug),
59-
Host: "localhost",
59+
Host: "0.0.0.0",
6060
Port: "8080",
6161
}
6262
for _, opt := range options {

output/push/push.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ func (p *PushOutput) Start() error {
9898
be.BlockHash,
9999
)
100100

101+
// Create notification message
102+
title := "Snek"
103+
body := fmt.Sprintf(
104+
"New Block!\nBlockNumber: %d, SlotNumber: %d\nHash: %s",
105+
bc.BlockNumber,
106+
bc.SlotNumber,
107+
be.BlockHash,
108+
)
109+
110+
// Send notification
111+
p.processFcmNotifications(title, body)
112+
101113
case "chainsync.rollback":
102114
payload := evt.Payload
103115
if payload == nil {

output/push/qr_generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type QRValue struct {
1515

1616
func generateQRPage(apiEndpoint string) gin.HandlerFunc {
1717
return func(c *gin.Context) {
18-
apiEndpoint = c.Request.Host + apiEndpoint
18+
apiEndpoint := c.Request.Host + apiEndpoint
1919
qrValue, err := json.Marshal(QRValue{
2020
ApiEndpoint: apiEndpoint,
2121
})

0 commit comments

Comments
 (0)