Merge redesign into main (#111)

This commit is contained in:
video-prize-ranch
2023-06-10 12:04:29 -04:00
parent 922480f05a
commit 4de1fa1e79
52 changed files with 598 additions and 371 deletions

View File

@@ -3,6 +3,7 @@ package api
import (
"io"
"net/http"
"regexp"
"strings"
"sync"
"time"
@@ -34,6 +35,8 @@ type Submission struct {
IsAlbum bool
}
var imgurRe = regexp.MustCompile(`https?://i?\.?imgur\.com`)
func (client *Client) FetchUser(username string) (User, error) {
cacheData, found := client.Cache.Get(username + "-user")
if found {
@@ -108,10 +111,15 @@ func (client *Client) FetchSubmissions(username string, sort string, page string
}
id := value.Get("id").String()
link := "/a/" + id
if value.Get("in_gallery").Bool() {
link = "/gallery/" + id
}
submissions = append(submissions, Submission{
Id: id,
Link: "/a/" + id,
Link: link,
Title: value.Get("title").String(),
Cover: cover,
Points: value.Get("points").Int(),