Skip to content

Conversation

rmccue
Copy link
Member

@rmccue rmccue commented Jun 11, 2025

Work in progress.

Adds a new "Direct Install" screen to the plugins screen, which allows installing plugins directly by DID if you already know it. You can test it out with @afragen's test DID, did:plc:afjf7gsjzsqmgc7dlhb553mv.

It looks like this:

Screenshot.2025-06-11.at.21.53.02.mp4

rmccue added 6 commits June 10, 2025 20:39
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
@rmccue rmccue marked this pull request as draft June 11, 2025 01:25
rmccue added 7 commits June 11, 2025 21:04
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
@afragen
Copy link
Contributor

afragen commented Jun 11, 2025

While it says installing latest version - it's not. ☹️

But we can fix.

@rmccue
Copy link
Member Author

rmccue commented Jun 11, 2025

I actually did already fix that in 170d228 - the video is outdated :)

@afragen
Copy link
Contributor

afragen commented Jun 11, 2025

If no version specified should we default to most current version and not just wp_die()?

@rmccue
Copy link
Member Author

rmccue commented Jun 12, 2025

There's actually no way to get to the page without specifying a version, since the URL generation function requires a ReleaseDocument.

rmccue added 2 commits June 12, 2025 21:57
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
@afragen
Copy link
Contributor

afragen commented Jun 17, 2025

Updated for a few issues I found.

@afragen
Copy link
Contributor

afragen commented Jun 17, 2025

Need to deactivate Install button if plugin installed.

@afragen
Copy link
Contributor

afragen commented Jun 17, 2025

I think we will need a consensus on how to manage slugs for installation and updating. The changes I made use the dot org standard of the slug, but we need to think longer term about possible duplicates.

@afragen
Copy link
Contributor

afragen commented Jun 17, 2025

Last commit changes install slug to slug-did without the did:plc|web parts.

@rmccue rmccue force-pushed the add-fair-installer branch from b3903d0 to 9d8cf17 Compare June 18, 2025 17:31
Signed-off-by: Ryan McCue <me@ryanmccue.info>
@afragen
Copy link
Contributor

afragen commented Jun 18, 2025

A couple of PRs for here, #114 and #115

Signed-off-by: costdev <79332690+costdev@users.noreply.github.com>
Signed-off-by: Andy Fragen <andy@thefragens.com>
Signed-off-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Co-authored-by: Andy Fragen <andy@thefragens.com>
@afragen afragen self-requested a review July 22, 2025 16:43
Copy link
Member

@costdev costdev left a comment

Choose a reason for hiding this comment

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

*
* One of plc, web.
*/
public function get_type() : string;
Copy link
Member

Choose a reason for hiding this comment

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

@rmccue Are we changing this to get_method() and the corresponding constant in PLC/Web to METHOD for consistency with the spec? Or?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changing to method consistently makes sense to me; I picked type without really thinking about it, but sticking to the standard term is better.

costdev added 2 commits July 23, 2025 15:50
Signed-off-by: costdev <79332690+costdev@users.noreply.github.com>
Signed-off-by: costdev <79332690+costdev@users.noreply.github.com>
afragen and others added 2 commits July 24, 2025 20:24
…\Packages (#184)

Signed-off-by: Andy Fragen <andy@thefragens.com>
Signed-off-by: costdev <79332690+costdev@users.noreply.github.com>
Signed-off-by: Andy Fragen <andy@thefragens.com>
Co-authored-by: Andy Fragen <andy@thefragens.com>
@afragen afragen requested review from rmccuewp and removed request for rmccuewp July 26, 2025 01:39
@costdev
Copy link
Member

costdev commented Jul 26, 2025

Updated video showing AJAX installing and using two plugins, one that uses a GitHub release asset and one that doesn't, showing the install process looks exactly the same.

updated-direct-install.mp4

Signed-off-by: costdev <79332690+costdev@users.noreply.github.com>
Copy link
Member

@joedolson joedolson left a comment

Choose a reason for hiding this comment

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

A couple UX issues, and an unhandled error path with invalid DIDs.

afragen and others added 4 commits July 26, 2025 12:09
Signed-off-by: Andy Fragen <andy@thefragens.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Signed-off-by: Andy Fragen <andy@thefragens.com>
Signed-off-by: Joe Dolson <design@joedolson.com>
Signed-off-by: Joe Dolson <design@joedolson.com>
Signed-off-by: Joe Dolson <design@joedolson.com>
use FAIR\Packages\MetadataDocument;
use FAIR\Packages\ReleaseDocument;

use function FAIR\Updater\get_packages;
Copy link
Member Author

Choose a reason for hiding this comment

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

This should be use on the namespace rather than the function.

function maybe_add_accept_header( $args, $url ) : array {
$releases = wp_cache_get( RELEASE_PACKAGES_CACHE_KEY ) ?: [];

if ( ! str_contains( $url, 'api.github.com' ) ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I really don't want to add this exception for a specific source if we can at all avoid it, and I'm pretty certain we can with a properly constructed standard Accept header.

Accept indicates data types in preferential order (as indicated by q=), so we should be able to use a "universal" Accept header, similar to browsers. Browsers send text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 eg

For example, Accept: application/zip;q=1.0, application/octet-stream;q=0.7, */*;q=0.1 would indicate we accept zips, then binary streams, then anything (in that order).

I'll test this out.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fails in testing.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is caused on the other side of things, where api.github.com is incorrectly wanting Accept: application/json despite giving a zip response. I've contacted GitHub Support.

It looks like GitHub are also not parsing the q parameter correctly, so */*;q=0.1 or */*;q=0 incorrectly receive priority over application/octet-stream. This is noncompliant with the HTTP spec afaik.

Comment on lines 73 to 74
Updater\add_package_to_release_cache( $did );
add_filter( 'http_request_args', 'FAIR\\Updater\\maybe_add_accept_header', 20, 2 );
Copy link
Member Author

Choose a reason for hiding this comment

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

Given these functions aren't specific to the updater, and we're reusing them here, we should move them upwards into the Packages namespace imo.

Signed-off-by: Andy Fragen <andy@thefragens.com>
Signed-off-by: Andy Fragen <andy@thefragens.com>
@afragen afragen merged commit 9ce4b13 into main Jul 27, 2025
46 checks passed
@afragen afragen deleted the add-fair-installer branch July 27, 2025 16:37
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