Follows and relationships (#27)

* Follows -- create and undo, both remote and local
* Statuses -- federate new posts, including media, attachments, CWs and image descriptions.
This commit is contained in:
Tobi Smethurst
2021-05-21 15:48:26 +02:00
committed by GitHub
parent dc06e71b76
commit d839f27c30
54 changed files with 2260 additions and 299 deletions

View File

@ -22,6 +22,8 @@ import (
"fmt"
"net/url"
"strings"
"github.com/google/uuid"
)
const (
@ -47,6 +49,8 @@ const (
FeaturedPath = "featured"
// PublicKeyPath is for serving an account's public key
PublicKeyPath = "main-key"
// FollowPath used to generate the URI for an individual follow or follow request
FollowPath = "follow"
)
// APContextKey is a type used specifically for settings values on contexts within go-fed AP request chains
@ -103,6 +107,12 @@ type UserURIs struct {
PublicKeyURI string
}
// GenerateURIForFollow returns the AP URI for a new follow -- something like:
// https://example.org/users/whatever_user/follow/41c7f33f-1060-48d9-84df-38dcb13cf0d8
func GenerateURIForFollow(username string, protocol string, host string) string {
return fmt.Sprintf("%s://%s/%s/%s/%s", protocol, host, UsersPath, FollowPath, uuid.NewString())
}
// GenerateURIsForAccount throws together a bunch of URIs for the given username, with the given protocol and host.
func GenerateURIsForAccount(username string, protocol string, host string) *UserURIs {
// The below URLs are used for serving web requests