Finesse passthrough code

Former-commit-id: b4ac62e2c687b4716aac868696733c7dc7c66801 [formerly 9602114b1e7a3e12d697081d8eb4b2085ca68d99 [formerly 9e5193e5764c7e51da7496f0aa32b96d0fbe9405]]
Former-commit-id: f4b49730aaa7fda26b5fc566887bee5e48587e1d
Former-commit-id: 3eada2977d661e1a3f42ff5dd2ecf4eb0608f4fd
This commit is contained in:
Jaifroid 2021-01-30 18:30:27 +00:00
parent b04dc967a1
commit 2a3882010c
3 changed files with 7 additions and 3 deletions

View File

@ -4,7 +4,7 @@
// App version number - ENSURE IT MATCHES VALUE IN init.js // App version number - ENSURE IT MATCHES VALUE IN init.js
// DEV: Changing this will cause the browser to recognize that the Service Worker has changed, and it will download and // DEV: Changing this will cause the browser to recognize that the Service Worker has changed, and it will download and
// install a new copy // install a new copy
const appVersion = '1.2.0-RP10'; const appVersion = '1.2.0-RP11';
// Kiwix ZIM Archive Download Server in regex form // Kiwix ZIM Archive Download Server in regex form
// DEV: The server URL is defined in init.js, but is not available to us in SW // DEV: The server URL is defined in init.js, but is not available to us in SW

View File

@ -1571,8 +1571,12 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
if (goPWA) { if (goPWA) {
var launchPWA = function () { var launchPWA = function () {
settingsStore.setItem('contentInjectionMode', value, Infinity); settingsStore.setItem('contentInjectionMode', value, Infinity);
// This is needed so that we get passthrough on subsequent launches
settingsStore.setItem('allowInternetAccess', true, Infinity); settingsStore.setItem('allowInternetAccess', true, Infinity);
window.location.href = 'https://kiwix.github.io/kiwix-js-windows/www/index.html?contentInjectionMode=serviceworker&allowInternetAccess=true'; // We are using allowInternetAccess as a passthrough, so if it is enabled, we don't force a
// switch to SW mode on the server
var serverContentInjectionMode = params.allowInternetAccess ? '' : '&contentInjectionMode=serviceworker';
window.location.href = params.PWAServer + 'www/index.html?allowInternetAccess=true' + serverContentInjectionMode;
}; };
if (params.allowInternetAccess) { if (params.allowInternetAccess) {
launchPWA(); launchPWA();

View File

@ -49,7 +49,7 @@ var params = {};
*/ */
var appstate = {}; var appstate = {};
/******** UPDATE VERSION IN pwabuilder-sw.js TO MATCH VERSION *******/ /******** UPDATE VERSION IN pwabuilder-sw.js TO MATCH VERSION *******/
params['version'] = "1.2.0-RP10"; //DEV: Manually update this version when there is a new release: it is compared to the Settings Store "version" in order to show first-time info, and the cookie is updated in app.js params['version'] = "1.2.0-RP11"; //DEV: Manually update this version when there is a new release: it is compared to the Settings Store "version" in order to show first-time info, and the cookie is updated in app.js
/******* UPDATE THIS ^^^^^^ IN serveice worker!! ********************/ /******* UPDATE THIS ^^^^^^ IN serveice worker!! ********************/
params['packagedFile'] = "wikipedia_en_100_maxi.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage params['packagedFile'] = "wikipedia_en_100_maxi.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage
params['archivePath'] = "archives"; //The directory containing the packaged archive(s) (relative to app's root directory) params['archivePath'] = "archives"; //The directory containing the packaged archive(s) (relative to app's root directory)