Documentation
¶
Index ¶
- Constants
- func GenerateURIForAccept(username string, thisAcceptID string) string
- func GenerateURIForBlock(username string, thisBlockID string) string
- func GenerateURIForEmailConfirm(token string) string
- func GenerateURIForFollow(username string, thisFollowID string) string
- func GenerateURIForLike(username string, thisFavedID string) string
- func GenerateURIForMove(username string, thisMoveID string) string
- func GenerateURIForReject(username string, thisRejectID string) string
- func GenerateURIForReport(thisReportID string) string
- func GenerateURIForUpdate(username string, thisUpdateID string) string
- func IsAcceptsPath(id *url.URL) bool
- func IsBlockPath(id *url.URL) bool
- func IsFollowPath(id *url.URL) bool
- func IsFollowersPath(id *url.URL) bool
- func IsFollowingPath(id *url.URL) bool
- func IsInboxPath(id *url.URL) bool
- func IsLikePath(id *url.URL) bool
- func IsLikedPath(id *url.URL) bool
- func IsOutboxPath(id *url.URL) bool
- func IsPublicKeyPath(id *url.URL) bool
- func IsReportPath(id *url.URL) bool
- func IsStatusesPath(id *url.URL) bool
- func IsUserPath(id *url.URL) bool
- func IsUserWebPath(id *url.URL) bool
- func ParseBlockPath(id *url.URL) (username string, ulid string, err error)
- func ParseFollowersPath(id *url.URL) (username string, err error)
- func ParseFollowingPath(id *url.URL) (username string, err error)
- func ParseInboxPath(id *url.URL) (username string, err error)
- func ParseLikedPath(id *url.URL) (username string, ulid string, err error)
- func ParseOutboxPath(id *url.URL) (username string, err error)
- func ParseReportPath(id *url.URL) (ulid string, err error)
- func ParseStatusesPath(id *url.URL) (username string, ulid string, err error)
- func ParseUserPath(id *url.URL) (username string, err error)
- func ParseUserWebPath(id *url.URL) (username string, err error)
- func StoragePathForAttachment(accountID string, mediaType string, mediaSize string, mediaID string, ...) string
- func URIForAttachment(accountID string, mediaType string, mediaSize string, mediaID string, ...) string
- func URIForEmoji(emojiID string) string
- func URIForTag(name string) string
- type UserURIs
Constants ¶
const ( UsersPath = "users" // UsersPath is for serving users info StatusesPath = "statuses" // StatusesPath is for serving statuses InboxPath = "inbox" // InboxPath represents the activitypub inbox location OutboxPath = "outbox" // OutboxPath represents the activitypub outbox location FollowersPath = "followers" // FollowersPath represents the activitypub followers location FollowingPath = "following" // FollowingPath represents the activitypub following location LikedPath = "liked" // LikedPath represents the activitypub liked location CollectionsPath = "collections" // CollectionsPath represents the activitypub collections location FeaturedPath = "featured" // FeaturedPath represents the activitypub featured location PublicKeyPath = "main-key" // PublicKeyPath is for serving an account's public key FollowPath = "follow" // FollowPath used to generate the URI for an individual follow or follow request UpdatePath = "updates" // UpdatePath is used to generate the URI for an account update BlocksPath = "blocks" // BlocksPath is used to generate the URI for a block MovesPath = "moves" // MovesPath is used to generate the URI for a move ReportsPath = "reports" // ReportsPath is used to generate the URI for a report/flag ConfirmEmailPath = "confirm_email" // ConfirmEmailPath is used to generate the URI for an email confirmation link FileserverPath = "fileserver" // FileserverPath is a path component for serving attachments + media EmojiPath = "emoji" // EmojiPath represents the activitypub emoji location TagsPath = "tags" // TagsPath represents the activitypub tags location AcceptsPath = "accepts" // AcceptsPath represents the activitypub Accept's location RejectsPath = "rejects" // RejectsPath represents the activitypub Reject's location )
Variables ¶
This section is empty.
Functions ¶
func GenerateURIForAccept ¶ added in v0.17.0
GenerateURIForAccept returns the AP URI for a new Accept activity -- something like: https://example.org/users/whatever_user/accepts/01F7XTH1QGBAPMGF49WJZ91XGC
func GenerateURIForBlock ¶
GenerateURIForBlock returns the AP URI for a new block activity -- something like: https://example.org/users/whatever_user/blocks/01F7XTH1QGBAPMGF49WJZ91XGC
func GenerateURIForEmailConfirm ¶
GenerateURIForEmailConfirm returns a link for email confirmation -- something like: https://example.org/confirm_email?token=490e337c-0162-454f-ac48-4b22bb92a205
func GenerateURIForFollow ¶
GenerateURIForFollow returns the AP URI for a new follow -- something like: https://example.org/users/whatever_user/follow/01F7XTH1QGBAPMGF49WJZ91XGC
func GenerateURIForLike ¶
GenerateURIForLike returns the AP URI for a new like/fave -- something like: https://example.org/users/whatever_user/liked/01F7XTH1QGBAPMGF49WJZ91XGC
func GenerateURIForMove ¶ added in v0.15.0
GenerateURIForMove returns the AP URI for a new Move activity -- something like: https://example.org/users/whatever_user/moves/01F7XTH1QGBAPMGF49WJZ91XGC
func GenerateURIForReject ¶ added in v0.17.0
GenerateURIForReject returns the AP URI for a new Reject activity -- something like: https://example.org/users/whatever_user/rejects/01F7XTH1QGBAPMGF49WJZ91XGC
func GenerateURIForReport ¶ added in v0.7.0
GenerateURIForReport returns the API URI for a new Flag activity -- something like: https://example.org/reports/01GP3AWY4CRDVRNZKW0TEAMB5R
This path specifically doesn't contain any info about the user who did the reporting, to protect their privacy.
func GenerateURIForUpdate ¶
GenerateURIForUpdate returns the AP URI for a new update activity -- something like: https://example.org/users/whatever_user#updates/01F7XTH1QGBAPMGF49WJZ91XGC
func IsAcceptsPath ¶ added in v0.17.0
IsAcceptsPath returns true if the given URL path corresponds to eg /users/example_username/accepts/SOME_ULID_OF_AN_ACCEPT
func IsBlockPath ¶
IsBlockPath returns true if the given URL path corresponds to eg /users/example_username/blocks/SOME_ULID_OF_A_BLOCK
func IsFollowPath ¶
IsFollowPath returns true if the given URL path corresponds to eg /users/example_username/follow/SOME_ULID_OF_A_FOLLOW
func IsFollowersPath ¶
IsFollowersPath returns true if the given URL path corresponds to eg /users/example_username/followers
func IsFollowingPath ¶
IsFollowingPath returns true if the given URL path corresponds to eg /users/example_username/following
func IsInboxPath ¶
IsInboxPath returns true if the given URL path corresponds to eg /users/example_username/inbox
func IsLikePath ¶
IsLikePath returns true if the given URL path corresponds to eg /users/example_username/liked/SOME_ULID_OF_A_STATUS
func IsLikedPath ¶
IsLikedPath returns true if the given URL path corresponds to eg /users/example_username/liked
func IsOutboxPath ¶
IsOutboxPath returns true if the given URL path corresponds to eg /users/example_username/outbox
func IsPublicKeyPath ¶
IsPublicKeyPath returns true if the given URL path corresponds to eg /users/example_username/main-key
func IsReportPath ¶ added in v0.7.0
IsReportPath returns true if the given URL path corresponds to eg /reports/SOME_ULID_OF_A_REPORT
func IsStatusesPath ¶
IsStatusesPath returns true if the given URL path corresponds to eg /users/example_username/statuses/SOME_ULID_OF_A_STATUS
func IsUserPath ¶
IsUserPath returns true if the given URL path corresponds to eg /users/example_username
func IsUserWebPath ¶ added in v0.13.3
IsUserWebPath returns true if the given URL path corresponds to eg /@example_username
func ParseBlockPath ¶
ParseBlockPath returns the username and ulid from a path such as /users/example_username/blocks/SOME_ULID_OF_A_BLOCK
func ParseFollowersPath ¶
ParseFollowersPath returns the username from a path such as /users/example_username/followers
func ParseFollowingPath ¶
ParseFollowingPath returns the username from a path such as /users/example_username/following
func ParseInboxPath ¶
ParseInboxPath returns the username from a path such as /users/example_username/inbox
func ParseLikedPath ¶
ParseLikedPath returns the username and ulid from a path such as /users/example_username/liked/SOME_ULID_OF_A_STATUS
func ParseOutboxPath ¶
ParseOutboxPath returns the username from a path such as /users/example_username/outbox
func ParseReportPath ¶ added in v0.7.0
ParseReportPath returns the ulid from a path such as /reports/SOME_ULID_OF_A_REPORT
func ParseStatusesPath ¶
ParseStatusesPath returns the username and ulid from a path such as /users/example_username/statuses/SOME_ULID_OF_A_STATUS
func ParseUserPath ¶
ParseUserPath returns the username from a path such as /users/example_username
func ParseUserWebPath ¶ added in v0.13.3
ParseUserPath returns the username from a path such as /@example_username
func StoragePathForAttachment ¶ added in v0.13.0
func StoragePathForAttachment( accountID string, mediaType string, mediaSize string, mediaID string, extension string, ) string
StoragePathForAttachment generates a storage path for an attachment/emoji/header etc.
Will produce something like:
"01FPST95B8FC3HG3AGCDKPQNQ2/attachment/original/01FPST9QK4V5XWS3F9Z4F2G1X7.gif"
func URIForAttachment ¶ added in v0.13.0
func URIForAttachment( accountID string, mediaType string, mediaSize string, mediaID string, extension string, ) string
URIForAttachment generates a URI for an attachment/emoji/header etc.
Will produce something like:
"https://example.org/fileserver/01FPST95B8FC3HG3AGCDKPQNQ2/attachment/original/01FPST9QK4V5XWS3F9Z4F2G1X7.gif"
func URIForEmoji ¶ added in v0.13.0
URIForEmoji generates an ActivityPub URI for an emoji.
Will produce something like:
"https://example.org/emoji/01FPST9QK4V5XWS3F9Z4F2G1X7"
Types ¶
type UserURIs ¶
type UserURIs struct { // The web URL of the instance host, eg https://example.org HostURL string // The web URL of the user, eg., https://example.org/@example_user UserURL string // The web URL for statuses of this user, eg., https://example.org/@example_user/statuses StatusesURL string // The activitypub URI of this user, eg., https://example.org/users/example_user UserURI string // The activitypub URI for this user's statuses, eg., https://example.org/users/example_user/statuses StatusesURI string // The activitypub URI for this user's activitypub inbox, eg., https://example.org/users/example_user/inbox InboxURI string // The activitypub URI for this user's activitypub outbox, eg., https://example.org/users/example_user/outbox OutboxURI string // The activitypub URI for this user's followers, eg., https://example.org/users/example_user/followers FollowersURI string // The activitypub URI for this user's following, eg., https://example.org/users/example_user/following FollowingURI string // The activitypub URI for this user's liked posts eg., https://example.org/users/example_user/liked LikedURI string // The activitypub URI for this user's featured collections, eg., https://example.org/users/example_user/collections/featured FeaturedCollectionURI string // The URI for this user's public key, eg., https://example.org/users/example_user/publickey PublicKeyURI string }
UserURIs contains a bunch of UserURIs and URLs for a user, host, account, etc.
func GenerateURIsForAccount ¶
GenerateURIsForAccount throws together a bunch of URIs for the given username, with the given protocol and host.