mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-25 09:54:46 +02:00
fix linter
This commit is contained in:
+17
-17
@@ -18,16 +18,16 @@ import (
|
|||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserSSHKeypair represents an SSH keypair for repository mirroring
|
// SSHKeypair represents an SSH keypair for repository mirroring
|
||||||
type UserSSHKeypair struct {
|
type SSHKeypair struct {
|
||||||
OwnerID int64
|
OwnerID int64
|
||||||
PrivateKeyEncrypted string
|
PrivateKeyEncrypted string
|
||||||
PublicKey string
|
PublicKey string
|
||||||
Fingerprint string
|
Fingerprint string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserSSHKeypairByOwner gets the SSH keypair for the given owner
|
// GetSSHKeypairByOwner gets the SSH keypair for the given owner
|
||||||
func GetUserSSHKeypairByOwner(ctx context.Context, ownerID int64) (*UserSSHKeypair, error) {
|
func GetSSHKeypairByOwner(ctx context.Context, ownerID int64) (*SSHKeypair, error) {
|
||||||
settings, err := GetSettings(ctx, ownerID, []string{
|
settings, err := GetSettings(ctx, ownerID, []string{
|
||||||
UserSSHMirrorPrivPem,
|
UserSSHMirrorPrivPem,
|
||||||
UserSSHMirrorPubPem,
|
UserSSHMirrorPubPem,
|
||||||
@@ -40,7 +40,7 @@ func GetUserSSHKeypairByOwner(ctx context.Context, ownerID int64) (*UserSSHKeypa
|
|||||||
return nil, util.NewNotExistErrorf("SSH keypair does not exist for owner %d", ownerID)
|
return nil, util.NewNotExistErrorf("SSH keypair does not exist for owner %d", ownerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
keypair := &UserSSHKeypair{
|
keypair := &SSHKeypair{
|
||||||
OwnerID: ownerID,
|
OwnerID: ownerID,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,8 +61,8 @@ func GetUserSSHKeypairByOwner(ctx context.Context, ownerID int64) (*UserSSHKeypa
|
|||||||
return keypair, nil
|
return keypair, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateUserSSHKeypair creates a new SSH keypair for mirroring
|
// CreateSSHKeypair creates a new SSH keypair for mirroring
|
||||||
func CreateUserSSHKeypair(ctx context.Context, ownerID int64) (*UserSSHKeypair, error) {
|
func CreateSSHKeypair(ctx context.Context, ownerID int64) (*SSHKeypair, error) {
|
||||||
publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
|
publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to generate Ed25519 keypair: %w", err)
|
return nil, fmt.Errorf("failed to generate Ed25519 keypair: %w", err)
|
||||||
@@ -98,7 +98,7 @@ func CreateUserSSHKeypair(ctx context.Context, ownerID int64) (*UserSSHKeypair,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
keypair := &UserSSHKeypair{
|
keypair := &SSHKeypair{
|
||||||
OwnerID: ownerID,
|
OwnerID: ownerID,
|
||||||
PrivateKeyEncrypted: privateKeyEncrypted,
|
PrivateKeyEncrypted: privateKeyEncrypted,
|
||||||
PublicKey: publicKeyStr,
|
PublicKey: publicKeyStr,
|
||||||
@@ -109,7 +109,7 @@ func CreateUserSSHKeypair(ctx context.Context, ownerID int64) (*UserSSHKeypair,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetDecryptedPrivateKey returns the decrypted private key
|
// GetDecryptedPrivateKey returns the decrypted private key
|
||||||
func (k *UserSSHKeypair) GetDecryptedPrivateKey() (ed25519.PrivateKey, error) {
|
func (k *SSHKeypair) GetDecryptedPrivateKey() (ed25519.PrivateKey, error) {
|
||||||
decrypted, err := secret.DecryptSecret(setting.SecretKey, k.PrivateKeyEncrypted)
|
decrypted, err := secret.DecryptSecret(setting.SecretKey, k.PrivateKeyEncrypted)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to decrypt private key: %w", err)
|
return nil, fmt.Errorf("failed to decrypt private key: %w", err)
|
||||||
@@ -118,7 +118,7 @@ func (k *UserSSHKeypair) GetDecryptedPrivateKey() (ed25519.PrivateKey, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPublicKeyWithComment returns the public key with a descriptive comment (namespace-fingerprint@domain)
|
// GetPublicKeyWithComment returns the public key with a descriptive comment (namespace-fingerprint@domain)
|
||||||
func (k *UserSSHKeypair) GetPublicKeyWithComment(ctx context.Context) (string, error) {
|
func (k *SSHKeypair) GetPublicKeyWithComment(ctx context.Context) (string, error) {
|
||||||
owner, err := GetUserByID(ctx, k.OwnerID)
|
owner, err := GetUserByID(ctx, k.OwnerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return k.PublicKey, nil
|
return k.PublicKey, nil
|
||||||
@@ -138,8 +138,8 @@ func (k *UserSSHKeypair) GetPublicKeyWithComment(ctx context.Context) (string, e
|
|||||||
return strings.TrimSpace(k.PublicKey) + " " + comment, nil
|
return strings.TrimSpace(k.PublicKey) + " " + comment, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteUserSSHKeypair deletes an SSH keypair
|
// DeleteSSHKeypair deletes an SSH keypair
|
||||||
func DeleteUserSSHKeypair(ctx context.Context, ownerID int64) error {
|
func DeleteSSHKeypair(ctx context.Context, ownerID int64) error {
|
||||||
return db.WithTx(ctx, func(ctx context.Context) error {
|
return db.WithTx(ctx, func(ctx context.Context) error {
|
||||||
if err := DeleteUserSetting(ctx, ownerID, UserSSHMirrorPrivPem); err != nil {
|
if err := DeleteUserSetting(ctx, ownerID, UserSSHMirrorPrivPem); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -151,14 +151,14 @@ func DeleteUserSSHKeypair(ctx context.Context, ownerID int64) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegenerateUserSSHKeypair regenerates an SSH keypair for the given owner
|
// RegenerateSSHKeypair regenerates an SSH keypair for the given owner
|
||||||
func RegenerateUserSSHKeypair(ctx context.Context, ownerID int64) (*UserSSHKeypair, error) {
|
func RegenerateSSHKeypair(ctx context.Context, ownerID int64) (*SSHKeypair, error) {
|
||||||
return db.WithTx2(ctx, func(ctx context.Context) (*UserSSHKeypair, error) {
|
return db.WithTx2(ctx, func(ctx context.Context) (*SSHKeypair, error) {
|
||||||
if err := DeleteUserSSHKeypair(ctx, ownerID); err != nil {
|
if err := DeleteSSHKeypair(ctx, ownerID); err != nil {
|
||||||
return nil, fmt.Errorf("failed to delete existing keypair: %w", err)
|
return nil, fmt.Errorf("failed to delete existing keypair: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
newKeypair, err := CreateUserSSHKeypair(ctx, ownerID)
|
newKeypair, err := CreateSSHKeypair(ctx, ownerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUserSSHKeypair(t *testing.T) {
|
func TestSSHKeypair(t *testing.T) {
|
||||||
require.NoError(t, unittest.PrepareTestDatabase())
|
require.NoError(t, unittest.PrepareTestDatabase())
|
||||||
|
|
||||||
t.Run("CreateUserSSHKeypair", func(t *testing.T) {
|
t.Run("CreateSSHKeypair", func(t *testing.T) {
|
||||||
// Test creating a new SSH keypair for a user
|
// Test creating a new SSH keypair for a user
|
||||||
keypair, err := user_model.CreateUserSSHKeypair(t.Context(), 1)
|
keypair, err := user_model.CreateSSHKeypair(t.Context(), 1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.NotNil(t, keypair)
|
assert.NotNil(t, keypair)
|
||||||
assert.Equal(t, int64(1), keypair.OwnerID)
|
assert.Equal(t, int64(1), keypair.OwnerID)
|
||||||
@@ -33,7 +33,7 @@ func TestUserSSHKeypair(t *testing.T) {
|
|||||||
assert.Contains(t, keypair.PublicKey, "ssh-ed25519")
|
assert.Contains(t, keypair.PublicKey, "ssh-ed25519")
|
||||||
|
|
||||||
// Test creating a keypair for an organization
|
// Test creating a keypair for an organization
|
||||||
orgKeypair, err := user_model.CreateUserSSHKeypair(t.Context(), 2)
|
orgKeypair, err := user_model.CreateSSHKeypair(t.Context(), 2)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.NotNil(t, orgKeypair)
|
assert.NotNil(t, orgKeypair)
|
||||||
assert.Equal(t, int64(2), orgKeypair.OwnerID)
|
assert.Equal(t, int64(2), orgKeypair.OwnerID)
|
||||||
@@ -43,20 +43,20 @@ func TestUserSSHKeypair(t *testing.T) {
|
|||||||
assert.NotEqual(t, keypair.Fingerprint, orgKeypair.Fingerprint)
|
assert.NotEqual(t, keypair.Fingerprint, orgKeypair.Fingerprint)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("GetUserSSHKeypairByOwner", func(t *testing.T) {
|
t.Run("GetSSHKeypairByOwner", func(t *testing.T) {
|
||||||
// Create a keypair first
|
// Create a keypair first
|
||||||
created, err := user_model.CreateUserSSHKeypair(t.Context(), 3)
|
created, err := user_model.CreateSSHKeypair(t.Context(), 3)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Test retrieving the keypair
|
// Test retrieving the keypair
|
||||||
retrieved, err := user_model.GetUserSSHKeypairByOwner(t.Context(), 3)
|
retrieved, err := user_model.GetSSHKeypairByOwner(t.Context(), 3)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, created.OwnerID, retrieved.OwnerID)
|
assert.Equal(t, created.OwnerID, retrieved.OwnerID)
|
||||||
assert.Equal(t, created.PublicKey, retrieved.PublicKey)
|
assert.Equal(t, created.PublicKey, retrieved.PublicKey)
|
||||||
assert.Equal(t, created.Fingerprint, retrieved.Fingerprint)
|
assert.Equal(t, created.Fingerprint, retrieved.Fingerprint)
|
||||||
|
|
||||||
// Test retrieving non-existent keypair
|
// Test retrieving non-existent keypair
|
||||||
_, err = user_model.GetUserSSHKeypairByOwner(t.Context(), 999)
|
_, err = user_model.GetSSHKeypairByOwner(t.Context(), 999)
|
||||||
assert.ErrorIs(t, err, util.ErrNotExist)
|
assert.ErrorIs(t, err, util.ErrNotExist)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ func TestUserSSHKeypair(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a keypair
|
// Create a keypair
|
||||||
keypair, err := user_model.CreateUserSSHKeypair(t.Context(), 4)
|
keypair, err := user_model.CreateSSHKeypair(t.Context(), 4)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Test decrypting the private key
|
// Test decrypting the private key
|
||||||
@@ -81,31 +81,31 @@ func TestUserSSHKeypair(t *testing.T) {
|
|||||||
assert.Len(t, publicKey, ed25519.PublicKeySize)
|
assert.Len(t, publicKey, ed25519.PublicKeySize)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("DeleteUserSSHKeypair", func(t *testing.T) {
|
t.Run("DeleteSSHKeypair", func(t *testing.T) {
|
||||||
// Create a keypair
|
// Create a keypair
|
||||||
_, err := user_model.CreateUserSSHKeypair(t.Context(), 5)
|
_, err := user_model.CreateSSHKeypair(t.Context(), 5)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Verify it exists
|
// Verify it exists
|
||||||
_, err = user_model.GetUserSSHKeypairByOwner(t.Context(), 5)
|
_, err = user_model.GetSSHKeypairByOwner(t.Context(), 5)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Delete it
|
// Delete it
|
||||||
err = user_model.DeleteUserSSHKeypair(t.Context(), 5)
|
err = user_model.DeleteSSHKeypair(t.Context(), 5)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Verify it's gone
|
// Verify it's gone
|
||||||
_, err = user_model.GetUserSSHKeypairByOwner(t.Context(), 5)
|
_, err = user_model.GetSSHKeypairByOwner(t.Context(), 5)
|
||||||
assert.ErrorIs(t, err, util.ErrNotExist)
|
assert.ErrorIs(t, err, util.ErrNotExist)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("RegenerateUserSSHKeypair", func(t *testing.T) {
|
t.Run("RegenerateSSHKeypair", func(t *testing.T) {
|
||||||
// Create initial keypair
|
// Create initial keypair
|
||||||
original, err := user_model.CreateUserSSHKeypair(t.Context(), 6)
|
original, err := user_model.CreateSSHKeypair(t.Context(), 6)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Regenerate it
|
// Regenerate it
|
||||||
regenerated, err := user_model.RegenerateUserSSHKeypair(t.Context(), 6)
|
regenerated, err := user_model.RegenerateSSHKeypair(t.Context(), 6)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Verify it's different
|
// Verify it's different
|
||||||
@@ -116,7 +116,7 @@ func TestUserSSHKeypair(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserSSHKeypairConcurrency(t *testing.T) {
|
func TestSSHKeypairConcurrency(t *testing.T) {
|
||||||
require.NoError(t, unittest.PrepareTestDatabase())
|
require.NoError(t, unittest.PrepareTestDatabase())
|
||||||
|
|
||||||
if setting.SecretKey == "" {
|
if setting.SecretKey == "" {
|
||||||
@@ -131,7 +131,7 @@ func TestUserSSHKeypairConcurrency(t *testing.T) {
|
|||||||
// Start multiple goroutines creating keypairs for different owners
|
// Start multiple goroutines creating keypairs for different owners
|
||||||
for i := range 10 {
|
for i := range 10 {
|
||||||
go func(ownerID int64) {
|
go func(ownerID int64) {
|
||||||
_, err := user_model.CreateUserSSHKeypair(ctx, ownerID+100)
|
_, err := user_model.CreateSSHKeypair(ctx, ownerID+100)
|
||||||
results <- err
|
results <- err
|
||||||
}(int64(i))
|
}(int64(i))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ func IsSSHURL(remote string) bool {
|
|||||||
|
|
||||||
// GetOrCreateSSHKeypair gets or creates the managed SSH keypair for the given
|
// GetOrCreateSSHKeypair gets or creates the managed SSH keypair for the given
|
||||||
// owner (user or organization — they share the same backing storage).
|
// owner (user or organization — they share the same backing storage).
|
||||||
func GetOrCreateSSHKeypair(ctx context.Context, ownerID int64) (*user_model.UserSSHKeypair, error) {
|
func GetOrCreateSSHKeypair(ctx context.Context, ownerID int64) (*user_model.SSHKeypair, error) {
|
||||||
keypair, err := user_model.GetUserSSHKeypairByOwner(ctx, ownerID)
|
keypair, err := user_model.GetSSHKeypairByOwner(ctx, ownerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if db.IsErrNotExist(err) {
|
if db.IsErrNotExist(err) {
|
||||||
log.Debug("Creating new SSH keypair for owner %d", ownerID)
|
log.Debug("Creating new SSH keypair for owner %d", ownerID)
|
||||||
return user_model.CreateUserSSHKeypair(ctx, ownerID)
|
return user_model.CreateSSHKeypair(ctx, ownerID)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("failed to get SSH keypair for owner %d: %w", ownerID, err)
|
return nil, fmt.Errorf("failed to get SSH keypair for owner %d: %w", ownerID, err)
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ func GetOrCreateSSHKeypair(ctx context.Context, ownerID int64) (*user_model.User
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetSSHKeypairForRepository gets the managed SSH keypair for the repository's owner.
|
// GetSSHKeypairForRepository gets the managed SSH keypair for the repository's owner.
|
||||||
func GetSSHKeypairForRepository(ctx context.Context, repo *repo_model.Repository) (*user_model.UserSSHKeypair, error) {
|
func GetSSHKeypairForRepository(ctx context.Context, repo *repo_model.Repository) (*user_model.SSHKeypair, error) {
|
||||||
return GetOrCreateSSHKeypair(ctx, repo.OwnerID)
|
return GetOrCreateSSHKeypair(ctx, repo.OwnerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ func RegenerateManagedSSHKey(ctx *context.APIContext) {
|
|||||||
// "403":
|
// "403":
|
||||||
// "$ref": "#/responses/forbidden"
|
// "$ref": "#/responses/forbidden"
|
||||||
|
|
||||||
keypair, err := user_model.RegenerateUserSSHKeypair(ctx, ctx.Org.Organization.ID)
|
keypair, err := user_model.RegenerateSSHKeypair(ctx, ctx.Org.Organization.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.APIErrorInternal(err)
|
ctx.APIErrorInternal(err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ func RegenerateManagedSSHKey(ctx *context.APIContext) {
|
|||||||
// fingerprint:
|
// fingerprint:
|
||||||
// type: string
|
// type: string
|
||||||
|
|
||||||
keypair, err := user_model.RegenerateUserSSHKeypair(ctx, ctx.Doer.ID)
|
keypair, err := user_model.RegenerateSSHKeypair(ctx, ctx.Doer.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.APIErrorInternal(err)
|
ctx.APIErrorInternal(err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func SSHKeys(ctx *context.Context) {
|
|||||||
|
|
||||||
publicKeyWithComment, _ := keypair.GetPublicKeyWithComment(ctx)
|
publicKeyWithComment, _ := keypair.GetPublicKeyWithComment(ctx)
|
||||||
ctx.Data["SSHKeypair"] = struct {
|
ctx.Data["SSHKeypair"] = struct {
|
||||||
*user_model.UserSSHKeypair
|
*user_model.SSHKeypair
|
||||||
PublicKeyWithComment string
|
PublicKeyWithComment string
|
||||||
}{keypair, publicKeyWithComment}
|
}{keypair, publicKeyWithComment}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ func SSHKeys(ctx *context.Context) {
|
|||||||
|
|
||||||
// RegenerateSSHKey regenerates the SSH keypair for organization mirror operations
|
// RegenerateSSHKey regenerates the SSH keypair for organization mirror operations
|
||||||
func RegenerateSSHKey(ctx *context.Context) {
|
func RegenerateSSHKey(ctx *context.Context) {
|
||||||
_, err := user_model.RegenerateUserSSHKeypair(ctx, ctx.Org.Organization.ID)
|
_, err := user_model.RegenerateSSHKeypair(ctx, ctx.Org.Organization.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("RegenerateSSHKeypairForOrg", err)
|
ctx.ServerError("RegenerateSSHKeypairForOrg", err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -350,10 +350,10 @@ func loadKeysData(ctx *context.Context) {
|
|||||||
// Create a struct with the public key including comment
|
// Create a struct with the public key including comment
|
||||||
publicKeyWithComment, _ := mirrorKeypair.GetPublicKeyWithComment(ctx)
|
publicKeyWithComment, _ := mirrorKeypair.GetPublicKeyWithComment(ctx)
|
||||||
mirrorKeyData := struct {
|
mirrorKeyData := struct {
|
||||||
*user_model.UserSSHKeypair
|
*user_model.SSHKeypair
|
||||||
PublicKeyWithComment string
|
PublicKeyWithComment string
|
||||||
}{
|
}{
|
||||||
UserSSHKeypair: mirrorKeypair,
|
SSHKeypair: mirrorKeypair,
|
||||||
PublicKeyWithComment: publicKeyWithComment,
|
PublicKeyWithComment: publicKeyWithComment,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,9 +363,9 @@ func loadKeysData(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegenerateUserSSHKeypair regenerates the SSH keypair for repository mirroring
|
// RegenerateSSHKeypair regenerates the SSH keypair for repository mirroring
|
||||||
func RegenerateUserSSHKeypair(ctx *context.Context) {
|
func RegenerateSSHKeypair(ctx *context.Context) {
|
||||||
_, err := user_model.RegenerateUserSSHKeypair(ctx, ctx.Doer.ID)
|
_, err := user_model.RegenerateSSHKeypair(ctx, ctx.Doer.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("RegenerateSSHKeypairForUser", err)
|
ctx.ServerError("RegenerateSSHKeypairForUser", err)
|
||||||
return
|
return
|
||||||
|
|||||||
+1
-1
@@ -673,7 +673,7 @@ func registerWebRoutes(m *web.Router, webAuth *AuthMiddleware) {
|
|||||||
m.Combo("/keys").Get(user_setting.Keys).
|
m.Combo("/keys").Get(user_setting.Keys).
|
||||||
Post(web.Bind(forms.AddKeyForm{}), user_setting.KeysPost)
|
Post(web.Bind(forms.AddKeyForm{}), user_setting.KeysPost)
|
||||||
m.Post("/keys/delete", user_setting.DeleteKey)
|
m.Post("/keys/delete", user_setting.DeleteKey)
|
||||||
m.Post("/keys/mirror-ssh/regenerate", user_setting.RegenerateUserSSHKeypair)
|
m.Post("/keys/mirror-ssh/regenerate", user_setting.RegenerateSSHKeypair)
|
||||||
m.Group("/packages", func() {
|
m.Group("/packages", func() {
|
||||||
m.Get("", user_setting.Packages)
|
m.Get("", user_setting.Packages)
|
||||||
m.Group("/rules", func() {
|
m.Group("/rules", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user