Skip to content

Commit

Permalink
feat: add bluesky as a new AccountType
Browse files Browse the repository at this point in the history
  • Loading branch information
Tennessine699 committed Jan 12, 2025
1 parent 9276fbb commit ee4fc99
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/swagger/traPortfolio.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ components:
- 9
- 10
- 11
- 12
x-enum-varnames:
- homepage
- blog
Expand All @@ -871,6 +872,7 @@ components:
- soundcloud
- hackthebox
- ctftime
- bluesky
x-enum-descriptions:
- ホームページ (IDはリンクのURLそのまま)
- ブログ (IDはリンクのURLそのまま)
Expand All @@ -884,6 +886,7 @@ components:
- SoundCloud
- HackTheBox
- CTFtime
- Bluesky
x-go-type: uint8
Project:
title: Project
Expand Down
2 changes: 2 additions & 0 deletions internal/domain/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const (
SOUNDCLOUD
HACKTHEBOX
CTFTIME
BLUESKY
AccountLimit
)

Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions internal/pkgs/random/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit ee4fc99

Please sign in to comment.