mirror of
https://github.com/anotherhadi/gravatar-recon.git
synced 2026-10-05 19:28:25 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e74f69daf7 |
+4
-1
@@ -58,12 +58,15 @@ func main() {
|
||||
}
|
||||
|
||||
profiles, err := gravatar_recon.GetGravatarProfiles(email)
|
||||
if err != nil {
|
||||
if err != nil || profiles == nil {
|
||||
log.Fatal("Failed to get Gravatar profile", "err", err)
|
||||
}
|
||||
|
||||
if !*silent {
|
||||
utils.Header()
|
||||
if len(*profiles) == 0 {
|
||||
utils.PrintNoResultFound()
|
||||
}
|
||||
for _, profile := range *profiles {
|
||||
utils.PrintTitle(profile.PreferredUser + ":")
|
||||
if *printAvatar {
|
||||
|
||||
@@ -91,6 +91,10 @@ func GetGravatarProfiles(email string) (*[]GravatarProfile, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == 404 {
|
||||
return &[]GravatarProfile{}, nil
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("no gravatar profile found (status %d)", resp.StatusCode)
|
||||
}
|
||||
|
||||
@@ -133,6 +133,10 @@ func PrintTitle(title string) {
|
||||
fmt.Println(titleStyle.Render(title) + "\n")
|
||||
}
|
||||
|
||||
func PrintNoResultFound() {
|
||||
fmt.Println(titleStyle.Render("No result found"))
|
||||
}
|
||||
|
||||
func PrintAvatar(url string) {
|
||||
if url == "" {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user