Super Progressive Web Apps - Version 1.3.1

Version Description

  • Date: 15.February.2018
  • Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
  • Enhancement: Improved how start_url is handled in the manifest.
  • Enhancement: Better handling of external resources.
Download this release

Release Info

Developer arunbasillal
Plugin Icon 128x128 Super Progressive Web Apps
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3 to 1.3.1

Files changed (4) hide show
  1. admin/do.php +7 -1
  2. public/sw.php +4 -0
  3. readme.txt +27 -16
  4. superpwa.php +2 -2
admin/do.php CHANGED
@@ -66,7 +66,9 @@ function superpwa_is_amp() {
66
  *
67
  * @param $rel False by default. Set to true to return a relative URL (for use in manifest)
68
  * @return String URL to be set as the start_url in manifest and startPage in service worker
 
69
  * @since 1.2
 
70
  */
71
  function superpwa_get_start_url( $rel = false ) {
72
 
@@ -76,9 +78,13 @@ function superpwa_get_start_url( $rel = false ) {
76
  // Start Page
77
  $start_url = get_permalink( $settings['start_url'] ) ? trailingslashit( get_permalink( $settings['start_url'] ) ) : trailingslashit( get_bloginfo( 'wpurl' ) );
78
 
 
 
 
79
  if ( $rel === true ) {
80
 
81
- $start_url = str_replace( untrailingslashit( get_bloginfo( 'wpurl' ) ), '', $start_url );
 
82
  }
83
 
84
  // AMP URL
66
  *
67
  * @param $rel False by default. Set to true to return a relative URL (for use in manifest)
68
  * @return String URL to be set as the start_url in manifest and startPage in service worker
69
+ *
70
  * @since 1.2
71
+ * @since 1.3.1 Force HTTPS by replacing http:// with https://
72
  */
73
  function superpwa_get_start_url( $rel = false ) {
74
 
78
  // Start Page
79
  $start_url = get_permalink( $settings['start_url'] ) ? trailingslashit( get_permalink( $settings['start_url'] ) ) : trailingslashit( get_bloginfo( 'wpurl' ) );
80
 
81
+ // Force HTTPS
82
+ $start_url = str_replace( 'http://', 'https://', $start_url );
83
+
84
  if ( $rel === true ) {
85
 
86
+ // Make start_url relative for manifest
87
+ $start_url = parse_url( $start_url, PHP_URL_PATH );
88
  }
89
 
90
  // AMP URL
public/sw.php CHANGED
@@ -102,6 +102,10 @@ self.addEventListener('fetch', function(e) {
102
  if ( ! e.request.url.match(/^(http|https):\/\//i) )
103
  return;
104
 
 
 
 
 
105
  // For POST requests, do not use the cache. Serve offline page if offline.
106
  if ( e.request.method !== 'GET' ) {
107
  e.respondWith(
102
  if ( ! e.request.url.match(/^(http|https):\/\//i) )
103
  return;
104
 
105
+ // Return if request url is from an external domain.
106
+ if ( ( new URL(e.request.url).origin !== location.origin ) && ( e.request.mode === 'no-cors' ) )
107
+ return;
108
+
109
  // For POST requests, do not use the cache. Serve offline page if offline.
110
  if ( e.request.method !== 'GET' ) {
111
  e.respondWith(
readme.txt CHANGED
@@ -119,19 +119,29 @@ To install this plugin:
119
 
120
  If you have any questions, please ask it on the [support forum](https://wordpress.org/support/plugin/super-progressive-web-apps).
121
 
 
 
 
 
122
  == Screenshots ==
123
 
124
  1. Settings page in WordPress Admin > Settings > SuperPWA
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
 
128
  = 1.3 =
129
- * Date: 10. February.2018
130
  * New Feature: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
131
  * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
132
  * Enhancement: Improved in-browser service worker update handling.
133
  * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
134
- * Bug fix: Only GET requests are served from the cache now. Fixes [this](https://wordpress.org/support/topic/errors-in-firefox-and-chrome/).
135
 
136
  = 1.2 =
137
  * Date: 06.February.2018
@@ -142,17 +152,17 @@ If you have any questions, please ask it on the [support forum](https://wordpres
142
  * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
143
  * UI Improvement: Added admin notice with a link to settings page on plugin activation.
144
  * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
145
- * Bug fix: Fix a parse error that showed up only on PHP 5.3.
146
 
147
  = 1.1.1 =
148
  * Date: 30.January.2018
149
- * Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context". PHP manual says "Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error."
150
 
151
  = 1.1 =
152
  * Date: 28.January.2018
153
- * Aggressive caching of pages using CacheStorage API.
154
- * Pages once cached are served even if the user is offline.
155
- * Set custom offline page: Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
156
 
157
  = 1.0 =
158
  * Date: 22.January.2018
@@ -160,15 +170,18 @@ If you have any questions, please ask it on the [support forum](https://wordpres
160
 
161
  == Upgrade Notice ==
162
 
 
 
 
 
 
163
  = 1.3 =
164
- * Date: 10. February.2018
165
  * New Feature: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
166
  * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
167
  * Enhancement: Improved in-browser service worker update handling.
168
  * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
169
 
170
  = 1.2 =
171
- * Date: 06.February.2018
172
  * New Feature: Support for theme-color.
173
  * New Feature: Now you can edit the Application Name and Application Short name.
174
  * New Feature: Set the start page of your PWA.
@@ -176,17 +189,15 @@ If you have any questions, please ask it on the [support forum](https://wordpres
176
  * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
177
  * UI Improvement: Added admin notice with a link to settings page on plugin activation.
178
  * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
179
- * Bug fix: Fix a parse error that showed up only on PHP 5.3.
180
 
181
  = 1.1.1 =
182
- * Date: 30.January.2018
183
- * Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context". PHP manual says "Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error."
184
 
185
  = 1.1 =
186
- * Date: 28.January.2018
187
- * Aggressive caching of pages using CacheStorage API.
188
- * Pages once cached are served even if the user is offline.
189
- * Set custom offline page: Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
190
 
191
  = 1.0 =
192
  * First release of the plugin.
119
 
120
  If you have any questions, please ask it on the [support forum](https://wordpress.org/support/plugin/super-progressive-web-apps).
121
 
122
+ = Will Progressive Web Apps work on iOS devices? =
123
+
124
+ PWA's require browsers with support for service workers and for iOS devices, support is available in Safari Technology Preview 48, macOS High Sierra 10.13.4 and iOS 11.3 beta seed 2. Since none of these are production releases, the general public will not be able to install your app on their mobile phones and smart devices. We will hopefully see full support by mid 2018.
125
+
126
  == Screenshots ==
127
 
128
  1. Settings page in WordPress Admin > Settings > SuperPWA
129
 
130
  == Changelog ==
131
 
132
+ = 1.3.1 =
133
+ * Date: 15.February.2018
134
+ * Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
135
+ * Enhancement: Improved how start_url is handled in the manifest.
136
+ * Enhancement: Better handling of external resources.
137
+
138
  = 1.3 =
139
+ * Date: 10.February.2018
140
  * New Feature: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
141
  * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
142
  * Enhancement: Improved in-browser service worker update handling.
143
  * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
144
+ * Bug Fix: Only GET requests are served from the cache now. Fixes [this](https://wordpress.org/support/topic/errors-in-firefox-and-chrome/).
145
 
146
  = 1.2 =
147
  * Date: 06.February.2018
152
  * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
153
  * UI Improvement: Added admin notice with a link to settings page on plugin activation.
154
  * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
155
+ * Bug Fix: Fix a parse error that showed up only on PHP 5.3.
156
 
157
  = 1.1.1 =
158
  * Date: 30.January.2018
159
+ * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context". PHP manual says "Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error."
160
 
161
  = 1.1 =
162
  * Date: 28.January.2018
163
+ * New Feature: Aggressive caching of pages using CacheStorage API.
164
+ * New Feature: Pages once cached are served even if the user is offline.
165
+ * New Feature: Set custom offline page. Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
166
 
167
  = 1.0 =
168
  * Date: 22.January.2018
170
 
171
  == Upgrade Notice ==
172
 
173
+ = 1.3.1 =
174
+ * Enhancement: Improved how Start Page url is handled in the service worker to be compatible with plugins that force SSL.
175
+ * Enhancement: Improved how start_url is handled in the manifest.
176
+ * Enhancement: Better handling of external resources.
177
+
178
  = 1.3 =
 
179
  * New Feature: Added support for high-quality splash screen. You can now set the 512x512 icon for the splash screen of your Progressive Web App.
180
  * Enhancement: Super Progressive Web Apps now accounts for content updates and will update the cache as you update the website.
181
  * Enhancement: Improved in-browser service worker update handling.
182
  * Enhancement: Added automatic upgrade of manifest and service worker on plugin upgrade.
183
 
184
  = 1.2 =
 
185
  * New Feature: Support for theme-color.
186
  * New Feature: Now you can edit the Application Name and Application Short name.
187
  * New Feature: Set the start page of your PWA.
189
  * UI Improvement: Better organization of plugin settings. More intuitive with inline help.
190
  * UI Improvement: Added admin notice with a link to settings page on plugin activation.
191
  * UI Improvement: Added checks for manifest, service worker and HTTPS and display the status neatly in the UI.
192
+ * Bug Fix: Fix a parse error that showed up only on PHP 5.3.
193
 
194
  = 1.1.1 =
195
+ * Bug Fix: Fix fatal error in PHP versions prior to PHP 5.5. "Cant use function return value in write context". PHP manual says "Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error."
 
196
 
197
  = 1.1 =
198
+ * New Feature: Aggressive caching of pages using CacheStorage API.
199
+ * New Feature: Pages once cached are served even if the user is offline.
200
+ * New Feature: Set custom offline page: Select the page you want the user to see when a page that isn't in the cache is accessed and the user is offline.
 
201
 
202
  = 1.0 =
203
  * First release of the plugin.
superpwa.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Convert your WordPress website into a Progressive Web App
6
  * Author: SuperPWA
7
  * Contributors: Arun Basil Lal, Jose Varghese
8
- * Version: 1.3
9
  * Text Domain: super-progressive-web-apps
10
  * Domain Path: /languages
11
  * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
@@ -48,7 +48,7 @@ if ( ! defined('ABSPATH') ) exit;
48
  */
49
  if ( ! defined('SUPERPWA_PATH_ABS ') ) define('SUPERPWA_PATH_ABS', plugin_dir_path( __FILE__ )); // absolute path to the plugin directory. eg - /var/www/html/wp-content/plugins/superpwa/
50
  if ( ! defined('SUPERPWA_PATH_SRC') ) define('SUPERPWA_PATH_SRC', plugin_dir_url( __FILE__ )); // link to the plugin folder. eg - http://example.com/wp/wp-content/plugins/superpwa/
51
- if ( ! defined('SUPERPWA_VERSION') ) define('SUPERPWA_VERSION', '1.3'); // Plugin version
52
  if ( ! defined('SUPERPWA_MANIFEST_FILENAME') ) define('SUPERPWA_MANIFEST_FILENAME', 'superpwa-manifest.json'); // Name of Manifest file
53
  if ( ! defined('SUPERPWA_MANIFEST_ABS') ) define('SUPERPWA_MANIFEST_ABS', trailingslashit( ABSPATH ) . SUPERPWA_MANIFEST_FILENAME); // Absolute path to manifest
54
  if ( ! defined('SUPERPWA_MANIFEST_SRC') ) define('SUPERPWA_MANIFEST_SRC', trailingslashit( get_bloginfo('wpurl') ) . SUPERPWA_MANIFEST_FILENAME); // Link to manifest
5
  * Description: Convert your WordPress website into a Progressive Web App
6
  * Author: SuperPWA
7
  * Contributors: Arun Basil Lal, Jose Varghese
8
+ * Version: 1.3.1
9
  * Text Domain: super-progressive-web-apps
10
  * Domain Path: /languages
11
  * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
48
  */
49
  if ( ! defined('SUPERPWA_PATH_ABS ') ) define('SUPERPWA_PATH_ABS', plugin_dir_path( __FILE__ )); // absolute path to the plugin directory. eg - /var/www/html/wp-content/plugins/superpwa/
50
  if ( ! defined('SUPERPWA_PATH_SRC') ) define('SUPERPWA_PATH_SRC', plugin_dir_url( __FILE__ )); // link to the plugin folder. eg - http://example.com/wp/wp-content/plugins/superpwa/
51
+ if ( ! defined('SUPERPWA_VERSION') ) define('SUPERPWA_VERSION', '1.3.1'); // Plugin version
52
  if ( ! defined('SUPERPWA_MANIFEST_FILENAME') ) define('SUPERPWA_MANIFEST_FILENAME', 'superpwa-manifest.json'); // Name of Manifest file
53
  if ( ! defined('SUPERPWA_MANIFEST_ABS') ) define('SUPERPWA_MANIFEST_ABS', trailingslashit( ABSPATH ) . SUPERPWA_MANIFEST_FILENAME); // Absolute path to manifest
54
  if ( ! defined('SUPERPWA_MANIFEST_SRC') ) define('SUPERPWA_MANIFEST_SRC', trailingslashit( get_bloginfo('wpurl') ) . SUPERPWA_MANIFEST_FILENAME); // Link to manifest