Properly enable cors for images by default

This commit is contained in:
schroda
2025-01-26 17:18:27 +01:00
parent a81c3c6afa
commit 3698c19aba
3 changed files with 28 additions and 14 deletions

View File

@@ -35,7 +35,7 @@ interface IProps {
shouldDecode?: boolean;
useFetchApi?: boolean;
allowCors?: boolean;
disableCors?: boolean;
priority?: Priority;
@@ -47,7 +47,7 @@ export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTML
shouldLoad = true,
shouldDecode,
useFetchApi,
allowCors,
disableCors,
src,
alt,
onLoad,
@@ -86,7 +86,12 @@ export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTML
return () => {};
}
const imageRequest = requestManager.requestImage(src, { priority, shouldDecode, useFetchApi, allowCors });
const imageRequest = requestManager.requestImage(src, {
priority,
shouldDecode,
useFetchApi,
disableCors,
});
let cacheTimeout: NodeJS.Timeout;
const fetchImage = async () => {
@@ -158,7 +163,7 @@ export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTML
}),
]}
ref={imgRef}
crossOrigin={allowCors ? 'anonymous' : undefined}
crossOrigin={disableCors ? undefined : 'anonymous'}
src={imageSourceUrl}
alt={alt}
draggable={false}

View File

@@ -152,7 +152,7 @@ export const TrackerMangaCard = ({
<TrackerMangaCardLink url={manga.trackingUrl}>
<SpinnerImage
useFetchApi={false}
allowCors={false}
disableCors
alt={manga.title}
src={manga.coverUrl}
spinnerStyle={{ width: '100%', height: '100%' }}