Skip to content

Commit

Permalink
fix: api listen to all interfaces
Browse files Browse the repository at this point in the history
- small push enhancment on block
- fix qrCode endpoint after page refresh string was concatenating

Signed-off-by: Ales <[email protected]>
  • Loading branch information
verbotenj committed Nov 2, 2023
1 parent 82f6d82 commit f58b998
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func New(debug bool, options ...APIOption) *APIv1 {
once.Do(func() {
apiInstance = &APIv1{
engine: ConfigureRouter(debug),
Host: "localhost",
Host: "0.0.0.0",
Port: "8080",
}
for _, opt := range options {
Expand Down
12 changes: 12 additions & 0 deletions output/push/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ func (p *PushOutput) Start() error {
be.BlockHash,
)

// Create notification message
title := "Snek"
body := fmt.Sprintf(
"New Block!\nBlockNumber: %d, SlotNumber: %d\nHash: %s",
bc.BlockNumber,
bc.SlotNumber,
be.BlockHash,
)

// Send notification
p.processFcmNotifications(title, body)

case "chainsync.rollback":
payload := evt.Payload
if payload == nil {
Expand Down
2 changes: 1 addition & 1 deletion output/push/qr_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type QRValue struct {

func generateQRPage(apiEndpoint string) gin.HandlerFunc {
return func(c *gin.Context) {
apiEndpoint = c.Request.Host + apiEndpoint
apiEndpoint := c.Request.Host + apiEndpoint
qrValue, err := json.Marshal(QRValue{
ApiEndpoint: apiEndpoint,
})
Expand Down

0 comments on commit f58b998

Please sign in to comment.