Skip to content

[UEPR-546] Make library asset host configurable - #679

Open
adzhindzhi wants to merge 1 commit into
scratchfoundation:developfrom
adzhindzhi:feature/uepr-546-configurable-library-asset-host
Open

[UEPR-546] Make library asset host configurable#679
adzhindzhi wants to merge 1 commit into
scratchfoundation:developfrom
adzhindzhi:feature/uepr-546-configurable-library-asset-host

Conversation

@adzhindzhi

@adzhindzhi adzhindzhi commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Resolves

UEPR-546

Proposed Changes

  • Add getLibraryAssetUrl method in the GUIStorage configuration
  • Make the legacy storage default to the currently used URL to avoid any regressions

Reason for Changes

Library thumbnail URLs were hardcoded to https://cdn.assets.scratch.mit.edu, making the asset host non-configurable for other platforms.

@adzhindzhi
adzhindzhi requested a review from a team as a code owner August 18, 2026 15:15
@adzhindzhi
adzhindzhi requested a lite review from Copilot August 18, 2026 15:16
@redspacecat

Copy link
Copy Markdown

I presume "other platforms" includes the NGP? 👀

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes Scratch GUI’s library thumbnail asset URLs configurable by delegating URL construction to the active GUIStorage implementation, while preserving the current cdn.assets.scratch.mit.edu behavior as the default to avoid regressions.

Changes:

  • Adds optional getLibraryAssetUrl(assetId, dataFormat) to the GUIStorage contract (+ PropTypes) to allow custom storage implementations to control library asset addressing.
  • Introduces buildLibraryAssetUrl as the default/fallback URL builder that targets the legacy Scratch asset host.
  • Plumbs storage from Redux config into library containers and LibraryComponent, replacing hardcoded thumbnail URLs with storage-driven URL construction.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/scratch-gui/src/lib/legacy-storage.ts Implements getLibraryAssetUrl on legacy storage to preserve the current legacy asset-service URL behavior by default.
packages/scratch-gui/src/lib/legacy-library-asset-url.ts Adds a shared helper to build legacy (or provided-host) library asset URLs in the Scratch asset-service shape.
packages/scratch-gui/src/gui-config.ts Extends GUIStorage and GUIStoragePropType with optional getLibraryAssetUrl.
packages/scratch-gui/src/containers/sprite-library.jsx Passes configured storage through to LibraryComponent so sprite thumbnails can use configurable URLs.
packages/scratch-gui/src/containers/costume-library.jsx Passes configured storage through to LibraryComponent so costume thumbnails can use configurable URLs.
packages/scratch-gui/src/containers/backdrop-library.jsx Passes configured storage through to LibraryComponent so backdrop thumbnails can use configurable URLs.
packages/scratch-gui/src/components/library/library.jsx Replaces hardcoded CDN thumbnail URLs with a storage-aware getLibraryAssetUrl fallbacking to the legacy host.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +12 to +17
export const buildLibraryAssetUrl = (assetId: string, dataFormat: string, host?: string): string => {
if (!host) {
return `${LEGACY_LIBRARY_ASSET_HOST}/internalapi/asset/${assetId}.${dataFormat}/get/`;
}
return `${host}/internalapi/asset/${assetId}.${dataFormat}/get/`;
};

@KManolov3 KManolov3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants