2
0
Files
logikonline d38d20bfaf
All checks were successful
Build and Release / Create Release (push) Has been skipped
Build and Release / Unit Tests (push) Successful in 3m4s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 4m8s
Build and Release / Lint (push) Successful in 5m19s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin, macos) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been skipped
Build and Release / Build Binary (linux/arm64) (push) Has been skipped
Add Move to Vault feature for file browser
Adds a "Move to Vault" button to the file view toolbar that allows
developers to move sensitive files directly into encrypted Vault storage.

Features:
- Button appears next to Edit/Delete when Vault plugin is loaded
- Confirmation page shows file details and warnings
- File is encrypted and stored in Vault as type "file"
- File is then deleted from the repository with a commit
- 50MB file size limit for vault storage

Files added:
- routers/web/repo/vault_move.go - Handler for move-to-vault action
- templates/repo/editor/move_to_vault.tmpl - Confirmation page

Files modified:
- routers/web/repo/view_file.go - Added CanMoveToVault permission check
- templates/repo/view_file.tmpl - Added Move to Vault button
- routers/web/web.go - Registered /_move-to-vault/* route
- services/forms/repo_form_editor.go - Added MoveToVaultForm
- options/locale/locale_en-US.json - Added translation keys

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 22:19:05 -05:00

63 lines
1.4 KiB
Go

// Copyright 2025 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forms
import (
"net/http"
"code.gitcaddy.com/server/v3/modules/optional"
"code.gitcaddy.com/server/v3/modules/web/middleware"
"code.gitcaddy.com/server/v3/services/context"
"gitea.com/go-chi/binding"
)
type CommitCommonForm struct {
TreePath string `binding:"MaxSize(500)"`
CommitSummary string `binding:"MaxSize(100)"`
CommitMessage string
CommitChoice string `binding:"Required;MaxSize(50)"`
NewBranchName string `binding:"GitRefName;MaxSize(100)"`
LastCommit string
Signoff bool
CommitEmail string
}
func (f *CommitCommonForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
ctx := context.GetValidateContext(req)
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}
type CommitCommonFormInterface interface {
GetCommitCommonForm() *CommitCommonForm
}
func (f *CommitCommonForm) GetCommitCommonForm() *CommitCommonForm {
return f
}
type EditRepoFileForm struct {
CommitCommonForm
Content optional.Option[string]
}
type DeleteRepoFileForm struct {
CommitCommonForm
}
type MoveToVaultForm struct {
SecretName string `form:"secret_name"`
CommitSummary string `form:"commit_summary"`
}
type UploadRepoFileForm struct {
CommitCommonForm
Files []string
}
type CherryPickForm struct {
CommitCommonForm
Revert bool
}