mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 12:03:59 +01:00
lint fix
This commit is contained in:
parent
9a9ac33766
commit
c4eb763f4a
3 changed files with 7 additions and 7 deletions
|
@ -36,8 +36,8 @@ func NewFederationInfo(nodeInfo NodeInfo, hostFqdn string) (FederationInfo, erro
|
||||||
// Validate collects error strings in a slice and returns this
|
// Validate collects error strings in a slice and returns this
|
||||||
func (info FederationInfo) Validate() []string {
|
func (info FederationInfo) Validate() []string {
|
||||||
var result []string
|
var result []string
|
||||||
result = append(result, validation.ValidateNotEmpty(string(info.HostFqdn), "HostFqdn")...)
|
result = append(result, validation.ValidateNotEmpty(info.HostFqdn, "HostFqdn")...)
|
||||||
result = append(result, validation.ValidateMaxLen(string(info.HostFqdn), 255, "HostFqdn")...)
|
result = append(result, validation.ValidateMaxLen(info.HostFqdn, 255, "HostFqdn")...)
|
||||||
result = append(result, info.NodeInfo.Validate()...)
|
result = append(result, info.NodeInfo.Validate()...)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -81,7 +81,7 @@ func (node NodeInfoWellKnown) Validate() []string {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (id ActorID) AsWellKnownNodeInfoUri() string {
|
func (id ActorID) AsWellKnownNodeInfoURI() string {
|
||||||
wellKnownPath := ".well-known/nodeinfo"
|
wellKnownPath := ".well-known/nodeinfo"
|
||||||
var result string
|
var result string
|
||||||
if id.Port == "" {
|
if id.Port == "" {
|
||||||
|
|
|
@ -89,8 +89,8 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
log.Info("RepositoryInbox: activity validated:%v", activity)
|
log.Info("RepositoryInbox: activity validated:%v", activity)
|
||||||
|
|
||||||
// parse actorID (person)
|
// parse actorID (person)
|
||||||
actorUri := activity.Actor.GetID().String()
|
actorURI := activity.Actor.GetID().String()
|
||||||
rawActorID, err := forgefed.NewActorID(actorUri)
|
rawActorID, err := forgefed.NewActorID(actorURI)
|
||||||
federationInfo, err := forgefed.FindFederationInfoByHostFqdn(ctx, rawActorID.Host)
|
federationInfo, err := forgefed.FindFederationInfoByHostFqdn(ctx, rawActorID.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError,
|
ctx.Error(http.StatusInternalServerError,
|
||||||
|
@ -112,7 +112,7 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
actorID, err := forgefed.NewPersonID(actorUri, string(federationInfo.NodeInfo.Source))
|
actorID, err := forgefed.NewPersonID(actorURI, string(federationInfo.NodeInfo.Source))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusNotAcceptable, "RepositoryInbox: Validate actorId", err)
|
ctx.Error(http.StatusNotAcceptable, "RepositoryInbox: Validate actorId", err)
|
||||||
return
|
return
|
||||||
|
@ -212,7 +212,7 @@ func createFederationInfo(ctx *context.APIContext, actorID forgefed.ActorID) (fo
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return forgefed.FederationInfo{}, err
|
return forgefed.FederationInfo{}, err
|
||||||
}
|
}
|
||||||
body, err := client.GetBody(actorID.AsWellKnownNodeInfoUri())
|
body, err := client.GetBody(actorID.AsWellKnownNodeInfoURI())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return forgefed.FederationInfo{}, err
|
return forgefed.FederationInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue