Setting activitypub.go back to master version

This commit is contained in:
Donald Feury 2021-02-24 23:55:56 -05:00
parent 9ed2687543
commit 4c0fcdf7c6
1 changed files with 3 additions and 20 deletions

View File

@ -397,9 +397,7 @@ func handleFetchCollectionInbox(app *App, w http.ResponseWriter, r *http.Request
go func() {
if to == nil {
if debugging {
log.Error("No `to` value!")
}
log.Error("No to! %v", err)
return
}
@ -494,7 +492,7 @@ func makeActivityPost(hostName string, p *activitystreams.Person, url string, m
r, _ := http.NewRequest("POST", url, bytes.NewBuffer(b))
r.Header.Add("Content-Type", "application/activity+json")
r.Header.Set("User-Agent", ServerUserAgent(hostName))
r.Header.Set("User-Agent", "Go ("+serverSoftware+"/"+softwareVer+"; +"+hostName+")")
h := sha256.New()
h.Write(b)
r.Header.Add("Digest", "SHA-256="+base64.StdEncoding.EncodeToString(h.Sum(nil)))
@ -544,7 +542,7 @@ func resolveIRI(hostName, url string) ([]byte, error) {
r, _ := http.NewRequest("GET", url, nil)
r.Header.Add("Accept", "application/activity+json")
r.Header.Set("User-Agent", ServerUserAgent(hostName))
r.Header.Set("User-Agent", "Go ("+serverSoftware+"/"+softwareVer+"; +"+hostName+")")
if debugging {
dump, err := httputil.DumpRequestOut(r, true)
@ -631,17 +629,6 @@ func federatePost(app *App, p *PublicPost, collID int64, isUpdate bool) error {
log.Info("Federating new post!")
}
}
// If app is private, do not federate
if app.cfg.App.Private {
return nil
}
// Do not federate posts from private or protected blogs
if p.Collection.Visibility == CollPrivate || p.Collection.Visibility == CollProtected {
return nil
}
actor := p.Collection.PersonObject(collID)
na := p.ActivityObject(app)
@ -710,10 +697,6 @@ func federatePost(app *App, p *PublicPost, collID int64, isUpdate bool) error {
// I don't believe we'd ever have too many mentions in a single post that this
// could become a burden.
remoteUser, err := getRemoteUser(app, tag.HRef)
if err != nil {
log.Error("Unable to find remote user %s. Skipping: %v", tag.HRef, err)
continue
}
err = makeActivityPost(app.cfg.App.Host, actor, remoteUser.Inbox, activity)
if err != nil {
log.Error("Couldn't post! %v", err)