mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-26 06:43:56 +01:00
Implement getting APAPIURL for repo and user
This commit is contained in:
parent
ed256ca540
commit
0c6c43003c
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue