mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-30 22:11:07 +00:00 
			
		
		
		
	Fixes #22183 Replaces #22187 This PR adds secrets for users. I refactored the files for organizations and repos to use the same logic and templates. I splitted the secrets from deploy keys again and reverted the fix from #22187. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
		
			
				
	
	
		
			46 lines
		
	
	
	
		
			947 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
	
		
			947 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright 2022 The Gitea Authors. All rights reserved.
 | |
| // SPDX-License-Identifier: MIT
 | |
| 
 | |
| package repo
 | |
| 
 | |
| import (
 | |
| 	"net/http"
 | |
| 
 | |
| 	"code.gitea.io/gitea/modules/base"
 | |
| 	"code.gitea.io/gitea/modules/context"
 | |
| 	"code.gitea.io/gitea/modules/setting"
 | |
| 	shared "code.gitea.io/gitea/routers/web/shared/secrets"
 | |
| )
 | |
| 
 | |
| const (
 | |
| 	tplSecrets base.TplName = "repo/settings/secrets"
 | |
| )
 | |
| 
 | |
| func Secrets(ctx *context.Context) {
 | |
| 	ctx.Data["Title"] = ctx.Tr("secrets.secrets")
 | |
| 	ctx.Data["PageIsSettingsSecrets"] = true
 | |
| 	ctx.Data["DisableSSH"] = setting.SSH.Disabled
 | |
| 
 | |
| 	shared.SetSecretsContext(ctx, 0, ctx.Repo.Repository.ID)
 | |
| 	if ctx.Written() {
 | |
| 		return
 | |
| 	}
 | |
| 
 | |
| 	ctx.HTML(http.StatusOK, tplSecrets)
 | |
| }
 | |
| 
 | |
| func SecretsPost(ctx *context.Context) {
 | |
| 	shared.PerformSecretsPost(
 | |
| 		ctx,
 | |
| 		0,
 | |
| 		ctx.Repo.Repository.ID,
 | |
| 		ctx.Repo.RepoLink+"/settings/secrets",
 | |
| 	)
 | |
| }
 | |
| 
 | |
| func DeleteSecret(ctx *context.Context) {
 | |
| 	shared.PerformSecretsDelete(
 | |
| 		ctx,
 | |
| 		ctx.Repo.RepoLink+"/settings/secrets",
 | |
| 	)
 | |
| }
 |