summaryrefslogtreecommitdiff
path: root/internal/util/uri.go
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-05-28 22:47:18 +0200
committerLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-05-28 22:47:18 +0200
commitcb54324430e7c4640a7aa5aac24932b5e91b71c4 (patch)
treea5193ee09656d808f589de20f77a5a455a5a6683 /internal/util/uri.go
parentAnnounce/boost (#35) (diff)
downloadgotosocial-cb54324430e7c4640a7aa5aac24932b5e91b71c4.tar.xz
federate account updates
Diffstat (limited to 'internal/util/uri.go')
-rw-r--r--internal/util/uri.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/util/uri.go b/internal/util/uri.go
index 8d64bdd8e..d8dce803b 100644
--- a/internal/util/uri.go
+++ b/internal/util/uri.go
@@ -49,6 +49,8 @@ const (
PublicKeyPath = "main-key"
// FollowPath used to generate the URI for an individual follow or follow request
FollowPath = "follow"
+ // UpdatePath is used to generate the URI for an account update
+ UpdatePath = "updates"
)
// APContextKey is a type used specifically for settings values on contexts within go-fed AP request chains
@@ -108,13 +110,19 @@ type UserURIs struct {
// 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, thisFollowID string) string {
- return fmt.Sprintf("%s://%s/%s/%s/%s", protocol, host, UsersPath, FollowPath, thisFollowID)
+ return fmt.Sprintf("%s://%s/%s/%s/%s/%s", protocol, host, UsersPath, username, FollowPath, thisFollowID)
}
// GenerateURIForFollow returns the AP URI for a new like/fave -- something like:
// https://example.org/users/whatever_user/liked/41c7f33f-1060-48d9-84df-38dcb13cf0d8
func GenerateURIForLike(username string, protocol string, host string, thisFavedID string) string {
- return fmt.Sprintf("%s://%s/%s/%s/%s", protocol, host, UsersPath, LikedPath, thisFavedID)
+ return fmt.Sprintf("%s://%s/%s/%s/%s/%s", protocol, host, UsersPath, username, LikedPath, thisFavedID)
+}
+
+// GenerateURIForUpdate returns the AP URI for a new update activity -- something like:
+// https://example.org/users/whatever_user#updates/41c7f33f-1060-48d9-84df-38dcb13cf0d8
+func GenerateURIForUpdate(username string, protocol string, host string, thisUpdateID string) string {
+ return fmt.Sprintf("%s://%s/%s/%s#%s/%s", protocol, host, UsersPath, username, UpdatePath, thisUpdateID)
}
// GenerateURIsForAccount throws together a bunch of URIs for the given username, with the given protocol and host.