|
|
|
@ -24,6 +24,8 @@ import ( |
|
|
|
|
"code.gitea.io/gitea/modules/base" |
|
|
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
|
"code.gitea.io/gitea/modules/git" |
|
|
|
|
"code.gitea.io/gitea/modules/indexer/code" |
|
|
|
|
"code.gitea.io/gitea/modules/indexer/stats" |
|
|
|
|
"code.gitea.io/gitea/modules/lfs" |
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
|
"code.gitea.io/gitea/modules/repository" |
|
|
|
@ -67,6 +69,23 @@ func Settings(ctx *context.Context) { |
|
|
|
|
signing, _ := asymkey_service.SigningKey(ctx.Repo.Repository.RepoPath()) |
|
|
|
|
ctx.Data["SigningKeyAvailable"] = len(signing) > 0 |
|
|
|
|
ctx.Data["SigningSettings"] = setting.Repository.Signing |
|
|
|
|
ctx.Data["CodeIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled |
|
|
|
|
if ctx.User.IsAdmin { |
|
|
|
|
if setting.Indexer.RepoIndexerEnabled { |
|
|
|
|
status, err := repo_model.GetIndexerStatus(ctx.Repo.Repository, repo_model.RepoIndexerTypeCode) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.ServerError("repo.indexer_status", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
ctx.Data["CodeIndexerStatus"] = status |
|
|
|
|
} |
|
|
|
|
status, err := repo_model.GetIndexerStatus(ctx.Repo.Repository, repo_model.RepoIndexerTypeStats) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.ServerError("repo.indexer_status", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
ctx.Data["StatsIndexerStatus"] = status |
|
|
|
|
} |
|
|
|
|
pushMirrors, err := repo_model.GetPushMirrorsByRepoID(ctx.Repo.Repository.ID) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.ServerError("GetPushMirrorsByRepoID", err) |
|
|
|
@ -515,6 +534,34 @@ func SettingsPost(ctx *context.Context) { |
|
|
|
|
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) |
|
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/settings") |
|
|
|
|
|
|
|
|
|
case "admin_index": |
|
|
|
|
if !ctx.User.IsAdmin { |
|
|
|
|
ctx.Error(http.StatusForbidden) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch form.RequestReindexType { |
|
|
|
|
case "stats": |
|
|
|
|
if err := stats.UpdateRepoIndexer(ctx.Repo.Repository); err != nil { |
|
|
|
|
ctx.ServerError("UpdateStatsRepondexer", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
case "code": |
|
|
|
|
if !setting.Indexer.RepoIndexerEnabled { |
|
|
|
|
ctx.Error(http.StatusForbidden) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
code.UpdateRepoIndexer(ctx.Repo.Repository) |
|
|
|
|
default: |
|
|
|
|
ctx.NotFound("", nil) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.Trace("Repository reindex for %s requested: %s/%s", form.RequestReindexType, ctx.Repo.Owner.Name, repo.Name) |
|
|
|
|
|
|
|
|
|
ctx.Flash.Success(ctx.Tr("repo.settings.reindex_requested")) |
|
|
|
|
ctx.Redirect(ctx.Repo.RepoLink + "/settings") |
|
|
|
|
|
|
|
|
|
case "convert": |
|
|
|
|
if !ctx.Repo.IsOwner() { |
|
|
|
|
ctx.Error(http.StatusNotFound) |
|
|
|
|