Files
PixivFE/core/webapi/personal.go
iacore ba3ec43559 refactor image url rewrite
thanks semgrep!

Squashed commit of the following:

commit 3a5e08190583804d3b330ecc6cb3422bc04c291b
Author: iacore <noreply+gpg-stub@1a-insec.net>
Date:   Fri Feb 9 12:58:07 2024 +0000

    final

commit f1cdc73e9f8d331715de8e8aec5d1573218df0c3
Author: iacore <noreply+gpg-stub@1a-insec.net>
Date:   Fri Feb 9 12:50:23 2024 +0000

    manual tweak

commit 3a3ba2b8d8d7ce9af4d897288596d9318c715a08
Author: iacore <noreply+gpg-stub@1a-insec.net>
Date:   Fri Feb 9 12:49:15 2024 +0000

    stage 1
2024-02-09 12:59:06 +00:00

39 lines
837 B
Go

package core
import (
session "codeberg.org/vnpower/pixivfe/v2/core/config"
http "codeberg.org/vnpower/pixivfe/v2/core/http"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v2"
)
func GetNewestFromFollowing(c *fiber.Ctx, mode, page string) ([]ArtworkBrief, error) {
token := session.GetToken(c)
URL := http.GetNewestFromFollowingURL(mode, page)
var body struct {
Thumbnails json.RawMessage `json:"thumbnails"`
}
var artworks struct {
Artworks []ArtworkBrief `json:"illust"`
}
resp, err := http.UnwrapWebAPIRequest(URL, token)
if err != nil {
return nil, err
}
resp = session.ProxyImageUrl(resp)
err = json.Unmarshal([]byte(resp), &body)
if err != nil {
return nil, err
}
err = json.Unmarshal([]byte(body.Thumbnails), &artworks)
if err != nil {
return nil, err
}
return artworks.Artworks, nil
}