(c *fiber.Ctx)
| 158 | } |
| 159 | |
| 160 | func UserProfileImage(c *fiber.Ctx) error { |
| 161 | // auth |
| 162 | _, pds, _, oauthToken, err := GetAuthFromReq(c) |
| 163 | |
| 164 | if err != nil { |
| 165 | blankstring := "" |
| 166 | oauthToken = &blankstring |
| 167 | } |
| 168 | |
| 169 | screen_name := c.Query("screen_name") |
| 170 | if screen_name == "" { |
| 171 | return c.Status(fiber.StatusBadRequest).SendString("screen_name is required") |
| 172 | } |
| 173 | // size := c.Query("size") |
| 174 | // if size == "" { |
| 175 | // size = "normal" |
| 176 | // } |
| 177 | // cdn_size := ":profile_bigger" |
| 178 | |
| 179 | // switch size { |
| 180 | // case "normal": |
| 181 | // cdn_size = ":profile_normal" |
| 182 | // case "original": |
| 183 | // cdn_size = ":large" |
| 184 | // } |
| 185 | |
| 186 | userinfo, err := blueskyapi.GetUserInfo(*pds, *oauthToken, screen_name, false) |
| 187 | if err != nil { |
| 188 | return c.Status(fiber.StatusInternalServerError).SendString("Failed to fetch user info") |
| 189 | } |
| 190 | |
| 191 | //c.Redirect("https://cdn.bsky.app/img/" + screen_name + ":profile_bigger") |
| 192 | c.Set("Cache-Control", "public, max-age=900") // 15 minutes |
| 193 | return c.Redirect(userinfo.ProfileImageURL) |
| 194 | } |
| 195 | |
| 196 | // This is here because it doesn't just want a direct link to the m3u8 file. |
| 197 | // So we make an extremely basic site that just includes the video, and maybe the alt text if i care enough |
nothing calls this directly
no test coverage detected