Skip to content

Commit

Permalink
Merge pull request #15 from getAlby/task-alby-url
Browse files Browse the repository at this point in the history
chore: only change while making a request
  • Loading branch information
bumi authored Jan 26, 2024
2 parents 0884c23 + d12a7df commit 0fc86e1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ func GetJSON(p GetJSONParams) (interface{}, *http.Response, error) {
if p.wg != nil {
defer p.wg.Done()
}

urlPrefix := "https://getalby.com"
replacement := "http://alby-mainnet-getalbycom"

p.url = strings.Replace(p.url, urlPrefix, replacement, 1)

response, err := http.Get(p.url)
if err != nil || response.StatusCode > 300 {
return nil, response, fmt.Errorf("No details: %s - %v", p.url, err)
Expand All @@ -71,13 +77,6 @@ func ToUrl(identifier string) (string, string, string, error) {
lnurlpUrl := fmt.Sprintf("https://%s/.well-known/lnurlp/%s", parts[1], parts[0])
nostrUrl := fmt.Sprintf("https://%s/.well-known/nostr.json?name=%s", parts[1], parts[0])

urlPrefix := "https://getalby.com"
replacement := "http://alby-mainnet-getalbycom"

keysendUrl = strings.Replace(keysendUrl, urlPrefix, replacement, 1)
lnurlpUrl = strings.Replace(lnurlpUrl, urlPrefix, replacement, 1)
nostrUrl = strings.Replace(nostrUrl, urlPrefix, replacement, 1)

return lnurlpUrl, keysendUrl, nostrUrl, nil
}

Expand Down

0 comments on commit 0fc86e1

Please sign in to comment.