2
0

feat(pages): add public releases option for landing pages

Allow private repositories to enable public release downloads on their landing pages. When enabled, unauthenticated users can download release attachments without accessing the repository. Adds download sections to all landing page templates with styling.
This commit is contained in:
2026-03-06 18:04:35 -05:00
parent 6ceb4f0ad4
commit 734dd895bb
9 changed files with 334 additions and 3 deletions

View File

@@ -118,11 +118,13 @@ func renderLandingPage(ctx *context.Context, repo *repo_model.Repository, config
ctx.Data["NumForks"] = repo.NumForks
ctx.Data["Year"] = time.Now().Year()
// Load latest release
// Load latest release with attachments
release, err := repo_model.GetLatestReleaseByRepoID(ctx, repo.ID)
if err == nil && release != nil {
_ = repo_model.GetReleaseAttachments(ctx, release)
ctx.Data["LatestRelease"] = release
}
ctx.Data["PublicReleases"] = config.Advanced.PublicReleases
// Select template based on config
tpl := selectTemplate(config.Template)

View File

@@ -260,6 +260,7 @@ func PagesContent(ctx *context.Context) {
func PagesContentPost(ctx *context.Context) {
config := getPagesLandingConfig(ctx)
config.Advanced.PublicReleases = ctx.FormBool("public_releases")
config.Stats = nil
for i := range 10 {
value := ctx.FormString(fmt.Sprintf("stat_value_%d", i))