diff options
author | 6543 <6543@obermui.de> | 2021-09-07 17:49:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-07 17:49:36 +0200 |
commit | 63d7cbcef13b4eb719a5749a1a79361461c77135 (patch) | |
tree | 55f50695a9cdd31b33eccb5fac766dbaa78cd6ab /templates | |
parent | ded438fb1a320b2f4741e5efbd9a5b3d5e3ad0c7 (diff) | |
download | gitea-63d7cbcef13b4eb719a5749a1a79361461c77135.tar.gz gitea-63d7cbcef13b4eb719a5749a1a79361461c77135.zip |
Make mirror feature more configurable (#16957)
Rename`[repository]` `DISABLE_MIRRORS` to `[mirror]` `DISABLE_NEW_PULL` and add `ENABLED` and `DISABLE_NEW_PUSH` with the below meanings:
- `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors.
- `DISABLE_NEW_PULL`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid.
- `DISABLE_NEW_PUSH`: **false**: Disable the creation of **new** push mirrors. Pre-existing mirrors remain valid.
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/org/home.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/migrate/options.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/settings/options.tmpl | 72 |
3 files changed, 39 insertions, 37 deletions
diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 5e0a53aa56..153de30ca3 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -26,7 +26,7 @@ <div class="ui eleven wide column"> {{if .CanCreateOrgRepo}} <div class="text right"> - {{if not .DisabledMirrors}} + {{if not .DisableNewPullMirrors}} <a class="ui green button" href="{{AppSubUrl}}/repo/migrate?org={{.Org.ID}}&mirror=1">{{.i18n.Tr "new_migrate"}}</a> {{end}} <a class="ui green button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{.i18n.Tr "new_repo"}}</a> diff --git a/templates/repo/migrate/options.tmpl b/templates/repo/migrate/options.tmpl index bca773a53f..8aefaf68f1 100644 --- a/templates/repo/migrate/options.tmpl +++ b/templates/repo/migrate/options.tmpl @@ -1,7 +1,7 @@ <div class="inline field"> <label>{{.i18n.Tr "repo.migrate_options"}}</label> <div class="ui checkbox"> - {{if .DisableMirrors}} + {{if .DisableNewPullMirrors}} <input id="mirror" name="mirror" type="checkbox" readonly> <label>{{.i18n.Tr "repo.migrate_options_mirror_disabled"}}</label> {{else}} diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 4054158544..688966d523 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -70,7 +70,7 @@ </div> - {{if or .Repository.IsMirror (not .DisabledMirrors)}} + {{if .MirrorsEnabled}} <h4 class="ui top attached header"> {{.i18n.Tr "repo.settings.mirror_settings"}} </h4> @@ -191,42 +191,44 @@ <td>{{$.i18n.Tr "repo.settings.mirror_settings.push_mirror.none"}}</td> </tr> {{end}} - <tr> - <td colspan="4"> - <form class="ui form" method="post"> - {{.CsrfTokenHtml}} - <input type="hidden" name="action" value="push-mirror-add"> - <div class="field {{if .Err_PushMirrorAddress}}error{{end}}"> - <label for="push_mirror_address">{{.i18n.Tr "repo.settings.mirror_settings.push_mirror.remote_url"}}</label> - <input id="push_mirror_address" name="push_mirror_address" value="{{.push_mirror_address}}" autocomplete="off" required> - <p class="help">{{.i18n.Tr "repo.mirror_address_desc"}}</p> - </div> - <details class="ui optional field" {{if or .Err_PushMirrorAuth .push_mirror_username}}open{{end}}> - <summary class="p-2"> - {{.i18n.Tr "repo.need_auth"}} - </summary> - <div class="p-2"> - <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}"> - <label for="push_mirror_username">{{.i18n.Tr "username"}}</label> - <input id="push_mirror_username" name="push_mirror_username" value="{{.push_mirror_username}}"> - </div> - <input class="fake" type="password"> - <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}"> - <label for="push_mirror_password">{{.i18n.Tr "password"}}</label> - <input id="push_mirror_password" name="push_mirror_password" type="password" value="{{.push_mirror_password}}" autocomplete="off"> + {{if (not .DisableNewPushMirrors)}} + <tr> + <td colspan="4"> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-add"> + <div class="field {{if .Err_PushMirrorAddress}}error{{end}}"> + <label for="push_mirror_address">{{.i18n.Tr "repo.settings.mirror_settings.push_mirror.remote_url"}}</label> + <input id="push_mirror_address" name="push_mirror_address" value="{{.push_mirror_address}}" autocomplete="off" required> + <p class="help">{{.i18n.Tr "repo.mirror_address_desc"}}</p> + </div> + <details class="ui optional field" {{if or .Err_PushMirrorAuth .push_mirror_username}}open{{end}}> + <summary class="p-2"> + {{.i18n.Tr "repo.need_auth"}} + </summary> + <div class="p-2"> + <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}"> + <label for="push_mirror_username">{{.i18n.Tr "username"}}</label> + <input id="push_mirror_username" name="push_mirror_username" value="{{.push_mirror_username}}"> + </div> + <input class="fake" type="password"> + <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}"> + <label for="push_mirror_password">{{.i18n.Tr "password"}}</label> + <input id="push_mirror_password" name="push_mirror_password" type="password" value="{{.push_mirror_password}}" autocomplete="off"> + </div> </div> + </details> + <div class="inline field {{if .Err_PushMirrorInterval}}error{{end}}"> + <label for="push_mirror_interval">{{.i18n.Tr "repo.mirror_interval"}}</label> + <input id="push_mirror_interval" name="push_mirror_interval" value="{{if .push_mirror_interval}}{{.push_mirror_interval}}{{else}}{{.DefaultMirrorInterval}}{{end}}"> </div> - </details> - <div class="inline field {{if .Err_PushMirrorInterval}}error{{end}}"> - <label for="push_mirror_interval">{{.i18n.Tr "repo.mirror_interval"}}</label> - <input id="push_mirror_interval" name="push_mirror_interval" value="{{if .push_mirror_interval}}{{.push_mirror_interval}}{{else}}{{.DefaultMirrorInterval}}{{end}}"> - </div> - <div class="field"> - <button class="ui green button">{{$.i18n.Tr "repo.settings.mirror_settings.push_mirror.add"}}</button> - </div> - </form> - </td> - </tr> + <div class="field"> + <button class="ui green button">{{$.i18n.Tr "repo.settings.mirror_settings.push_mirror.add"}}</button> + </div> + </form> + </td> + </tr> + {{end}} </tbody> </table> </div> |