Skip to content

Commit

Permalink
Merge pull request #159 from getAlby/fix/relay-public-url
Browse files Browse the repository at this point in the history
fix: relay public url
  • Loading branch information
rolznz authored Nov 15, 2023
2 parents c4d2501 + 7f8b4f5 commit e49a5c8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions echo_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,15 @@ func (svc *Service) AppsCreateHandler(c echo.Context) error {
return c.Redirect(302, "/apps")
}

// FIXME: need a public-facing relay URL env variable
// and fallback to svc.cfg.Relay (hosted instance uses an internal URL)
publicRelayUrl := "wss://relay.getalby.com/v1";

if c.FormValue("returnTo") != "" {
returnToUrl, err := url.Parse(c.FormValue("returnTo"))
if err == nil {
query := returnToUrl.Query()
query.Add("relay", svc.cfg.Relay)
query.Add("relay", publicRelayUrl);
query.Add("pubkey", svc.cfg.IdentityPubkey)
if user.LightningAddress != "" {
query.Add("lud16", user.LightningAddress)
Expand All @@ -423,7 +427,7 @@ func (svc *Service) AppsCreateHandler(c echo.Context) error {
if user.LightningAddress != "" {
lud16 = fmt.Sprintf("&lud16=%s", user.LightningAddress)
}
pairingUri := template.URL(fmt.Sprintf("nostr+walletconnect://%s?relay=%s&secret=%s%s", svc.cfg.IdentityPubkey, svc.cfg.Relay, pairingSecretKey, lud16))
pairingUri := template.URL(fmt.Sprintf("nostr+walletconnect://%s?relay=%s&secret=%s%s", svc.cfg.IdentityPubkey, publicRelayUrl, pairingSecretKey, lud16))
return c.Render(http.StatusOK, "apps/create.html", map[string]interface{}{
"User": user,
"PairingUri": pairingUri,
Expand Down

0 comments on commit e49a5c8

Please sign in to comment.