Keep every enclosure on an item, and view without downloading
The rss crate keeps at most one enclosure per item and, when a feed ships several, silently keeps the last -- so a two-file item lost its first file. enclosures_by_item reads them from the XML in document order, unescaping attributes so a URL's & survives. The row summarises the one you would act on and counts the rest; the pane below lists them all. Non-media enclosures gain a View link opening in a new tab: the publisher's URL, or the local copy once downloaded. A direct link, not a proxy, so the daemon does not become a fetch-anything relay. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AdXho5tTkjFLeUXKbEjKBh
This commit is contained in:
@@ -11,7 +11,7 @@ test('the page loads and lists the configured feeds', async ({ page }) => {
|
||||
// Regression: a ReferenceError in the script left the shell rendered and the sidebar
|
||||
// empty, with every handler below the error dead. Server-side checks all passed.
|
||||
// Three top-level feeds in the fixture config; the OPML's child is inside a closed folder.
|
||||
await expect(page.locator('.feed')).toHaveCount(3, { timeout: 15_000 });
|
||||
await expect(page.locator('.feed')).toHaveCount(4, { timeout: 15_000 });
|
||||
await expect(page.getByText('Test Show')).toBeVisible();
|
||||
const errors = [];
|
||||
page.on('pageerror', e => errors.push(e.message));
|
||||
@@ -99,8 +99,25 @@ test('a downloaded file that is not audio gets no player', async ({ page }) => {
|
||||
await expect(page.locator('#detail audio')).toHaveCount(0);
|
||||
await expect(page.locator('#detail .encbox')).toContainText('image');
|
||||
await expect(page.locator('#detail .encbox')).toContainText('downloaded');
|
||||
// Still offered as a file, just not as an episode.
|
||||
// Still offered as a file, just not as an episode: viewable and keepable.
|
||||
await expect(page.locator('#detail .btn', { hasText: 'Save' })).toBeVisible();
|
||||
const view = page.locator('#detail a', { hasText: 'View' });
|
||||
await expect(view).toHaveAttribute('target', '_blank');
|
||||
await expect(view).toHaveAttribute('rel', /noopener/);
|
||||
await expect(view).toHaveAttribute('href', /\/media\/\d+/);
|
||||
});
|
||||
|
||||
test('an item with several enclosures lists them all', async ({ page }) => {
|
||||
await page.locator('.feed', { hasText: 'Multi Show' }).click();
|
||||
const row = page.locator('.ep', { hasText: 'Two Files' });
|
||||
await expect(row).toBeVisible({ timeout: 20_000 });
|
||||
// The row says there is more than one without listing them.
|
||||
await expect(row).toContainText('+1 more file');
|
||||
|
||||
await row.click();
|
||||
// The pane below lists every one: the audio and the image.
|
||||
await expect(page.locator('#detail .encbox')).toHaveCount(2);
|
||||
await expect(page.locator('#detail .encbox').nth(1)).toContainText('image');
|
||||
});
|
||||
|
||||
test('the filter tabs change what is listed', async ({ page }) => {
|
||||
|
||||
BIN
tests/ui/fixtures/art2.jpg
Normal file
BIN
tests/ui/fixtures/art2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
tests/ui/fixtures/ep2.mp3
Normal file
BIN
tests/ui/fixtures/ep2.mp3
Normal file
Binary file not shown.
9
tests/ui/fixtures/multi.xml
Normal file
9
tests/ui/fixtures/multi.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<rss version="2.0"><channel><title>Multi Show</title><link>http://127.0.0.1:8792/</link>
|
||||
<description>An item with more than one file.</description>
|
||||
<item><title>Two Files</title><guid>mu-1</guid>
|
||||
<pubDate>Mon, 01 Sep 2026 10:00:00 +0000</pubDate>
|
||||
<description>Audio and a picture.</description>
|
||||
<enclosure url="http://127.0.0.1:8792/ep2.mp3" length="40000" type="audio/mpeg"/>
|
||||
<enclosure url="http://127.0.0.1:8792/art2.jpg" length="3020" type="image/jpeg"/>
|
||||
</item></channel></rss>
|
||||
@@ -40,6 +40,10 @@ url = "http://127.0.0.1:8792/pics.xml"
|
||||
auto_download = true
|
||||
media_types = ["image"]
|
||||
|
||||
[feeds.multi-show]
|
||||
url = "http://127.0.0.1:8792/multi.xml"
|
||||
auto_download = true
|
||||
|
||||
[feeds.test-subscriptions]
|
||||
url = "http://127.0.0.1:8792/subs.opml"
|
||||
auto_download = false
|
||||
|
||||
Reference in New Issue
Block a user