For us, a filter for the ‘abs’ $arg would be sufficient, yet I belive you should also add a filter for the ‘src’ $arg as well.
Hello again,
I believe I’ve managed to fix this, yet I would like your approval to make sure that this is the right way to do it. Also if you can implement these filters in the production plugin so that we won’t lose these after an update would be awesome.
Here is the PR in case you want to merge it in production. We would hate to see the fix break on an update 🙁
In the functions.php file inside the theme we have added this for it to work:
add_filter('superpwa_manifest_abs', 'fix_abs_paths_for_superpwa');
add_filter('superpwa_sw_abs', 'fix_abs_paths_for_superpwa');
function fix_abs_paths_for_superpwa()
{
return trailingslashit(get_home_path() . 'wp-content/root');
}
After the fix, I can see Service worker generated successfully.
inside the Settings page of the plugin.
Best regards,
~Cristian
Hello Cristian,
Thank you for your interest in SuperPWA.
Few other users also had this issue, so we are currently exploring a solution that would fit for everyone out of the box. Filters would work, but that would need custom configuration.
This is the next major step, so I will keep your PR on hold for now. PR 47 is also a very similar one that is also on hold. We might have to release minor updates to fix bugs if any, so before you upgrade next time, please have a look at the changelog.
Out of curiosity, where are you hosted? (Totally cool if you do not want to discuss that in public).
I have made a note of this thread in our internal tracker and I will update you on the progress of this.
Best regards.
Hello Arun,
Thank you for your help.
Indeed there are not many users which need support for custom paths, and for these that need I believe a simple filter should be sufficient. Adding a form and extra settings in DB might be overkill. Not sure though. If there are sufficient users requesting this it might be worth it.
The hosting company is Presslabs https://www.presslabs.com/
Best regards,
~Cristian