mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-09 11:43:10 +02:00
removed extra indirection
This commit is contained in:
1 parent
30fa04c7b8
commit
0bbfd6aa38
7 files changed
+18
-73
No files matched your search
@@ -7,8 +7,9 @@ import (
|
||||
"net/http"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
ssh_module "gitea.dev/modules/ssh"
|
||||
"gitea.dev/services/context"
|
||||
mirror_service "gitea.dev/services/mirror"
|
||||
)
|
||||
|
||||
// GetManagedSSHKey gets the SSH public key for organization mirroring
|
||||
@@ -39,7 +40,7 @@ func GetManagedSSHKey(ctx *context.APIContext) {
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
keypair, err := mirror_service.GetOrCreateSSHKeypairForOrg(ctx, ctx.Org.Organization.ID)
|
||||
keypair, err := ssh_module.GetOrCreateSSHKeypairForOrg(ctx, ctx.Org.Organization.ID)
|
||||
if err != nil {
|
||||
if db.IsErrNotExist(err) {
|
||||
ctx.APIError(http.StatusNotFound, "SSH keypair not found")
|
||||
@@ -81,7 +82,7 @@ func RegenerateManagedSSHKey(ctx *context.APIContext) {
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
|
||||
keypair, err := mirror_service.RegenerateSSHKeypairForOrg(ctx, ctx.Org.Organization.ID)
|
||||
keypair, err := repo_model.RegenerateUserSSHKeypair(ctx, ctx.Org.Organization.ID)
|
||||
if err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
return
|
||||
|
||||
@@ -7,8 +7,9 @@ import (
|
||||
"net/http"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
ssh_module "gitea.dev/modules/ssh"
|
||||
"gitea.dev/services/context"
|
||||
mirror_service "gitea.dev/services/mirror"
|
||||
)
|
||||
|
||||
// GetManagedSSHKey gets the SSH public key for user mirroring
|
||||
@@ -31,7 +32,7 @@ func GetManagedSSHKey(ctx *context.APIContext) {
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
keypair, err := mirror_service.GetOrCreateSSHKeypairForUser(ctx, ctx.Doer.ID)
|
||||
keypair, err := ssh_module.GetOrCreateSSHKeypairForUser(ctx, ctx.Doer.ID)
|
||||
if err != nil {
|
||||
if db.IsErrNotExist(err) {
|
||||
ctx.APIError(http.StatusNotFound, "SSH keypair not found")
|
||||
@@ -65,7 +66,7 @@ func RegenerateManagedSSHKey(ctx *context.APIContext) {
|
||||
// fingerprint:
|
||||
// type: string
|
||||
|
||||
keypair, err := mirror_service.RegenerateSSHKeypairForUser(ctx, ctx.Doer.ID)
|
||||
keypair, err := repo_model.RegenerateUserSSHKeypair(ctx, ctx.Doer.ID)
|
||||
if err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user