Skip to content

Commit

Permalink
Fixes for Roundesk api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Jul 2, 2020
1 parent 166531c commit 703954d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
6 changes: 1 addition & 5 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func getRoundeskProfile(alias, domain string, allowCache bool) (profile *roundes
}

// Success or failure
if profile != nil && profile.Profile != nil && len(profile.Profile.ID) > 0 {
if profile != nil && profile.Profile != nil && len(profile.Profile.Paymail) > 0 {
chalker.Log(chalker.SUCCESS, "Roundesk profile was found")

// Store in db?
Expand Down Expand Up @@ -860,9 +860,5 @@ func (p *PaymailDetails) Display() {
}

chalker.Log(chalker.DEFAULT, fmt.Sprintf("URL : %s", chalk.Cyan.Color("https://roundesk.co/u/"+displayPaymail)))

if len(p.Roundesk.Profile.Nonce) > 0 {
chalker.Log(chalker.DEFAULT, fmt.Sprintf("Nonce : %s", chalk.Cyan.Color(p.Roundesk.Profile.Nonce)))
}
}
}
34 changes: 18 additions & 16 deletions integrations/roundesk/roundesk.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
const (
defaultGetTimeout = 15 // In seconds
defaultUserAgent = "go:roundesk" // Default user agent
roundeskURL = "https://roundesk.co:4443" // Network to use
roundeskURL = "https://roundesk.co/api/" // Network to use
)

// Override the package defaults
Expand All @@ -35,27 +35,24 @@ type Response struct {

// Profile is the roundesk public profile
type Profile struct {
Bio string `json:"bio"`
Dev float64 `json:"dev"`
Ent float64 `json:"ent"`
Headline string `json:"headline"`
ID string `json:"_id"`
Int float64 `json:"inv"`
LastUpdate int64 `json:"lastUpdate"`
Mar float64 `json:"mar"`
Name string `json:"name"`
Nonce string `json:"nonce"`
Paymail string `json:"paymail"`
Twetch string `json:"twetch"`
Uxd float64 `json:"uxd"`
Bio string `json:"bio"`
Dev float64 `json:"dev"`
Ent float64 `json:"ent"`
Headline string `json:"headline"`
Inv float64 `json:"inv"`
Mar float64 `json:"mar"`
Name string `json:"name"`
Paymail string `json:"paymail"`
Twetch string `json:"twetch"`
Uxd float64 `json:"uxd"`
}

// GetProfile will get a roundesk profile if it exists for the given paymail address
// Specs: https://roundesk.co/
func GetProfile(alias, domain string, tracing bool) (response *Response, err error) {

// Set the url for the request
reqURL := fmt.Sprintf("%s/api/profile/%s@%s", Network, alias, domain)
reqURL := fmt.Sprintf("%su/%s@%s", Network, alias, domain)

// Create a Client and start the request
client := resty.New().SetTimeout(defaultGetTimeout * time.Second)
Expand Down Expand Up @@ -92,7 +89,12 @@ func GetProfile(alias, domain string, tracing bool) (response *Response, err err
}

// Decode the body of the response
err = json.Unmarshal(resp.Body(), &response)
err = json.Unmarshal(resp.Body(), &response.Profile)

// Handle new way of detecting user is not known (Clear out the user data)
if response.Profile.Name == "Unknown" {
response.Profile.Paymail = ""
}

return
}

0 comments on commit 703954d

Please sign in to comment.