mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-19 09:20:35 -04:00
Enable use of Native FS with NWJS
Former-commit-id: ec8d5cb4a8740cab772c96a55ea0c8476f982cf7 [formerly 9414582f7871508a112da8ac5e0fdd743ca6d577] [formerly 375cebd89f97e34f185cb98c45a2ed6d7910e275] [formerly 8446ca6a48adc54c2af3f2ff51c2518facfba8b4 [formerly 2d48af1287b4025785dbfed2674e8fb8395bcf3b [formerly 5be86a45b6197fa3028a01327383fd9b16a0e41a]]] Former-commit-id: b2a99ee393a49749019899cb3eb8dffcfa5e6fe8 [formerly cad8f01644a95fe4f81c1406594374f8f4479b32 [formerly 7939386193c383ea6686c537b37d809d1ca956e5]] Former-commit-id: c944303c8ea812c2733ae214393b460443a473e5 [formerly 6312434710b6d423e3d35fb7f753bb8f1b257dbd] Former-commit-id: e59a34d9e643b76662ac4096fa6e3773980b711b
This commit is contained in:
parent
f8ee50ecf0
commit
2b6f8b5a39
@ -55,7 +55,10 @@
|
||||
if (typeof window.nw !== 'undefined') {
|
||||
window.requireNode = window.require;
|
||||
window.require = undefined;
|
||||
window.fs = requireNode('fs');
|
||||
// If Native FS is unavailable, we'll use NWJS fs
|
||||
if (typeof window.showOpenFilePicker === 'undefined') {
|
||||
window.fs = requireNode('fs');
|
||||
}
|
||||
}
|
||||
if ('serviceWorker' in navigator && /^http/.test(window.location.protocol)) {
|
||||
console.log('Trying to activate Service Worker...');
|
||||
@ -113,7 +116,7 @@
|
||||
<h3 style="margin-top:0;">Changes in version <span class="version">1.0</span></h3>
|
||||
<ul style="padding-left: 15px;">
|
||||
<li>Included ZIM updated to wikipedia_en_100_maxi_2020-11.zim</li>
|
||||
<li>Support new location of mobile and desktop styles in Wikimedia archives</li>
|
||||
<li>Support new location of mobile and desktop styles in Wikimedia archives</li>
|
||||
<li>Fixed critical error on some new Wikipedia articles containing equations</li>
|
||||
<li>WebP image support (via polyfill) for older browsers including Windows Mobile</li>
|
||||
<li>Improved block cache and faster conversion of file slice to blob</li>
|
||||
|
@ -837,8 +837,20 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'cook
|
||||
} else if (handle.kind === 'directory') {
|
||||
return processNativeDirHandle(handle);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(handle);
|
||||
} else {
|
||||
searchForArchivesInPreferencesOrStorage();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(null);
|
||||
} else {
|
||||
searchForArchivesInPreferencesOrStorage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1603,8 +1615,12 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'cook
|
||||
// After that, we can start looking for archives
|
||||
//storages[0].get("fake-file-to-read").then(searchForArchivesInPreferencesOrStorage,
|
||||
if (!params.pickedFile) {
|
||||
searchForArchivesInPreferencesOrStorage();
|
||||
} else if (typeof window.fs === 'undefined') {
|
||||
if (params.storedFile && typeof window.showOpenFilePicker !== 'undefined') {
|
||||
getNativeFSHandle();
|
||||
} else {
|
||||
searchForArchivesInPreferencesOrStorage();
|
||||
}
|
||||
} else if (typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined') {
|
||||
processPickedFileUWP(params.pickedFile);
|
||||
} else {
|
||||
// We're in an Electron app with a packaged file that we need to read from the node File System
|
||||
|
Loading…
x
Reference in New Issue
Block a user