Skip to content

Commit

Permalink
Use storage url directly for render, instead of api
Browse files Browse the repository at this point in the history
  • Loading branch information
barthuijgen committed Nov 19, 2024
1 parent 4f7298a commit aafe13f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/blueprints/src/components/blueprint/Blueprint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/>
)}
Expand Down
1 change: 1 addition & 0 deletions apps/blueprints/src/components/blueprint/BlueprintBook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/>
)}
Expand Down
9 changes: 6 additions & 3 deletions apps/blueprints/src/components/blueprint/BlueprintImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ export type RENDERERS = "fbe" | "fbsr";
interface BlueprintImageProps {
string: string;
blueprint_hash: string;
image_hash?: string;
label: string;
onSetRenderer?: (renderer: RENDERERS) => void;
}

export const BlueprintImage: React.FC<BlueprintImageProps> = ({
string,
blueprint_hash,
image_hash,
label,
onSetRenderer,
}) => {
Expand All @@ -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;
};

0 comments on commit aafe13f

Please sign in to comment.