summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/setting_secrets.go
blob: 57a4c470dd6018969b59076b8ce0a3d0acf7764f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// 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,
		0,
		ctx.Repo.Repository.ID,
		ctx.Repo.RepoLink+"/settings/secrets",
	)
}