-
Notifications
You must be signed in to change notification settings - Fork 357
Fetch the WordPress.org API to determine Theme/Plugin names. #2580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
| this.progress?.loadingListener ?? noop | ||
| ); | ||
| if (response.status !== 200) { | ||
| throw new Error(`Could not fetch "${url}"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only note – I wouldn't break the entire Blueprint execution just because we can't fetch the name. Otherwise this PR seems like a great addition – thank you @dd32!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, this isn't just a name now. The api.wordpress.org call also provides the download_link. Will it ever be different from https://downloads.wordpress.org/theme|plugin/${zipName}?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this after the fact.. Specifically because of closed plugins..
I was thinking of updating it to the previous as the fallback as well as the latest-stable for the ZIP.
The ZIP is unlikely to change location, but I figured since I had the data here, I might as well use it to avoid the 301 from latest-stable to the versioned link.
If dependencies are requested as in #2582 then the API failing to retrieve would be more of a show-stopper, but even then, just failing to install the dependencies is probably a better thing than playground halting.
… to previous behaviour.
…s presented as a HTML entity.
… allows installation of a specific version of a package.
|
@JanJakes would you be able to shepherd this PR? I think it might be good to go but I'd still love to get your opinion. |
|
👍 I'll check it out. |
Motivation for the change, related issues
See #1487
Screen.Recording.2025-09-02.at.1.27.48.pm.mov
Screen.Recording.2025-09-02.at.1.27.27.pm.mov
Implementation details
A
APIBasedFetchResourceclass is inserted between theCore{Plugin,Theme}ResourceandFetchResourceto allow the API to be fetched as an intermediate step.The
nameproperty is added to theCore{Plugin,Theme}Referenceto prevent the name being sourced from the ZIP.The
nameproperty is passed through to other steps where possible.This is not perfect, but it works and provides a basis for some other incremental improvements.
Testing Instructions (or ideally a Blueprint)
https://playground.wordpress.net/?plugin=woocommerce
http://127.0.0.1:5400/website-server/?plugin=woocommerce