RandomAnimeGirl: let's get it work
All checks were successful
Update Website / update (push) Successful in 2s
All checks were successful
Update Website / update (push) Successful in 2s
This commit is contained in:
parent
49c607db4a
commit
7481f6c74b
1 changed files with 3 additions and 4 deletions
|
@ -88,10 +88,10 @@ async function getImage(data: ApiResponse): Promise<Blob | null> {
|
||||||
if (data.source == undefined || data.source.direct == null) {
|
if (data.source == undefined || data.source.direct == null) {
|
||||||
return 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
|
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 != 200) {
|
||||||
if (response.status == 404 && data.image != undefined) { // 尝试使用备用的
|
if (response.status == 404 && data.image != undefined) { // 尝试使用备用的
|
||||||
|
@ -127,8 +127,7 @@ function handleGetImage(type: string | null, setter: React.Dispatch<React.SetSta
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const result = await api.getFromEndpoint(endpoint)
|
const result = await api.getFromEndpoint(endpoint)
|
||||||
const image = null
|
const image = await getImage(result)
|
||||||
// const image = await getImage(result)
|
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
setter(URL.createObjectURL(image));
|
setter(URL.createObjectURL(image));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue