-
Notifications
You must be signed in to change notification settings - Fork 78
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
Improve Extensibility: Better custom support for conneg and authorized fetch #1148
base: trunk
Are you sure you want to change the base?
Conversation
…d fetch This came up in a discussion with @Menrath to better support custom endpoints/uris with content negotiation and authorized fetch.
I would love to hear your feedback on that @Menrath ! |
Thanks for drafting this! For completeness and documentation, so that other interested persons can follow this discussion better I will write some more introduction lines, and review/propose improvements in a second step. This review took me quite some hours. And it's not complete yet :/ Use cases:
Goals:
My concrete examples:
The filter Because I cannot get passed https://github.com/Automattic/wordpress-activitypub/blob/change/improve-conneg-extensibility/includes/functions.php#L390 as I have no guarantee that the post type Some general ideas:
|
@Menrath I think you are right, especially because we already check for the allowed object types ( Thank you for taking the time to thoroughly review the code!!!! |
what about a |
@@ -50,11 +50,10 @@ public static function init() { | |||
} | |||
|
|||
\add_filter( 'activitypub_get_actor_extra_fields', array( Extra_Fields::class, 'default_actor_extra_fields' ), 10, 2 ); | |||
\add_filter( 'pre_render_activitypub_template', array( self::class, 'add_headers' ) ); |
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.
Isn't this actually the other way round?
Shouldn't it be, note the non, of course this action does not exist yet.
\add_filter( 'pre_render_non_activitypub_template', array( self::class, 'add_headers' ) );
Actually I like the idea about getting the Transformer once and storing it "globally". This would make it possible to refactor and simplify a lot of functions and checks. However, I wonder if the Transformer is the right place to pack the functions to determine if and which ActivityPub actor owns an object.
Also, I am unsure about adding stuff to WordPress globals. I have another idea in mind that might work: Create a new singleton class like ActivityPub_Request, ActivityPub_Negotiation or put it in the ActivityPub class. This would allow storing certain results for later use. On construct (GET, non-REST requests) this would do some checks like:
I haven't thought this through in detail, but maybe it will help. |
@Menrath I like the idea a lot and prepared something. That would simplify so much and would allow you to simply use the transformer! |
This came up in a discussion with @Menrath to better support custom endpoints/uris with content negotiation and authorized fetch.
Proposed changes:
Other information:
Testing instructions: