mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2025-07-18 00:58:23 +00:00
Fix links to galleries from user pages
This commit is contained in:
parent
6c3f18a449
commit
75e986e240
10
api/user.go
10
api/user.go
@ -3,6 +3,7 @@ package api
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -34,6 +35,8 @@ type Submission struct {
|
|||||||
IsAlbum bool
|
IsAlbum bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var imgurRe = regexp.MustCompile(`https?://i?\.?imgur\.com`)
|
||||||
|
|
||||||
func (client *Client) FetchUser(username string) (User, error) {
|
func (client *Client) FetchUser(username string) (User, error) {
|
||||||
cacheData, found := client.Cache.Get(username + "-user")
|
cacheData, found := client.Cache.Get(username + "-user")
|
||||||
if found {
|
if found {
|
||||||
@ -108,10 +111,15 @@ func (client *Client) FetchSubmissions(username string, sort string, page string
|
|||||||
}
|
}
|
||||||
|
|
||||||
id := value.Get("id").String()
|
id := value.Get("id").String()
|
||||||
|
|
||||||
|
link := "/a/" + id
|
||||||
|
if value.Get("in_gallery").Bool() {
|
||||||
|
link = "/gallery/" + id
|
||||||
|
}
|
||||||
|
|
||||||
submissions = append(submissions, Submission{
|
submissions = append(submissions, Submission{
|
||||||
Id: id,
|
Id: id,
|
||||||
Link: "/a/" + id,
|
Link: link,
|
||||||
Title: value.Get("title").String(),
|
Title: value.Get("title").String(),
|
||||||
Cover: cover,
|
Cover: cover,
|
||||||
Points: value.Get("points").Int(),
|
Points: value.Get("points").Int(),
|
||||||
|
Loading…
Reference in New Issue
Block a user