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:
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user