From c0ebfa9da3db3e60d7b403a1bf8b8a19c32c5dc7 Mon Sep 17 00:00:00 2001 From: cassiozareck Date: Mon, 14 Aug 2023 16:52:44 -0300 Subject: [PATCH] [FEAT] add Forgero Git Service Signed-off-by: cassiozareck (cherry picked from commit a878adfe628cf6dc367a17c3715fcd3499aa02b6) Adding description and Forgejo SVG (cherry picked from commit 13738c03804d019f28550e46a4ebc37dbe3a5cfc) Undo reordering and tmpl redirection (cherry picked from commit 9ae51c46f42acecac834371857e638098ebf6d27) (cherry picked from commit 70fffdc61d06dd1d70b6a31496676a23d3d0c2fc) --- modules/structs/repo.go | 6 +++++- options/locale/locale_en-US.ini | 1 + public/assets/img/svg/gitea-forgejo.svg | 9 +++++++++ services/convert/utils.go | 2 ++ services/convert/utils_test.go | 2 ++ templates/repo/migrate/forgejo.tmpl | 1 + web_src/svg/gitea-forgejo.svg | 9 +++++++++ 7 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 public/assets/img/svg/gitea-forgejo.svg create mode 100644 templates/repo/migrate/forgejo.tmpl create mode 100644 web_src/svg/gitea-forgejo.svg diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 6a2ba4836b..dd119868e9 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -286,6 +286,7 @@ const ( OneDevService // 6 onedev service GitBucketService // 7 gitbucket service CodebaseService // 8 codebase service + ForgejoService // 9 forgejo service ) // Name represents the service type's name @@ -311,6 +312,8 @@ func (gt GitServiceType) Title() string { return "GitBucket" case CodebaseService: return "Codebase" + case ForgejoService: + return "Forgejo" case PlainGitService: return "Git" } @@ -352,7 +355,7 @@ type MigrateRepoOptions struct { // TokenAuth represents whether a service type supports token-based auth func (gt GitServiceType) TokenAuth() bool { switch gt { - case GithubService, GiteaService, GitlabService: + case GithubService, GiteaService, GitlabService, ForgejoService: return true } return false @@ -363,6 +366,7 @@ func (gt GitServiceType) TokenAuth() bool { var SupportedFullGitService = []GitServiceType{ GithubService, GitlabService, + ForgejoService, GiteaService, GogsService, OneDevService, diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 31d47ad6af..6bf312f981 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1081,6 +1081,7 @@ migrate.migrating_failed_no_addr = Migration failed. migrate.github.description = Migrate data from github.com or other GitHub instances. migrate.git.description = Migrate a repository only from any Git service. migrate.gitlab.description = Migrate data from gitlab.com or other GitLab instances. +migrate.forgejo.description = Migrate data from codeberg.org or other Forgejo instances. migrate.gitea.description = Migrate data from gitea.com or other Gitea instances. migrate.gogs.description = Migrate data from notabug.org or other Gogs instances. migrate.onedev.description = Migrate data from code.onedev.io or other OneDev instances. diff --git a/public/assets/img/svg/gitea-forgejo.svg b/public/assets/img/svg/gitea-forgejo.svg new file mode 100644 index 0000000000..ef617c00f3 --- /dev/null +++ b/public/assets/img/svg/gitea-forgejo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/services/convert/utils.go b/services/convert/utils.go index cdce60831c..fe35fd2dac 100644 --- a/services/convert/utils.go +++ b/services/convert/utils.go @@ -36,6 +36,8 @@ func ToGitServiceType(value string) structs.GitServiceType { return structs.OneDevService case "gitbucket": return structs.GitBucketService + case "forgejo": + return structs.ForgejoService default: return structs.PlainGitService } diff --git a/services/convert/utils_test.go b/services/convert/utils_test.go index 1ac03a3097..b464d8bb68 100644 --- a/services/convert/utils_test.go +++ b/services/convert/utils_test.go @@ -28,6 +28,8 @@ func TestToGitServiceType(t *testing.T) { typ: "gitlab", enum: 4, }, { typ: "gogs", enum: 5, + }, { + typ: "forgejo", enum: 9, }, { typ: "trash", enum: 1, }} diff --git a/templates/repo/migrate/forgejo.tmpl b/templates/repo/migrate/forgejo.tmpl new file mode 100644 index 0000000000..3caadbee15 --- /dev/null +++ b/templates/repo/migrate/forgejo.tmpl @@ -0,0 +1 @@ +{{template "repo/migrate/gitea" .}} diff --git a/web_src/svg/gitea-forgejo.svg b/web_src/svg/gitea-forgejo.svg new file mode 100644 index 0000000000..e00e5963cf --- /dev/null +++ b/web_src/svg/gitea-forgejo.svg @@ -0,0 +1,9 @@ +