code cleanup & fixed compatibility for non-JS users & fixed fullscreen images being in low resolution

This commit is contained in:
partisan 2024-11-19 10:36:33 +01:00
parent 0d083f53e7
commit db89f9c781
13 changed files with 474 additions and 300 deletions

View file

@ -64,19 +64,13 @@ func PerformImgurImageSearch(query, safe, lang string, page int) ([]ImageSearchR
width, _ := strconv.Atoi(s.Find("a img").AttrOr("width", "0"))
height, _ := strconv.Atoi(s.Find("a img").AttrOr("height", "0"))
// Generate proxied URLs
proxyFullURL := "/imgproxy?url=" + url.QueryEscape(imgSrc)
proxyThumbURL := "/imgproxy?url=" + url.QueryEscape(thumbnailSrc)
results = append(results, ImageSearchResult{
Thumb: thumbnailSrc,
Title: strings.TrimSpace(title),
Full: imgSrc,
Width: width,
Height: height,
Source: "https://imgur.com" + urlPath,
ProxyFull: proxyFullURL,
ProxyThumb: proxyThumbURL,
Thumb: thumbnailSrc,
Title: strings.TrimSpace(title),
Full: imgSrc,
Width: width,
Height: height,
Source: "https://imgur.com" + urlPath,
})
})