1
0
mirror of https://github.com/barthuijgen/factorio-sites.git synced 2024-11-21 18:16:33 +02:00

Use storage url directly for render, instead of api

This commit is contained in:
Bart Huijgen 2024-11-19 22:29:58 +01:00 committed by Bart
parent 0f325bb2fd
commit d409d5e7df
3 changed files with 8 additions and 3 deletions

View File

@ -153,6 +153,7 @@ export const BlueprintSubPage: React.FC<BlueprintProps> = ({
string={string}
label={blueprint.label || ""}
blueprint_hash={blueprint.blueprint_hash}
image_hash={blueprint.image_hash}
onSetRenderer={setRenderer}
/>
)}

View File

@ -226,6 +226,7 @@ export const BlueprintBookSubPage: React.FC<BlueprintBookSubPageProps> = ({
string={selectedBlueprintString}
label={selected.data.label || ""}
blueprint_hash={selected.data.blueprint_hash}
image_hash={selected.type === "blueprint" ? selected.data.image_hash : undefined}
onSetRenderer={setRenderer}
/>
)}

View File

@ -9,6 +9,7 @@ export type RENDERERS = "fbe" | "fbsr";
interface BlueprintImageProps {
string: string;
blueprint_hash: string;
image_hash?: string;
label: string;
onSetRenderer?: (renderer: RENDERERS) => void;
}
@ -16,6 +17,7 @@ interface BlueprintImageProps {
export const BlueprintImage: React.FC<BlueprintImageProps> = ({
string,
blueprint_hash,
image_hash,
label,
onSetRenderer,
}) => {
@ -37,11 +39,12 @@ export const BlueprintImage: React.FC<BlueprintImageProps> = ({
return renderer === "fbe" ? (
<ImageEditor string={string} onError={() => setRenderer("fbsr")}></ImageEditor>
) : (
) : image_hash ? (
<FullscreenImage
// 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}
/>
);
) : null;
};