Skip to content

Commit

Permalink
fix hashing alg for gravatar avatar fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
krustowski committed Jul 16, 2024
1 parent 9736575 commit a14d464
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#

APP_NAME=litter-go
APP_VERSION=0.35.13
APP_VERSION=0.35.14
GOLANG_VERSION=1.22
2 changes: 1 addition & 1 deletion api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"name": "MIT",
"url": "https://github.com/krustowski/litter-go/blob/master/LICENSE"
},
"version": "0.35.13"
"version": "0.35.14"
},
"host": "littr.n0p.cz",
"basePath": "/api/v1",
Expand Down
12 changes: 8 additions & 4 deletions pkg/backend/db/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func RunMigrations() bool {
l.Println("migrateAvatarURL: cannot save an avatar: "+key, http.StatusInternalServerError)
return false
}
users[key] = user
}
}

Expand All @@ -84,6 +85,7 @@ func RunMigrations() bool {
l.Println("migrateFlowPurge: cannot delete user: "+key, http.StatusInternalServerError)
return false
}
delete(posts, key)
}
}

Expand All @@ -106,6 +108,7 @@ func RunMigrations() bool {
l.Println("migrateUserDeletion: cannot delete a post: "+key, http.StatusInternalServerError)
return false
}
delete(posts, key)
}
}

Expand All @@ -117,6 +120,7 @@ func RunMigrations() bool {
l.Println("migrateUserRegisteredTime: cannot save an user: "+key, http.StatusInternalServerError)
return false
}
users[key] = user
}
}

Expand Down Expand Up @@ -145,6 +149,7 @@ func RunMigrations() bool {
if ok := SetOne(UserCache, key, user); !ok {
//return false
}
users[key] = user
}

// migrateUserUnshade function lists all users and unshades manually some explicitly list users
Expand All @@ -168,9 +173,10 @@ func RunMigrations() bool {
l.Println("migrateUserUnshade: cannot save an user: "+key, http.StatusInternalServerError)
return false
}
users[key] = user
}

l.Println("migrations", code)
l.Println("migrations done", code)
return true
}

Expand All @@ -180,7 +186,6 @@ func RunMigrations() bool {

// GetGravatarURL function returns the avatar image location/URL, or it defaults to a app logo.
func GetGravatarURL(emailInput string, channel chan string) string {
// TODO: do not hardcode this
email := strings.ToLower(emailInput)
size := 150

Expand All @@ -200,8 +205,7 @@ func GetGravatarURL(emailInput string, channel chan string) string {
if err != nil || resp.StatusCode != 200 {
//log.Println(resp.StatusCode)
//log.Println(err.Error())
//url = defaultAvatarImage
url = "/web/android-chrome-192x192.png"
url = defaultAvatarImage
} else {
resp.Body.Close()
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/router.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @title litter-go
// @version 0.35.13
// @version 0.35.14
// @description nanoblogging platform as PWA built on go-app framework
// @termsOfService https://littr.eu/tos

Expand Down

0 comments on commit a14d464

Please sign in to comment.