socialHandle.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. package models
  2. // SocialHandle represents an external link.
  3. type SocialHandle struct {
  4. Platform string `yaml:"platform" json:"platform,omitempty"`
  5. URL string `yaml:"url" json:"url,omitempty"`
  6. Icon string `json:"icon,omitempty"`
  7. }
  8. // GetSocialHandle will return the details for a supported platform.
  9. func GetSocialHandle(platform string) *SocialHandle {
  10. allPlatforms := GetAllSocialHandles()
  11. if platform, ok := allPlatforms[platform]; ok {
  12. return &platform
  13. }
  14. return nil
  15. }
  16. // GetAllSocialHandles will return a list of all the social platforms we support.
  17. func GetAllSocialHandles() map[string]SocialHandle {
  18. socialHandlePlatforms := map[string]SocialHandle{
  19. "bandcamp": {
  20. Platform: "Bandcamp",
  21. Icon: "/img/platformlogos/bandcamp.svg",
  22. },
  23. "discord": {
  24. Platform: "Discord",
  25. Icon: "/img/platformlogos/discord.svg",
  26. },
  27. "facebook": {
  28. Platform: "Facebook",
  29. Icon: "/img/platformlogos/facebook.svg",
  30. },
  31. "github": {
  32. Platform: "GitHub",
  33. Icon: "/img/platformlogos/github.svg",
  34. },
  35. "gitlab": {
  36. Platform: "GitLab",
  37. Icon: "/img/platformlogos/gitlab.svg",
  38. },
  39. "instagram": {
  40. Platform: "Instagram",
  41. Icon: "/img/platformlogos/instagram.svg",
  42. },
  43. "keyoxide": {
  44. Platform: "Keyoxide",
  45. Icon: "/img/platformlogos/keyoxide.png",
  46. },
  47. "kofi": {
  48. Platform: "Ko-Fi",
  49. Icon: "/img/platformlogos/ko-fi.svg",
  50. },
  51. "linkedin": {
  52. Platform: "LinkedIn",
  53. Icon: "/img/platformlogos/linkedin.svg",
  54. },
  55. "mastodon": {
  56. Platform: "Mastodon",
  57. Icon: "/img/platformlogos/mastodon.svg",
  58. },
  59. "patreon": {
  60. Platform: "Patreon",
  61. Icon: "/img/platformlogos/patreon.svg",
  62. },
  63. "paypal": {
  64. Platform: "Paypal",
  65. Icon: "/img/platformlogos/paypal.svg",
  66. },
  67. "snapchat": {
  68. Platform: "Snapchat",
  69. Icon: "/img/platformlogos/snapchat.svg",
  70. },
  71. "soundcloud": {
  72. Platform: "Soundcloud",
  73. Icon: "/img/platformlogos/soundcloud.svg",
  74. },
  75. "spotify": {
  76. Platform: "Spotify",
  77. Icon: "/img/platformlogos/spotify.svg",
  78. },
  79. "steam": {
  80. Platform: "Steam",
  81. Icon: "/img/platformlogos/steam.svg",
  82. },
  83. "tiktok": {
  84. Platform: "TikTok",
  85. Icon: "/img/platformlogos/tiktok.svg",
  86. },
  87. "twitch": {
  88. Platform: "Twitch",
  89. Icon: "/img/platformlogos/twitch.svg",
  90. },
  91. "twitter": {
  92. Platform: "Twitter",
  93. Icon: "/img/platformlogos/twitter.svg",
  94. },
  95. "youtube": {
  96. Platform: "YouTube",
  97. Icon: "/img/platformlogos/youtube.svg",
  98. },
  99. "odysee": {
  100. Platform: "Odysee",
  101. Icon: "/img/platformlogos/odysee.svg",
  102. },
  103. "lbry": {
  104. Platform: "LBRY",
  105. Icon: "/img/platformlogos/lbry.svg",
  106. },
  107. "liberapay": {
  108. Platform: "LiberaPay",
  109. Icon: "/img/platformlogos/liberapay.svg",
  110. },
  111. "donate": {
  112. Platform: "Donations",
  113. Icon: "/img/platformlogos/donate.svg",
  114. },
  115. "follow": {
  116. Platform: "Follow",
  117. Icon: "/img/platformlogos/follow.svg",
  118. },
  119. }
  120. return socialHandlePlatforms
  121. }