mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
Source files keep their SPDX-License-Identifier and Hanzo copyright line; the Gitea, Gogs and LFS Test Server copyrights they used to repeat now live once in NOTICE, alongside LICENSE. The header lint accepts any copyright line above the SPDX line, so it no longer demands an upstream one. Co-authored-by: Hanzo Dev <[email protected]>
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package feed
|
|
|
|
import (
|
|
auth_model "github.com/hanzoai/git/models/auth"
|
|
"github.com/hanzoai/git/services/context"
|
|
)
|
|
|
|
// checkRepoFeedTokenScope ensures an API token has repository read scope before a
|
|
// feed serves private repository content, mirroring checkDownloadTokenScope for
|
|
// downloads. Returns false (and writes the response) when the token is denied.
|
|
func checkRepoFeedTokenScope(ctx *context.Context) bool {
|
|
context.CheckRepoScopedToken(ctx, ctx.Repo.Repository, auth_model.Read)
|
|
return !ctx.Written()
|
|
}
|
|
|
|
// RenderBranchFeed render format for branch or file
|
|
func RenderBranchFeed(ctx *context.Context, feedType string) {
|
|
if ctx.Repo.TreePath == "" {
|
|
ShowBranchFeed(ctx, ctx.Repo.Repository, feedType)
|
|
} else {
|
|
ShowFileFeed(ctx, ctx.Repo.Repository, feedType)
|
|
}
|
|
}
|
|
|
|
func RenderBranchFeedRSS(ctx *context.Context) {
|
|
RenderBranchFeed(ctx, "rss")
|
|
}
|
|
|
|
func RenderBranchFeedAtom(ctx *context.Context) {
|
|
RenderBranchFeed(ctx, "atom")
|
|
}
|