uris

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UsersPath        = "users"         // UsersPath is for serving users info
	ActorsPath       = "actors"        // ActorsPath is for serving actors 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
	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
)

Variables

This section is empty.

Functions

func GenerateURIForAttachment

func GenerateURIForAttachment(accountID string, mediaType string, mediaSize string, mediaID string, extension string) string

GenerateURIForAttachment generates a URI for an attachment/emoji/header etc. Will produced something like https://example.org/fileserver/01FPST95B8FC3HG3AGCDKPQNQ2/attachment/original/01FPST9QK4V5XWS3F9Z4F2G1X7.gif

func GenerateURIForBlock

func GenerateURIForBlock(username string, thisBlockID string) string

GenerateURIForBlock returns the AP URI for a new block activity -- something like: https://example.org/users/whatever_user/blocks/01F7XTH1QGBAPMGF49WJZ91XGC

func GenerateURIForEmailConfirm

func GenerateURIForEmailConfirm(token string) string

GenerateURIForEmailConfirm returns a link for email confirmation -- something like: https://example.org/confirm_email?token=490e337c-0162-454f-ac48-4b22bb92a205

func GenerateURIForEmoji

func GenerateURIForEmoji(emojiID string) string

GenerateURIForEmoji generates an activitypub uri for a new emoji.

func GenerateURIForFollow

func GenerateURIForFollow(username string, thisFollowID string) string

GenerateURIForFollow returns the AP URI for a new follow -- something like: https://example.org/users/whatever_user/follow/01F7XTH1QGBAPMGF49WJZ91XGC

func GenerateURIForLike

func GenerateURIForLike(username string, thisFavedID string) string

GenerateURIForLike returns the AP URI for a new like/fave -- something like: https://example.org/users/whatever_user/liked/01F7XTH1QGBAPMGF49WJZ91XGC

func GenerateURIForUpdate

func GenerateURIForUpdate(username string, thisUpdateID string) string

GenerateURIForUpdate returns the AP URI for a new update activity -- something like: https://example.org/users/whatever_user#updates/01F7XTH1QGBAPMGF49WJZ91XGC

func IsBlockPath

func IsBlockPath(id *url.URL) bool

IsBlockPath returns true if the given URL path corresponds to eg /users/example_username/blocks/SOME_ULID_OF_A_BLOCK

func IsFollowPath

func IsFollowPath(id *url.URL) bool

IsFollowPath returns true if the given URL path corresponds to eg /users/example_username/follow/SOME_ULID_OF_A_FOLLOW

func IsFollowersPath

func IsFollowersPath(id *url.URL) bool

IsFollowersPath returns true if the given URL path corresponds to eg /users/example_username/followers

func IsFollowingPath

func IsFollowingPath(id *url.URL) bool

IsFollowingPath returns true if the given URL path corresponds to eg /users/example_username/following

func IsInboxPath

func IsInboxPath(id *url.URL) bool

IsInboxPath returns true if the given URL path corresponds to eg /users/example_username/inbox

func IsInstanceActorPath

func IsInstanceActorPath(id *url.URL) bool

IsInstanceActorPath returns true if the given URL path corresponds to eg /actors/example_username

func IsLikePath

func IsLikePath(id *url.URL) bool

IsLikePath returns true if the given URL path corresponds to eg /users/example_username/liked/SOME_ULID_OF_A_STATUS

func IsLikedPath

func IsLikedPath(id *url.URL) bool

IsLikedPath returns true if the given URL path corresponds to eg /users/example_username/liked

func IsOutboxPath

func IsOutboxPath(id *url.URL) bool

IsOutboxPath returns true if the given URL path corresponds to eg /users/example_username/outbox

func IsPublicKeyPath

func IsPublicKeyPath(id *url.URL) bool

IsPublicKeyPath returns true if the given URL path corresponds to eg /users/example_username/main-key

func IsStatusesPath

func IsStatusesPath(id *url.URL) bool

IsStatusesPath returns true if the given URL path corresponds to eg /users/example_username/statuses/SOME_ULID_OF_A_STATUS

func IsUserPath

func IsUserPath(id *url.URL) bool

IsUserPath returns true if the given URL path corresponds to eg /users/example_username

func ParseBlockPath

func ParseBlockPath(id *url.URL) (username string, ulid string, err error)

ParseBlockPath returns the username and ulid from a path such as /users/example_username/blocks/SOME_ULID_OF_A_BLOCK

func ParseFollowersPath

func ParseFollowersPath(id *url.URL) (username string, err error)

ParseFollowersPath returns the username from a path such as /users/example_username/followers

func ParseFollowingPath

func ParseFollowingPath(id *url.URL) (username string, err error)

ParseFollowingPath returns the username from a path such as /users/example_username/following

func ParseInboxPath

func ParseInboxPath(id *url.URL) (username string, err error)

ParseInboxPath returns the username from a path such as /users/example_username/inbox

func ParseLikedPath

func ParseLikedPath(id *url.URL) (username string, ulid string, err error)

ParseLikedPath returns the username and ulid from a path such as /users/example_username/liked/SOME_ULID_OF_A_STATUS

func ParseOutboxPath

func ParseOutboxPath(id *url.URL) (username string, err error)

ParseOutboxPath returns the username from a path such as /users/example_username/outbox

func ParseStatusesPath

func ParseStatusesPath(id *url.URL) (username string, ulid string, err error)

ParseStatusesPath returns the username and ulid from a path such as /users/example_username/statuses/SOME_ULID_OF_A_STATUS

func ParseUserPath

func ParseUserPath(id *url.URL) (username string, err error)

ParseUserPath returns the username from a path such as /users/example_username

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
	CollectionURI 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

func GenerateURIsForAccount(username string) *UserURIs

GenerateURIsForAccount throws together a bunch of URIs for the given username, with the given protocol and host.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL