Add manifest.json support for multisite
-
Add support for manifest.json multisite. So it would create manifest.json per site and load it accordingly to site id. As well can you pin point on where I can override that, so currently I could add custom function which would do that. ??
-
Hey @juslintek
Manifest is not created dynamically but are saved on the root folder. All the functions related to manifest are in
/public/manifest.php
– https://github.com/SuperPWA/Super-Progressive-Web-Apps/blob/master/public/manifest.phpThis is something we have planned for the future. One way to do this would be to generate a manifest per site. If you have other ideas, I would love to hear them ??
Adding this as a feature request.
Hi, I’ve create mu-plugin for this purpose, you can use it to update, just let me know when changes are in the plugin so I would disable mine.
Hey @juslintek
This is some awesome work right there. Thanks for sharing the same with us! This is a true compliment.
How is
superpwa_add_manifest_to_header_mu()
added towp_head
for each site? I am wondering if I missed something.Best regards.
Ah sorry forgot that one. Just updated to working ?? I can actually modify your code in a branch and then create a pull request ??
- This reply was modified 6 years, 9 months ago by juslintek. Reason: Changed message totally because saw my mistake myself
@juslintek – Since you already have a fully working prototype, I will test it out before you go through all that trouble. Thanks for your answer.
@designium – I believe all you have to do is to network activate the plugin from here: https://github.com/juslintek/super-pwa-multisite . Soon I will let you know as to when to expect it in the main plugin.
@designium I am at a loss here, since I havne’t tested that out.
Potential problems I can think of would be if SuperPWA detects the unmapped url and adds it to the manifest and service worker instead of the mapped url.
Since you already have the setup going, can you please give it a test and let me know?
Hi, it works properly, add it to mu-plugins dir as it is as described must use plugin. It will remove actions with original functions and add actions with modified functions, which check if site is not main and then suffixes its id to name of manifest.json like this manifest_5.json, superpwa-sw_5.js. As well it currently deletes only main file on deactivation of main plugin and creates same file on activation. Basically it creates site specific files when you save changes on that specific site.
P.S. As I said I’ve added header function to action.
This is what I’ve done here is sufficient for multisite
https://github.com/juslintek/super-pwa-multisite/blob/master/superpwa-multisite.phpBecause these definitions are used everywhere so they define file name per site. Only if you want to remove manifest and sw.js files on deactivation of plugin you would need to iterate per each site id and and suffix original file name with it
_siteid
.(json|js).In mu-plugin I needed all that code only to replace those definitions value. But if I would’ve hardcoded I would’ve just needed to edit one file.
- This reply was modified 6 years, 9 months ago by juslintek.
@juslintek thanks for the continued feedback. I noticed that you have added manifest to
wp_head
.I just haven’t had a chance to sit on it. I have added it to the road-map for the next release, so it should be included in version 1.5 if time allows.
Hi @juslintek, @arunbasillal.
- It works for the root site. (With SSL)
- It works for a mapped domain (I dont have a SSL on that domain I dont get the pop-up but when I save the page to the Homepage the app is
installedlinked in the home page) - The subfolder site doesnt work (With SSL), I get the 3 green checks and the individual manifest file but the pop-up doesn’t show, and if I try to save the page to the homepage it save it as a chromeapp link not an PWA app.
I have disabled the cache, plugins, I guess there is a conflict somewhere…
- This reply was modified 6 years, 9 months ago by designium. Reason: The icon and the loading page and the app UI is saved in the homepage but it is not installed as an independent PWA app
Hello @juslintek, @arunbasillal.
I realized I had a PWA app of the root domain prior to adding Justintek’s file to the mu-plugins folder.
I uninstalled that app and now I get this error in the root website backend : Service worker generation failed. Check if WordPress can write to your root folder (the same folder with wp-config.php)
Hello,
I tried to uninstall the extension and start over, but now I get this error :
– Manifest
Manifest generation failed. Check if WordPress can write to your root folder (the same folder with wp-config.php).– Service Worker
Service worker generation failed. Check if WordPress can write to your root folder (the same folder with wp-config.php).??
Justintek’s file is in mu-plugins folder…
Hey guys,
I just released version 1.5, but haven’t had the chance to integrate multisite integration into it. Just wanted to give you all a heads up so as to manage expectations.
Have added it to the pipeline for 1.6. Will keep you guys updated ??
@designium, seems like permissions problem for me. Connect to your wordpress root via ssh and do this command
ls -lha .
. Then rungroups
andwhoami
. Finally run thisapachectl -S | egrep "User|Group"
, to check which user apache is using. If you’re using nginx and php-fpm setup.ps -eo pid,comm,euser,supgrp | egrep "nginx|php-fpm"
. Should give you list of processes running nginx and php-fpm on specific users and groups. So you can check if those match yours. If don’t then you need to change file users and groups or permissions.- This reply was modified 6 years, 8 months ago by juslintek.
@designium, as well try changing PWA settings like orientation and so on and see if that helps.
- The topic ‘Add manifest.json support for multisite’ is closed to new replies.