Add only what is a feed or links one; refuse the rest (#102)
Adding an address looked for the feed a web page links and, finding none, added the address as it was: every check then failed, and the sidebar called it a feed that had moved. cnn.com is one; its page links no feed. find_feed replaces feed_behind_page: the address is added if it is a feed or an OPML list, the feed its page links if it is a web page that links one (and that is a feed), and otherwise the add is refused with the reason, from the web page (400, the dialog stays open) and from `ipx add`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -927,6 +927,19 @@ test('adding a feed scans it straight away', async ({ page }) => {
|
||||
await expect(page.locator('.ep', { hasText: 'Fresh Ep' })).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test('adding a page adds the feed it links, and a page with no feed is refused', async ({ page }) => {
|
||||
const feeds = await page.locator('.feed').count();
|
||||
await page.locator('#addFeed').click();
|
||||
await page.locator('#nurl').fill('http://127.0.0.1:8792/nofeed.html');
|
||||
await page.locator('#nsave').click();
|
||||
await expect(page.locator('.toast')).toContainText('links no feed');
|
||||
await expect(page.locator('#modal.on')).toBeVisible(); // left open to correct it
|
||||
await expect(page.locator('.feed')).toHaveCount(feeds);
|
||||
await page.locator('#nurl').fill('http://127.0.0.1:8792/site.html');
|
||||
await page.locator('#nsave').click();
|
||||
await expect(page.locator('.feed', { hasText: 'Linked Site' })).toBeVisible({ timeout: 20_000 });
|
||||
});
|
||||
|
||||
test('a deleted file looks as if it was never downloaded', async ({ page }) => {
|
||||
// Other people subscribe to Picture Blog by now, so both prompts come; take them.
|
||||
page.on('dialog', d => d.accept());
|
||||
|
||||
4
tests/ui/fixtures/linked.xml
Normal file
4
tests/ui/fixtures/linked.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<rss version="2.0"><channel><title>Linked Site</title><link>http://127.0.0.1:8792/site.html</link>
|
||||
<item><title>Linked Post</title><guid>linked-1</guid></item>
|
||||
</channel></rss>
|
||||
2
tests/ui/fixtures/nofeed.html
Normal file
2
tests/ui/fixtures/nofeed.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<!doctype html>
|
||||
<html><head><title>No Feed Here</title></head><body>A site that links no feed.</body></html>
|
||||
4
tests/ui/fixtures/site.html
Normal file
4
tests/ui/fixtures/site.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<!doctype html>
|
||||
<html><head><title>A Site</title>
|
||||
<link rel="alternate" type="application/rss+xml" href="/linked.xml">
|
||||
</head><body>A site with a feed.</body></html>
|
||||
Reference in New Issue
Block a user