Files
rootandClaude Opus 5.5 4a92dfd2dc feat(feeds): site-scoped RSS add infers account, parser and poll
Adding a feed from a site page now only asks for the URL, purpose
(discover / track / promotion) and an optional note. POST /feed-sources
with siteId infers the site account (passkey holder first), records the
site definition version as parserVersion, defaults the name to
"<site> RSS" and polling to 30 minutes, and returns non-blocking
warnings when the URL host does not match the site. The dialog shows the
redacted URL, fetches once right after saving and reports the item count
or the error.

The generic feed form on the sources page suggests linking a registered
site when the URL host matches (can be undone). name is now optional.

Takes effect after the stack is rebuilt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-29 14:43:19 +08:00

15 lines
606 B
TypeScript

import { describe, expect, it } from "vitest";
import { feedHostKey } from "./feeds.ts";
describe("feedHostKey", () => {
it("同站子域名 / www 归到同一键", () => {
expect(feedHostKey("https://hhanclub.net/torrentrss.php?passkey=x")).toBe("hhanclub.net");
expect(feedHostKey("https://www.hhanclub.net/")).toBe("hhanclub.net");
expect(feedHostKey("https://rss.hhanclub.net/a")).toBe("hhanclub.net");
});
it("IP 原样;非法地址为 null", () => {
expect(feedHostKey("http://127.0.0.1:8080/rss")).toBe("127.0.0.1");
expect(feedHostKey("not a url")).toBeNull();
});
});