forked from forgejo/forgejo
Add RSS Feeds for branches and files (#22719)
Fix #22228 adding RSS feeds for branches and files. RSS feeds are accessed through: * [gitea]/src/branch/{branch}.rss * [gitea]/src/branch/{branch}/{file_name}.rss No changes have been made to the UI to expose the feed urls for branches and files.
This commit is contained in:
parent
f16b668980
commit
56d4893b2a
11 changed files with 170 additions and 6 deletions
22
routers/web/feed/render.go
Normal file
22
routers/web/feed/render.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package feed
|
||||
|
||||
import (
|
||||
model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
)
|
||||
|
||||
// RenderBranchFeed render format for branch or file
|
||||
func RenderBranchFeed(ctx *context.Context) {
|
||||
_, _, showFeedType := GetFeedType(ctx.Params(":reponame"), ctx.Req)
|
||||
var renderer func(ctx *context.Context, repo *model.Repository, formatType string)
|
||||
switch {
|
||||
case ctx.Repo.TreePath == "":
|
||||
renderer = ShowBranchFeed
|
||||
case ctx.Repo.TreePath != "":
|
||||
renderer = ShowFileFeed
|
||||
}
|
||||
renderer(ctx, ctx.Repo.Repository, showFeedType)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue