diff options
author | Reo <112817228+reopt999@users.noreply.github.com> | 2022-12-22 04:06:26 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-21 15:06:26 -0600 |
commit | 48d71b7d6b0ddefdc1db76d5b5f3b3eabc4ae9e4 (patch) | |
tree | 98399f876a26694162178f4dd6deef6deaff4eb9 /routers/web/repo/release.go | |
parent | 9914b21493784793fb4a3660369befb98a9bd073 (diff) | |
download | gitea-48d71b7d6b0ddefdc1db76d5b5f3b3eabc4ae9e4.tar.gz gitea-48d71b7d6b0ddefdc1db76d5b5f3b3eabc4ae9e4.zip |
Add Feed for Releases and Tags (#21696)
Fixes #19091
Add Feed for Releases and Tags, can be accessed through
`reponame/releases.rss`, `reponame/releases.atom`, `reponame/tags.rss`,
and `reponame/tags.atom`
Signed-off-by: Reo <reo_999@proton.me>
Diffstat (limited to 'routers/web/repo/release.go')
-rw-r--r-- | routers/web/repo/release.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index 2047a1cfb9..54f503642b 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -23,6 +23,7 @@ import ( "code.gitea.io/gitea/modules/upload" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/web" + "code.gitea.io/gitea/routers/web/feed" "code.gitea.io/gitea/services/forms" releaseservice "code.gitea.io/gitea/services/release" ) @@ -199,6 +200,30 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { ctx.HTML(http.StatusOK, tplReleases) } +// ReleasesFeedRSS get feeds for releases in RSS format +func ReleasesFeedRSS(ctx *context.Context) { + releasesOrTagsFeed(ctx, true, "rss") +} + +// TagsListFeedRSS get feeds for tags in RSS format +func TagsListFeedRSS(ctx *context.Context) { + releasesOrTagsFeed(ctx, false, "rss") +} + +// ReleasesFeedAtom get feeds for releases in Atom format +func ReleasesFeedAtom(ctx *context.Context) { + releasesOrTagsFeed(ctx, true, "atom") +} + +// TagsListFeedAtom get feeds for tags in RSS format +func TagsListFeedAtom(ctx *context.Context) { + releasesOrTagsFeed(ctx, false, "atom") +} + +func releasesOrTagsFeed(ctx *context.Context, isReleasesOnly bool, formatType string) { + feed.ShowReleaseFeed(ctx, ctx.Repo.Repository, isReleasesOnly, formatType) +} + // SingleRelease renders a single release's page func SingleRelease(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.release.releases") |