RandomAnimeGirl: let's get it work
All checks were successful
Update Website / update (push) Successful in 2s

This commit is contained in:
Kagura 2024-11-25 20:34:48 +08:00
parent 49c607db4a
commit 7481f6c74b

View file

@ -88,10 +88,10 @@ async function getImage(data: ApiResponse): Promise<Blob | null> {
if (data.source == undefined || data.source.direct == null) {
return null
}
const url = data.source.direct.replace('i.pximg.net', 'p.lolicon.cyou')
const url = data.source.direct.replace('i.pximg.net', 'pixiv.lolicon.cyou')
let result: Blob | null = null
const response = await fetch(url, { method: "GET" })
const response = await fetch(url, { method: "GET" ,redirect: 'follow'})
if (response.status != 200) {
if (response.status == 404 && data.image != undefined) { // 尝试使用备用的
@ -127,8 +127,7 @@ function handleGetImage(type: string | null, setter: React.Dispatch<React.SetSta
(async () => {
try {
const result = await api.getFromEndpoint(endpoint)
const image = null
// const image = await getImage(result)
const image = await getImage(result)
if (image != null) {
setter(URL.createObjectURL(image));
} else {