mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 16:44:26 +00:00
Allow site admin to disable mirrors (#11740)
* Allow site admin to disable mirrors Signed-off-by: jolheiser <john.olheiser@gmail.com> * No need to run through Safe Signed-off-by: jolheiser <john.olheiser@gmail.com> * Clarify only disabling NEW mirrors Signed-off-by: jolheiser <john.olheiser@gmail.com> * Apply suggestions from @guillep2k Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
This commit is contained in:
parent
d0a18a1270
commit
a6fd2f23f7
@ -55,6 +55,8 @@ DISABLED_REPO_UNITS =
|
|||||||
DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki
|
DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki
|
||||||
; Prefix archive files by placing them in a directory named after the repository
|
; Prefix archive files by placing them in a directory named after the repository
|
||||||
PREFIX_ARCHIVE_FILES = true
|
PREFIX_ARCHIVE_FILES = true
|
||||||
|
; Disable the creation of new mirrors. Pre-existing mirrors remain valid.
|
||||||
|
DISABLE_MIRRORS = false
|
||||||
|
|
||||||
[repository.editor]
|
[repository.editor]
|
||||||
; List of file extensions for which lines should be wrapped in the Monaco editor
|
; List of file extensions for which lines should be wrapped in the Monaco editor
|
||||||
|
@ -70,6 +70,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
|||||||
- `ENABLE_PUSH_CREATE_USER`: **false**: Allow users to push local repositories to Gitea and have them automatically created for a user.
|
- `ENABLE_PUSH_CREATE_USER`: **false**: Allow users to push local repositories to Gitea and have them automatically created for a user.
|
||||||
- `ENABLE_PUSH_CREATE_ORG`: **false**: Allow users to push local repositories to Gitea and have them automatically created for an org.
|
- `ENABLE_PUSH_CREATE_ORG`: **false**: Allow users to push local repositories to Gitea and have them automatically created for an org.
|
||||||
- `PREFIX_ARCHIVE_FILES`: **true**: Prefix archive files by placing them in a directory named after the repository.
|
- `PREFIX_ARCHIVE_FILES`: **true**: Prefix archive files by placing them in a directory named after the repository.
|
||||||
|
- `DISABLE_MIRRORS`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid.
|
||||||
|
|
||||||
### Repository - Pull Request (`repository.pull-request`)
|
### Repository - Pull Request (`repository.pull-request`)
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ var (
|
|||||||
DisabledRepoUnits []string
|
DisabledRepoUnits []string
|
||||||
DefaultRepoUnits []string
|
DefaultRepoUnits []string
|
||||||
PrefixArchiveFiles bool
|
PrefixArchiveFiles bool
|
||||||
|
DisableMirrors bool
|
||||||
|
|
||||||
// Repository editor settings
|
// Repository editor settings
|
||||||
Editor struct {
|
Editor struct {
|
||||||
@ -142,6 +143,7 @@ var (
|
|||||||
DisabledRepoUnits: []string{},
|
DisabledRepoUnits: []string{},
|
||||||
DefaultRepoUnits: []string{},
|
DefaultRepoUnits: []string{},
|
||||||
PrefixArchiveFiles: true,
|
PrefixArchiveFiles: true,
|
||||||
|
DisableMirrors: false,
|
||||||
|
|
||||||
// Repository editor settings
|
// Repository editor settings
|
||||||
Editor: struct {
|
Editor: struct {
|
||||||
|
@ -689,6 +689,7 @@ form.name_pattern_not_allowed = The pattern '%s' is not allowed in a repository
|
|||||||
need_auth = Clone Authorization
|
need_auth = Clone Authorization
|
||||||
migrate_type = Migration Type
|
migrate_type = Migration Type
|
||||||
migrate_type_helper = This repository will be a <span class="text blue">mirror</span>
|
migrate_type_helper = This repository will be a <span class="text blue">mirror</span>
|
||||||
|
migrate_type_helper_disabled = Your site administrator has disabled new mirrors.
|
||||||
migrate_items = Migration Items
|
migrate_items = Migration Items
|
||||||
migrate_items_wiki = Wiki
|
migrate_items_wiki = Wiki
|
||||||
migrate_items_milestones = Milestones
|
migrate_items_milestones = Milestones
|
||||||
|
@ -118,7 +118,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
|
|||||||
RepoName: form.RepoName,
|
RepoName: form.RepoName,
|
||||||
Description: form.Description,
|
Description: form.Description,
|
||||||
Private: form.Private || setting.Repository.ForcePrivate,
|
Private: form.Private || setting.Repository.ForcePrivate,
|
||||||
Mirror: form.Mirror,
|
Mirror: form.Mirror && !setting.Repository.DisableMirrors,
|
||||||
AuthUsername: form.AuthUsername,
|
AuthUsername: form.AuthUsername,
|
||||||
AuthPassword: form.AuthPassword,
|
AuthPassword: form.AuthPassword,
|
||||||
Wiki: form.Wiki,
|
Wiki: form.Wiki,
|
||||||
|
@ -259,6 +259,7 @@ func Migrate(ctx *context.Context) {
|
|||||||
ctx.Data["Title"] = ctx.Tr("new_migrate")
|
ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||||
ctx.Data["private"] = getRepoPrivate(ctx)
|
ctx.Data["private"] = getRepoPrivate(ctx)
|
||||||
ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
|
ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
|
||||||
|
ctx.Data["DisableMirrors"] = setting.Repository.DisableMirrors
|
||||||
ctx.Data["mirror"] = ctx.Query("mirror") == "1"
|
ctx.Data["mirror"] = ctx.Query("mirror") == "1"
|
||||||
ctx.Data["wiki"] = ctx.Query("wiki") == "1"
|
ctx.Data["wiki"] = ctx.Query("wiki") == "1"
|
||||||
ctx.Data["milestones"] = ctx.Query("milestones") == "1"
|
ctx.Data["milestones"] = ctx.Query("milestones") == "1"
|
||||||
@ -360,7 +361,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
|||||||
RepoName: form.RepoName,
|
RepoName: form.RepoName,
|
||||||
Description: form.Description,
|
Description: form.Description,
|
||||||
Private: form.Private || setting.Repository.ForcePrivate,
|
Private: form.Private || setting.Repository.ForcePrivate,
|
||||||
Mirror: form.Mirror,
|
Mirror: form.Mirror && !setting.Repository.DisableMirrors,
|
||||||
AuthUsername: form.AuthUsername,
|
AuthUsername: form.AuthUsername,
|
||||||
AuthPassword: form.AuthPassword,
|
AuthPassword: form.AuthPassword,
|
||||||
Wiki: form.Wiki,
|
Wiki: form.Wiki,
|
||||||
|
@ -81,8 +81,13 @@
|
|||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{.i18n.Tr "repo.migrate_type"}}</label>
|
<label>{{.i18n.Tr "repo.migrate_type"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<input id="mirror" name="mirror" type="checkbox" {{if .mirror}}checked{{end}}>
|
{{if .DisableMirrors}}
|
||||||
<label>{{.i18n.Tr "repo.migrate_type_helper" | Safe}}</label>
|
<input id="mirror" name="mirror" type="checkbox" readonly>
|
||||||
|
<label>{{.i18n.Tr "repo.migrate_type_helper_disabled"}}</label>
|
||||||
|
{{else}}
|
||||||
|
<input id="mirror" name="mirror" type="checkbox" {{if .mirror}}checked{{end}}>
|
||||||
|
<label>{{.i18n.Tr "repo.migrate_type_helper" | Safe}}</label>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="migrate_items" class="ui field">
|
<div id="migrate_items" class="ui field">
|
||||||
|
Loading…
Reference in New Issue
Block a user