Skip to content
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

Do not assume admin URLs but rely on correct core logic instead #451

Open
felixarntz opened this issue Mar 22, 2021 · 4 comments
Open

Do not assume admin URLs but rely on correct core logic instead #451

felixarntz opened this issue Mar 22, 2021 · 4 comments
Labels
bug Something isn't working service-workers

Comments

@felixarntz
Copy link
Collaborator

felixarntz commented Mar 22, 2021

I'm getting various JS errors from the WP Admin service worker because my website uses a wp-content directory which is separate from the WordPress core directory (which also means home_url() is different from site_url().

The PWA plugin assumes certain directory structures in https://github.com/GoogleChromeLabs/pwa-wp/blob/develop/integrations/class-wp-service-worker-admin-assets-integration.php#L22, which are not a given; for example, my WP Admin is not at wp-admin but at wp/wp-admin, and similarly my wp-includes is at wp/wp-includes.

Example error:

PrecacheController.js:228 Uncaught (in promise) bad-precaching-response: bad-precaching-response :: [{"url":"https://mysite.com/wp-admin/images/privacy.png","status":404}]

(the URL should be https://mysite.com/wp/wp-admin/images/privacy.png

Since WordPress allows setting these URLs differently, I think that needs to be accounted for here too.

@felixarntz felixarntz added the bug Something isn't working label Mar 22, 2021
@felixarntz
Copy link
Collaborator Author

A potential solution would be to call admin_url() and includes_url(), taking the paths from there.

I'm also thinking due to the nature of the bug that it could be happening in multisites using subdirectories too (although that's just an assumption, I haven't confirmed).

@westonruter
Copy link
Collaborator

I suppose it would be good to fix, but per #403 this integration and the other integrations would be deprecated and removed.

@felixarntz
Copy link
Collaborator Author

@westonruter Ah makes sense, thanks. Is this planned for 0.7? And just to clarify, deprecation or removal? Would they be unhooked from the filter but remain in place initially?

@westonruter
Copy link
Collaborator

Deprecation on 0.7 and removal in 0.8 I suppose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working service-workers
Projects
None yet
Development

No branches or pull requests

2 participants