diff --git a/models/repo/mirror.go b/models/repo/mirror.go index be7b785612..8fd0cd169e 100644 --- a/models/repo/mirror.go +++ b/models/repo/mirror.go @@ -6,6 +6,7 @@ package repo import ( "context" + "strings" "time" "code.gitea.io/gitea/models/db" @@ -34,6 +35,11 @@ type Mirror struct { RemoteAddress string `xorm:"VARCHAR(2048)"` } +// IsSSHRemoteAddress returns true if the mirror's remote address uses SSH. +func (m *Mirror) IsSSHRemoteAddress() bool { + return strings.HasPrefix(m.RemoteAddress, "ssh://") +} + func init() { db.RegisterModel(new(Mirror)) } diff --git a/options/locale/locale_en-US.json b/options/locale/locale_en-US.json index 952c471183..bac51f5096 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -949,14 +949,14 @@ "settings.visibility.limited_tooltip": "Visible only to authenticated users", "settings.visibility.private": "Private", "settings.visibility.private_tooltip": "Visible only to members of organizations you have joined", - "settings.mirror_ssh_title": "Repository Mirror SSH Keys", - "settings.mirror_ssh_description": "SSH keys for repository mirroring allow you to authenticate with remote Git repositories using SSH. Each user and organization has their own SSH keypair stored securely.", + "settings.mirror_ssh_title": "Managed SSH Keys", + "settings.mirror_ssh_description": "Managed SSH keys allow you to authenticate with remote Git repositories using SSH for mirroring and migrations. Each user and organization has their own SSH keypair stored securely.", "settings.mirror_ssh_current_key": "Current SSH Public Key", "settings.mirror_ssh_fingerprint": "Fingerprint", "settings.mirror_ssh_generate": "Generate SSH Key", "settings.mirror_ssh_regenerate": "Regenerate SSH Key", "settings.mirror_ssh_regenerated": "SSH keypair has been regenerated successfully.", - "settings.mirror_ssh_documentation": "SSH keys are automatically used for SSH-based repository mirrors. Add the public key to your remote Git service (GitHub, GitLab, etc.) to enable authentication.", + "settings.mirror_ssh_documentation": "SSH keys are automatically used for SSH-based repository mirrors and migrations. Add the public key to your remote Git service (GitHub, GitLab, etc.) to enable authentication.", "settings.mirror_ssh_org_notice": "This SSH key is only for your personal repositories. For organization repositories, you need to configure SSH keys in the organization's settings.", "repo.new_repo_helper": "A repository contains all project files, including revision history. Already hosting one elsewhere? Migrate repository.", "repo.owner": "Owner", diff --git a/routers/web/user/setting/keys.go b/routers/web/user/setting/keys.go index 21796e4377..bbba70a6f2 100644 --- a/routers/web/user/setting/keys.go +++ b/routers/web/user/setting/keys.go @@ -374,6 +374,6 @@ func RegenerateUserSSHKeypair(ctx *context.Context) { return } - ctx.Flash.Success(ctx.Tr("settings.mirror_ssh_key_regenerated")) + ctx.Flash.Success(ctx.Tr("settings.mirror_ssh_regenerated")) ctx.Redirect(setting.AppSubURL + "/user/settings/keys") } diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 9639c2ca10..1a88ba651f 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -121,10 +121,10 @@ {{if $.PullMirror}}