mirror of
https://github.com/barthuijgen/factorio-sites.git
synced 2024-11-20 18:15:37 +02:00
Use storage url directly for render, instead of api
This commit is contained in:
parent
0f325bb2fd
commit
d409d5e7df
@ -153,6 +153,7 @@ export const BlueprintSubPage: React.FC<BlueprintProps> = ({
|
|||||||
string={string}
|
string={string}
|
||||||
label={blueprint.label || ""}
|
label={blueprint.label || ""}
|
||||||
blueprint_hash={blueprint.blueprint_hash}
|
blueprint_hash={blueprint.blueprint_hash}
|
||||||
|
image_hash={blueprint.image_hash}
|
||||||
onSetRenderer={setRenderer}
|
onSetRenderer={setRenderer}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -226,6 +226,7 @@ export const BlueprintBookSubPage: React.FC<BlueprintBookSubPageProps> = ({
|
|||||||
string={selectedBlueprintString}
|
string={selectedBlueprintString}
|
||||||
label={selected.data.label || ""}
|
label={selected.data.label || ""}
|
||||||
blueprint_hash={selected.data.blueprint_hash}
|
blueprint_hash={selected.data.blueprint_hash}
|
||||||
|
image_hash={selected.type === "blueprint" ? selected.data.image_hash : undefined}
|
||||||
onSetRenderer={setRenderer}
|
onSetRenderer={setRenderer}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -9,6 +9,7 @@ export type RENDERERS = "fbe" | "fbsr";
|
|||||||
interface BlueprintImageProps {
|
interface BlueprintImageProps {
|
||||||
string: string;
|
string: string;
|
||||||
blueprint_hash: string;
|
blueprint_hash: string;
|
||||||
|
image_hash?: string;
|
||||||
label: string;
|
label: string;
|
||||||
onSetRenderer?: (renderer: RENDERERS) => void;
|
onSetRenderer?: (renderer: RENDERERS) => void;
|
||||||
}
|
}
|
||||||
@ -16,6 +17,7 @@ interface BlueprintImageProps {
|
|||||||
export const BlueprintImage: React.FC<BlueprintImageProps> = ({
|
export const BlueprintImage: React.FC<BlueprintImageProps> = ({
|
||||||
string,
|
string,
|
||||||
blueprint_hash,
|
blueprint_hash,
|
||||||
|
image_hash,
|
||||||
label,
|
label,
|
||||||
onSetRenderer,
|
onSetRenderer,
|
||||||
}) => {
|
}) => {
|
||||||
@ -37,11 +39,12 @@ export const BlueprintImage: React.FC<BlueprintImageProps> = ({
|
|||||||
|
|
||||||
return renderer === "fbe" ? (
|
return renderer === "fbe" ? (
|
||||||
<ImageEditor string={string} onError={() => setRenderer("fbsr")}></ImageEditor>
|
<ImageEditor string={string} onError={() => setRenderer("fbsr")}></ImageEditor>
|
||||||
) : (
|
) : image_hash ? (
|
||||||
<FullscreenImage
|
<FullscreenImage
|
||||||
// src={`https://fbsr.factorio.workers.dev/${blueprint_hash}?size=1000`}
|
// src={`https://fbsr.factorio.workers.dev/${blueprint_hash}?size=1000`}
|
||||||
src={`https://render.factorio.tools/render?url=https://factorioblueprints.tech/api/string/${blueprint_hash}`}
|
// src={`https://render.factorio.tools/render?url=https://factorioblueprints.tech/api/string/${blueprint_hash}`}
|
||||||
|
src={`https://storage.factorio.tools/factorio-blueprint-images/render/${image_hash}.webp`}
|
||||||
alt={label}
|
alt={label}
|
||||||
/>
|
/>
|
||||||
);
|
) : null;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user