More integration steps, fix bug related to only NM install
All checks were successful
Build and test project / build-and-test (push) Successful in 1m28s
All checks were successful
Build and test project / build-and-test (push) Successful in 1m28s
This commit is contained in:
@@ -584,7 +584,7 @@ import JSZip from 'jszip';
|
||||
|
||||
try {
|
||||
if (nickelMenuOption === 'remove') {
|
||||
await nmInstaller.loadAssets((msg) => { nmProgress.textContent = msg; });
|
||||
await nmInstaller.loadAssets((msg) => { nmProgress.textContent = msg; }, false);
|
||||
nmProgress.textContent = 'Writing KoboRoot.tgz...';
|
||||
const tgz = await nmInstaller.getKoboRootTgz();
|
||||
await device.writeFile(['.kobo', 'KoboRoot.tgz'], tgz);
|
||||
|
||||
@@ -25,19 +25,23 @@ class NickelMenuInstaller {
|
||||
|
||||
/**
|
||||
* Download and cache the bundled assets.
|
||||
* @param {function} progressFn
|
||||
* @param {boolean} [needConfig=true] - Whether to also load kobo-config.zip
|
||||
*/
|
||||
async loadAssets(progressFn) {
|
||||
if (this.nickelMenuZip && this.koboConfigZip) return;
|
||||
async loadAssets(progressFn, needConfig = true) {
|
||||
if (!this.nickelMenuZip) {
|
||||
progressFn('Downloading NickelMenu...');
|
||||
const nmResp = await fetch('nickelmenu/NickelMenu.zip');
|
||||
if (!nmResp.ok) throw new Error('Failed to download NickelMenu.zip: HTTP ' + nmResp.status);
|
||||
this.nickelMenuZip = await JSZip.loadAsync(await nmResp.arrayBuffer());
|
||||
}
|
||||
|
||||
progressFn('Downloading NickelMenu...');
|
||||
const nmResp = await fetch('nickelmenu/NickelMenu.zip');
|
||||
if (!nmResp.ok) throw new Error('Failed to download NickelMenu.zip: HTTP ' + nmResp.status);
|
||||
this.nickelMenuZip = await JSZip.loadAsync(await nmResp.arrayBuffer());
|
||||
|
||||
progressFn('Downloading configuration files...');
|
||||
const cfgResp = await fetch('nickelmenu/kobo-config.zip');
|
||||
if (!cfgResp.ok) throw new Error('Failed to download kobo-config.zip: HTTP ' + cfgResp.status);
|
||||
this.koboConfigZip = await JSZip.loadAsync(await cfgResp.arrayBuffer());
|
||||
if (needConfig && !this.koboConfigZip) {
|
||||
progressFn('Downloading configuration files...');
|
||||
const cfgResp = await fetch('nickelmenu/kobo-config.zip');
|
||||
if (!cfgResp.ok) throw new Error('Failed to download kobo-config.zip: HTTP ' + cfgResp.status);
|
||||
this.koboConfigZip = await JSZip.loadAsync(await cfgResp.arrayBuffer());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +115,8 @@ class NickelMenuInstaller {
|
||||
* @param {function} progressFn
|
||||
*/
|
||||
async installToDevice(device, option, cfg, progressFn) {
|
||||
await this.loadAssets(progressFn);
|
||||
const needConfig = option !== 'nickelmenu-only';
|
||||
await this.loadAssets(progressFn, needConfig);
|
||||
|
||||
// Always install KoboRoot.tgz
|
||||
progressFn('Writing KoboRoot.tgz...');
|
||||
@@ -172,7 +177,8 @@ class NickelMenuInstaller {
|
||||
* @returns {Uint8Array} zip contents
|
||||
*/
|
||||
async buildDownloadZip(option, cfg, progressFn) {
|
||||
await this.loadAssets(progressFn);
|
||||
const needConfig = option !== 'nickelmenu-only';
|
||||
await this.loadAssets(progressFn, needConfig);
|
||||
|
||||
progressFn('Building download package...');
|
||||
const zip = new JSZip();
|
||||
|
||||
Reference in New Issue
Block a user