Fetch PGP keys from GitLab CRI as fallback
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
4dcbfbed79
commit
c2f2910a83
2 changed files with 90 additions and 7 deletions
15
keys.go
15
keys.go
|
|
@ -33,9 +33,18 @@ func declareAPIKeysRoutes(router *gin.RouterGroup) {
|
|||
}
|
||||
|
||||
var ret []byte
|
||||
for _, key := range keys {
|
||||
if key.Type == "pgp" {
|
||||
ret = append(ret, []byte(key.Content)...)
|
||||
if len(keys) == 0 {
|
||||
ret, err = GitLab_getUserPGPKeys(c.Request.Context(), u)
|
||||
if err != nil {
|
||||
log.Println("Unable to GitLab_getUserPGPKeys:", err)
|
||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "Unable to retrieve your keys from GitLab. Please try again in a few moment or add them directly on /keys page on this website."})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
for _, key := range keys {
|
||||
if key.Type == "pgp" {
|
||||
ret = append(ret, []byte(key.Content)...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue