Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00
This commit is contained in:
Michael Jerger 2024-01-13 17:06:40 +01:00
parent 9a9ac33766
commit c4eb763f4a
3 changed files with 7 additions and 7 deletions

View file

@ -36,8 +36,8 @@ func NewFederationInfo(nodeInfo NodeInfo, hostFqdn string) (FederationInfo, erro
// Validate collects error strings in a slice and returns this
func (info FederationInfo) Validate() []string {
var result []string
result = append(result, validation.ValidateNotEmpty(string(info.HostFqdn), "HostFqdn")...)
result = append(result, validation.ValidateMaxLen(string(info.HostFqdn), 255, "HostFqdn")...)
result = append(result, validation.ValidateNotEmpty(info.HostFqdn, "HostFqdn")...)
result = append(result, validation.ValidateMaxLen(info.HostFqdn, 255, "HostFqdn")...)
result = append(result, info.NodeInfo.Validate()...)
return result

View file

@ -81,7 +81,7 @@ func (node NodeInfoWellKnown) Validate() []string {
return result
}
func (id ActorID) AsWellKnownNodeInfoUri() string {
func (id ActorID) AsWellKnownNodeInfoURI() string {
wellKnownPath := ".well-known/nodeinfo"
var result string
if id.Port == "" {

View file

@ -89,8 +89,8 @@ func RepositoryInbox(ctx *context.APIContext) {
log.Info("RepositoryInbox: activity validated:%v", activity)
// parse actorID (person)
actorUri := activity.Actor.GetID().String()
rawActorID, err := forgefed.NewActorID(actorUri)
actorURI := activity.Actor.GetID().String()
rawActorID, err := forgefed.NewActorID(actorURI)
federationInfo, err := forgefed.FindFederationInfoByHostFqdn(ctx, rawActorID.Host)
if err != nil {
ctx.Error(http.StatusInternalServerError,
@ -112,7 +112,7 @@ func RepositoryInbox(ctx *context.APIContext) {
return
}
actorID, err := forgefed.NewPersonID(actorUri, string(federationInfo.NodeInfo.Source))
actorID, err := forgefed.NewPersonID(actorURI, string(federationInfo.NodeInfo.Source))
if err != nil {
ctx.Error(http.StatusNotAcceptable, "RepositoryInbox: Validate actorId", err)
return
@ -212,7 +212,7 @@ func createFederationInfo(ctx *context.APIContext, actorID forgefed.ActorID) (fo
if err != nil {
return forgefed.FederationInfo{}, err
}
body, err := client.GetBody(actorID.AsWellKnownNodeInfoUri())
body, err := client.GetBody(actorID.AsWellKnownNodeInfoURI())
if err != nil {
return forgefed.FederationInfo{}, err
}