sandstormports / wordpress-sandstorm

WordPress Sandstorm package
Apache License 2.0
4 stars 3 forks source link

Add powerbox-http-proxy for external requests #45

Closed ocdtrekkie closed 1 year ago

ocdtrekkie commented 1 year ago

I am currently most of the way there.

The only part I believe is still unimplemented is embedding powerbox.js into WordPress in order to launch the Powerbox requests. Though the debug log is also quite noisy, and I am unsure if there are more bugs I need to tackle.

The biggest pressing issue I saw, which maybe colors how I want to address embedding the powerbox.js: As soon as I tried to open WordPress, it tried to connect to api.wordpress.org, according to the debug log. So with the ability to do so, it makes an immediate call home, which is both a bad experience and something we want to avoid. We may want to either patch out the call home or limit where we embed powerbox.js.

I'm also unsure if I should make that modification in this repo or https://github.com/sandstormports/wordpress

ocdtrekkie commented 1 year ago

Okay, I think I want to use this solution in wp-admin/admin-header.php: https://stackoverflow.com/a/59658813/369990

I don't want to ever trigger this outside the admin panel, lest someone do something which fires off external requests on the actual site pages, and then gets confused when the published version doesn't work.

ocdtrekkie commented 1 year ago

Assuming the call home to api.wordpress.org is the update check, which it probably is, I can add these to wp-config (here in this repo) to silence that behavior:

define( 'AUTOMATIC_UPDATER_DISABLED', true );
define( 'WP_AUTO_UPDATE_CORE', false );

Obviously Sandstorm users can't update WordPress inside the grain anyways, so this is mostly useless.

ocdtrekkie commented 1 year ago

This works after this patch: https://github.com/sandstormports/wordpress/commit/b77bd90de9e45b6c3a010cbd8e8d82fa83593c6b

Going to merge, re-key, and keep working.