Skip to content

Commit e8a2a5e

Browse files
Ensure description for ExcludeSyncFolders is updated
1 parent 61d8fc6 commit e8a2a5e

3 files changed

Lines changed: 31 additions & 15 deletions

File tree

tests/integration.spec.js

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ test.describe('NickelMenu', () => {
7676
// Download instructions should be visible, and include eReader.conf step for sample config
7777
await expect(page.locator('#nm-download-instructions')).not.toBeHidden();
7878
await expect(page.locator('#nm-download-conf-step')).not.toBeHidden();
79+
// Verify the correct pattern and description are shown (exclude-calibre is enabled)
80+
await expect(page.locator('#nm-download-conf-line')).toHaveText('ExcludeSyncFolders=(calibre|\\.(?!kobo|adobe|calibre).+|([^.][^/]*/)+\\..+)');
81+
await expect(page.locator('#nm-download-conf-desc')).toHaveText('This prevents new books in the calibre folder from showing up in Kobo\'s list of books.');
7982

8083
// Verify ZIP contents
8184
expect(download.suggestedFilename()).toBe('NickelMenu-install.zip');
@@ -342,18 +345,28 @@ test.describe('NickelMenu', () => {
342345

343346
await page.click('#btn-nm-features-next');
344347

345-
// Review and write to device
348+
// Review and download (not write) to test download instructions
346349
await expect(page.locator('#step-nm-review')).not.toBeHidden();
347-
await page.click('#btn-nm-write');
350+
const [download] = await Promise.all([
351+
page.waitForEvent('download'),
352+
page.click('#btn-nm-download'),
353+
]);
348354
await expect(page.locator('#step-nm-done')).toBeVisible({ timeout: 30_000 });
349355

350-
// Verify eReader.conf was written WITHOUT calibre in the pattern
356+
// Download instructions should show the non-calibre pattern
357+
await expect(page.locator('#nm-download-instructions')).not.toBeHidden();
358+
await expect(page.locator('#nm-download-conf-step')).not.toBeHidden();
359+
await expect(page.locator('#nm-download-conf-line')).toHaveText('ExcludeSyncFolders=(\\.(?!kobo|adobe).+|([^.][^/]*/)+\\..+)');
360+
await expect(page.locator('#nm-download-conf-desc')).toHaveText('This prevents the Kobo from incorrectly identifying certain files as books in your library.');
361+
362+
// Verify ZIP does NOT contain eReader.conf
363+
const zipData = fs.readFileSync(await download.path());
364+
const zip = await JSZip.loadAsync(zipData);
365+
expect(Object.keys(zip.files)).not.toContain('.kobo/Kobo/Kobo eReader.conf');
366+
367+
// Verify eReader.conf on device was NOT modified (download mode doesn't write to device)
351368
const conf = await readMockFile(page, '.kobo', 'Kobo', 'Kobo eReader.conf');
352-
expect(conf, 'eReader.conf should contain ExcludeSyncFolders').toContain('ExcludeSyncFolders');
353-
// Pattern should NOT start with calibre
354-
expect(conf).not.toContain('ExcludeSyncFolders=(calibre|');
355-
// But should still have the general hidden-folder exclusion
356-
expect(conf).toContain('\\.(?!kobo|adobe).+');
369+
expect(conf).not.toContain('ExcludeSyncFolders');
357370
});
358371

359372
test('with device — replaces existing calibre exclusion when checkbox is unchecked', async ({ page }) => {

web/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ <h2>Connect your Kobo</h2>
295295
<li id="nm-download-conf-step" hidden>Open <strong>.kobo/Kobo/Kobo eReader.conf</strong> in a text editor.<br>
296296
Find the <code>[FeatureSettings]</code> section (or add it at the end of the file) and add the following line <strong>inside</strong> that section (do not replace the entire file):<br>
297297
<code id="nm-download-conf-line"></code><br>
298-
This prevents new books in the <code>calibre</code> folder from showing up in Kobo's list of books.</li>
298+
<span id="nm-download-conf-desc"></span></li>
299299
<li id="nm-download-reboot-step" hidden><strong>Safely eject</strong> the Kobo, then power it off by holding the power button until it says "Powered off". Press the power button again to boot it back up. The config change takes effect after reboot. Reconnect the Kobo via USB afterwards.</li>
300300
<li>Extract the downloaded ZIP to the <strong>root</strong> of the Kobo drive, preserving the folder structure. Make sure hidden folders like <code>.kobo</code> and <code>.adds</code> are also copied.</li>
301301
<li><strong>Safely eject</strong> the Kobo &mdash; do not just unplug the cable.</li>

web/src/js/flows/nickelmenu-flow.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,17 @@ export function initNickelMenu(state) {
362362
nmDoneStatus.textContent = TL.STATUS.NM_DOWNLOAD_READY;
363363
triggerDownload(state.resultNmZip, 'NickelMenu-install.zip', 'application/zip');
364364
$('nm-download-instructions').hidden = false;
365-
// Only show config/reboot steps when exclude-calibre feature is selected
365+
// Show config step for preset installs (ExcludeSyncFolders is always written)
366366
const features = state.nickelMenuOption === 'preset' ? getSelectedFeatures() : [];
367367
const hasExcludeCalibre = features.some(f => f.id === 'exclude-calibre');
368-
$('nm-download-conf-step').hidden = !hasExcludeCalibre;
369-
$('nm-download-reboot-step').hidden = !hasExcludeCalibre;
370-
if (hasExcludeCalibre) {
371-
$('nm-download-conf-line').textContent = 'ExcludeSyncFolders=(calibre|\\.(?!kobo|adobe|calibre).+|([^.][^/]*/)+\\..+)';
372-
}
368+
$('nm-download-conf-step').hidden = state.nickelMenuOption !== 'preset';
369+
$('nm-download-reboot-step').hidden = state.nickelMenuOption !== 'preset';
370+
$('nm-download-conf-line').textContent = hasExcludeCalibre
371+
? 'ExcludeSyncFolders=(calibre|\\.(?!kobo|adobe|calibre).+|([^.][^/]*/)+\\..+)'
372+
: 'ExcludeSyncFolders=(\\.(?!kobo|adobe).+|([^.][^/]*/)+\\..+)';
373+
$('nm-download-conf-desc').textContent = hasExcludeCalibre
374+
? 'This prevents new books in the calibre folder from showing up in Kobo\'s list of books.'
375+
: 'This prevents the Kobo from incorrectly identifying certain files as books in your library.';
373376
track('flow-end', { result: 'nm-download' });
374377
}
375378

0 commit comments

Comments
 (0)