Support » Plugin: Super Progressive Web Apps » [feature] Add filter to allow custom manifest location

  • Resolved cristianuibar

    (@cristianuibar)


    Hello,

    We need a filter so we can change the ABS path the plugin uses to generate the manifest.

    Our hosting environment does not allow modifications in the root of the website for security reasons. Yet an alternative root directory is available which is symlinked to the actual root of the site. So any file in this dir is visible under the root URL but the file path in the file system is different. This dir is located in wp-content/root/ so we need to change the location where this manifest file is being generated and read from. A filter which we can use would be sufficient.

    Can you guys assist us with this?

    Best regards,
    ~Cristian

    • This topic was modified 5 years, 7 months ago by cristianuibar.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter cristianuibar

    (@cristianuibar)

    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.

    Thread Starter cristianuibar

    (@cristianuibar)

    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.

    Thread Starter cristianuibar

    (@cristianuibar)

    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[feature] Add filter to allow custom manifest location’ is closed to new replies.