From ee4fc997ddf0268c7865ea75ac08aedd756f5267 Mon Sep 17 00:00:00 2001 From: Tennessine699 Date: Sun, 12 Jan 2025 22:07:44 +0900 Subject: [PATCH] feat: add bluesky as a new AccountType --- docs/swagger/traPortfolio.v1.yaml | 3 +++ internal/domain/user.go | 2 ++ internal/pkgs/random/random.go | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/docs/swagger/traPortfolio.v1.yaml b/docs/swagger/traPortfolio.v1.yaml index d8457692..bbbf0de5 100644 --- a/docs/swagger/traPortfolio.v1.yaml +++ b/docs/swagger/traPortfolio.v1.yaml @@ -858,6 +858,7 @@ components: - 9 - 10 - 11 + - 12 x-enum-varnames: - homepage - blog @@ -871,6 +872,7 @@ components: - soundcloud - hackthebox - ctftime + - bluesky x-enum-descriptions: - ホームページ (IDはリンクのURLそのまま) - ブログ (IDはリンクのURLそのまま) @@ -884,6 +886,7 @@ components: - SoundCloud - HackTheBox - CTFtime + - Bluesky x-go-type: uint8 Project: title: Project diff --git a/internal/domain/user.go b/internal/domain/user.go index cdb95968..f34e562e 100644 --- a/internal/domain/user.go +++ b/internal/domain/user.go @@ -96,6 +96,7 @@ const ( SOUNDCLOUD HACKTHEBOX CTFTIME + BLUESKY AccountLimit ) @@ -139,6 +140,7 @@ func IsValidAccountURL(accountType AccountType, URL string) bool { SOUNDCLOUD: regexp.MustCompile(`^https://soundcloud\.com/[a-z0-9-_]+$`), HACKTHEBOX: regexp.MustCompile(`^https://app\.hackthebox\.com/users/[a-zA-Z0-9]+$`), CTFTIME: regexp.MustCompile(`^https://ctftime\.org/user/[0-9]+$`), + BLUESKY: regexp.MustCompile(`^https://bsky.app/profile/[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z0-9.]+$`), } if r, ok := urlRegexp[accountType]; ok { diff --git a/internal/pkgs/random/random.go b/internal/pkgs/random/random.go index fcbb77f4..e70da966 100644 --- a/internal/pkgs/random/random.go +++ b/internal/pkgs/random/random.go @@ -140,6 +140,11 @@ func AccountURLString(accountType domain.AccountType) string { "https://ctftime.org/user/4285429253", "https://ctftime.org/user/8295210365", }, + domain.BLUESKY: { + "https://bsky.app/profile/bluesky.bsky.social", + "https://bsky.app/profile/tpf.bsky.social", + "https://bsky.app/profile/portfolio.trap.jp", + }, } if accountType == domain.HOMEPAGE || accountType == domain.BLOG { return fmt.Sprintf("https://%s", AlphaNumeric())