mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2025-12-13 19:55:21 +00:00
UI cleanup and changes
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"codeberg.org/video-prize-ranch/rimgo/utils"
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
"github.com/patrickmn/go-cache"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
@@ -103,13 +104,17 @@ func ParseAlbum(data gjson.Result) (Album, error) {
|
||||
url := value.Get("url").String()
|
||||
url = strings.ReplaceAll(url, "https://i.imgur.com", "")
|
||||
|
||||
description := value.Get("metadata.description").String()
|
||||
description = strings.ReplaceAll(description, "\n", "<br>")
|
||||
description = bluemonday.UGCPolicy().Sanitize(description)
|
||||
|
||||
media = append(media, Media{
|
||||
Id: value.Get("id").String(),
|
||||
Name: value.Get("name").String(),
|
||||
MimeType: value.Get("mime_type").String(),
|
||||
Type: value.Get("type").String(),
|
||||
Title: value.Get("metadata.title").String(),
|
||||
Description: value.Get("metadata.description").String(),
|
||||
Description: description,
|
||||
Url: url,
|
||||
})
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ func ParseComment(data gjson.Result) Comment {
|
||||
|
||||
comment := data.Get("comment").String()
|
||||
|
||||
comment = strings.ReplaceAll(comment, "\n", "<br>")
|
||||
|
||||
for _, match := range imgRe.FindAllString(comment, -1) {
|
||||
img := iImgurRe.ReplaceAllString(match, "")
|
||||
img = `<img src="` + img + `" class="comment__media" loading="lazy"/>`
|
||||
|
||||
Reference in New Issue
Block a user