diff --git a/models/repo/repo.go b/models/repo/repo.go index af3488b8f6..2cd3b51b6e 100644 --- a/models/repo/repo.go +++ b/models/repo/repo.go @@ -346,6 +346,11 @@ func (repo *Repository) APIURL() string { return setting.AppURL + "api/v1/repos/" + url.PathEscape(repo.OwnerName) + "/" + url.PathEscape(repo.Name) } +// APAPIURL returns the activitypub repository API URL +func (repo *Repository) APAPIURL() string { + return setting.AppURL + "api/v1/activitypub/repository-id/" + url.PathEscape(string(repo.ID)) +} + // GetCommitsCountCacheKey returns cache key used for commits count caching. func (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool) string { var prefix string diff --git a/models/user/user.go b/models/user/user.go index e016ff5fbd..3e47bfccc8 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -301,6 +301,11 @@ func (u *User) HTMLURL() string { return setting.AppURL + url.PathEscape(u.Name) } +// APAPIURL returns the IRI to the api endpoint of the user +func (u *User) APAPIURL() string { + return setting.AppURL + url.PathEscape("api/v1/activitypub/user-id/") + url.PathEscape(string(u.ID)) +} + // OrganisationLink returns the organization sub page link. func (u *User) OrganisationLink() string { return setting.AppSubURL + "/org/" + url.PathEscape(u.Name)