-
Notifications
You must be signed in to change notification settings - Fork 37
Add installer for FAIR protocol #71
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
Conversation
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>
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>
While it says installing latest version - it's not. But we can fix. |
I actually did already fix that in 170d228 - the video is outdated :) |
If no version specified should we default to most current version and not just wp_die()? |
There's actually no way to get to the page without specifying a version, since the URL generation function requires a |
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Signed-off-by: Ryan McCue <me@ryanmccue.info>
Updated for a few issues I found. |
Need to deactivate Install button if plugin installed. |
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. |
Last commit changes install slug to |
b3903d0
to
9d8cf17
Compare
Signed-off-by: Ryan McCue <me@ryanmccue.info>
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>
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.
Pre-approving, pending responses to the open questions/discussions.
inc/packages/did/class-did.php
Outdated
* | ||
* One of plc, web. | ||
*/ | ||
public function get_type() : string; |
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.
@rmccue Are we changing this to get_method()
and the corresponding constant in PLC/Web to METHOD
for consistency with the spec? Or?
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.
Changing to method
consistently makes sense to me; I picked type
without really thinking about it, but sticking to the standard term is better.
Signed-off-by: costdev <79332690+costdev@users.noreply.github.com>
Signed-off-by: costdev <79332690+costdev@users.noreply.github.com>
…\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>
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>
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.
A couple UX issues, and an unhandled error path with invalid DIDs.
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>
inc/packages/admin/info.php
Outdated
use FAIR\Packages\MetadataDocument; | ||
use FAIR\Packages\ReleaseDocument; | ||
|
||
use function FAIR\Updater\get_packages; |
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.
This should be use
on the namespace rather than the function.
inc/updater/namespace.php
Outdated
function maybe_add_accept_header( $args, $url ) : array { | ||
$releases = wp_cache_get( RELEASE_PACKAGES_CACHE_KEY ) ?: []; | ||
|
||
if ( ! str_contains( $url, 'api.github.com' ) ) { |
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 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.
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.
Fails in testing.
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.
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.
inc/packages/admin/namespace.php
Outdated
Updater\add_package_to_release_cache( $did ); | ||
add_filter( 'http_request_args', 'FAIR\\Updater\\maybe_add_accept_header', 20, 2 ); |
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.
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>
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