SSH Push/Pull Mirroring & Migrations

This commit is contained in:
techknowlogick committed 2025-07-15 15:46:17 -04:00
1 parent 9854df3e87
commit 4c8e222242
30 files changed
+1495 -28

No files matched your search

+3
View File
@@ -12,6 +12,9 @@
<a class="{{if .PageIsOrgSettingsLabels}}active {{end}}item" href="{{.OrgLink}}/settings/labels">
{{ctx.Locale.Tr "repo.labels"}}
</a>
<a class="{{if .PageIsOrgSettingsSSHKeys}}active {{end}}item" href="{{.OrgLink}}/settings/ssh_keys">
{{ctx.Locale.Tr "org.settings.ssh_keys"}}
</a>
{{if .EnableOAuth2}}
<a class="{{if .PageIsSettingsApplications}}active {{end}}item" href="{{.OrgLink}}/settings/applications">
{{ctx.Locale.Tr "settings.applications"}}
+46
View File
@@ -0,0 +1,46 @@
{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings ssh-keys")}}
<div class="ui segments org-setting-content">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "settings.mirror_ssh_title"}}
</h4>
<div class="ui attached segment">
<div class="ui form">
<div class="field">
<label>{{ctx.Locale.Tr "settings.mirror_ssh_description"}}</label>
</div>
{{if .SSHKeypair}}
<div class="field">
<label>{{ctx.Locale.Tr "settings.mirror_ssh_current_key"}}</label>
<div class="ui action input">
<input id="ssh-public-key-content" class="js-ssh-key-content" value="{{.SSHKeypair.PublicKeyWithComment}}" readonly>
<button class="ui compact button" data-clipboard-target="#ssh-public-key-content" data-tooltip-content="{{ctx.Locale.Tr "copy"}}">
{{svg "octicon-copy" 14}}
</button>
</div>
<small class="text grey">{{ctx.Locale.Tr "settings.mirror_ssh_fingerprint"}}: {{.SSHKeypair.Fingerprint}}</small>
</div>
{{end}}
<div class="field">
<form action="{{.OrgLink}}/settings/ssh_keys/regenerate" method="post">
{{.CsrfTokenHtml}}
<button class="ui primary button" type="submit">
{{if .SSHKeypair}}
{{ctx.Locale.Tr "settings.mirror_ssh_regenerate"}}
{{else}}
{{ctx.Locale.Tr "settings.mirror_ssh_generate"}}
{{end}}
</button>
</form>
</div>
<div class="field">
<div class="ui info message">
<i class="info icon"></i>
{{ctx.Locale.Tr "settings.mirror_ssh_documentation"}}
</div>
</div>
</div>
</div>
</div>
{{template "org/settings/layout_footer" .}}
+5 -1
View File
@@ -123,7 +123,11 @@
{{if $.PullMirror}}
<div class="fork-flag">
{{ctx.Locale.Tr "repo.mirror_from"}}
<a target="_blank" rel="noopener noreferrer" href="{{$.PullMirror.RemoteAddress}}">{{$.PullMirror.RemoteAddress}}</a>
{{if not (StringUtils.HasPrefix $.PullMirror.RemoteAddress "ssh://")}}
<a target="_blank" rel="noopener noreferrer" href="{{$.PullMirror.RemoteAddress}}">{{$.PullMirror.RemoteAddress}}</a>
{{else}}
<span>{{$.PullMirror.RemoteAddress}}</span>
{{end}}
{{if $.PullMirror.UpdatedUnix}}{{ctx.Locale.Tr "repo.mirror_sync"}} {{DateUtils.TimeSince $.PullMirror.UpdatedUnix}}{{end}}
</div>
{{end}}
+4
View File
@@ -18,6 +18,10 @@
<span class="help">
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
</span>
<span class="help ssh-help tw-hidden">
<br><strong>{{ctx.Locale.Tr "repo.migrate.ssh_helper_title"}}:</strong> {{ctx.Locale.Tr "repo.migrate.ssh_helper_desc"}}
<a href="/user/settings/keys" target="_blank">{{ctx.Locale.Tr "repo.migrate.ssh_helper_link"}}</a>
</span>
</div>
<div class="inline field {{if .Err_Auth}}error{{end}}">
<label for="auth_username">{{ctx.Locale.Tr "username"}}</label>
+2
View File
@@ -7,5 +7,7 @@
{{if not ($.UserDisabledFeatures.Contains "manage_gpg_keys")}}
{{template "user/settings/keys_gpg" .}}
{{end}}
<div class="ui divider"></div>
{{template "user/settings/keys_mirror_ssh" .}}
</div>
{{template "user/settings/layout_footer" .}}
@@ -0,0 +1,47 @@
<h4 class="ui top attached header">
{{ctx.Locale.Tr "settings.mirror_ssh_title"}}
</h4>
<div class="ui attached segment">
<div class="ui form">
<div class="field">
<label>{{ctx.Locale.Tr "settings.mirror_ssh_description"}}</label>
</div>
{{if .HasMirrorSSHKey}}
<div class="field">
<label>{{ctx.Locale.Tr "settings.mirror_ssh_current_key"}}</label>
<div class="ui action input">
<input id="ssh-public-key-content" class="js-ssh-key-content" value="{{.MirrorSSHKey.PublicKeyWithComment}}" readonly>
<button class="ui compact button" data-clipboard-target="#ssh-public-key-content" data-tooltip-content="{{ctx.Locale.Tr "copy"}}">
{{svg "octicon-copy" 14}}
</button>
</div>
<small class="text grey">{{ctx.Locale.Tr "settings.mirror_ssh_fingerprint"}}: {{.MirrorSSHKey.Fingerprint}}</small>
</div>
{{end}}
<div class="field">
<form action="{{.Link}}/mirror-ssh/regenerate" method="post">
{{.CsrfTokenHtml}}
<button class="ui primary button" type="submit">
{{if .HasMirrorSSHKey}}
{{ctx.Locale.Tr "settings.mirror_ssh_regenerate"}}
{{else}}
{{ctx.Locale.Tr "settings.mirror_ssh_generate"}}
{{end}}
</button>
</form>
</div>
<div class="field">
<div class="ui info message">
<i class="info icon"></i>
{{ctx.Locale.Tr "settings.mirror_ssh_documentation"}}
</div>
</div>
<div class="field">
<div class="ui warning message">
<i class="warning icon"></i>
{{ctx.Locale.Tr "settings.mirror_ssh_org_notice"}}
</div>
</div>
</div>
</div>