ckelsoe_obsidian-rss-importer/feed-picker-modal.ts
Charles Kelsoe 9e563d8ffe Phase 5: apply adversarial-review fixes
Correctness: resolver classifies /p/ as Substack only on a substack.com host;
redirect cap aligned to 5; extractFeedItemId unescapes in a single pass (round
trips literal backslash escapes). Feature: podcast/media notes now record
media-url frontmatter and append an [Episode audio]/[Media] body link. Safety:
the import command guards synchronous NoteWriter construction (a bad destination
folder now surfaces a Notice, not a silent throw); loadSettings validates
per-feed literal fields from data.json. Diagnosability: empty-body imports and
skipped image downloads are logged. Structure: FeedPickerModal and
DuplicatePromptModal moved to their own files; id non-empty guard at the mapping
boundary; doc + type-dedup cleanups. 244 tests; build + lint green.

Deferred (low/cosmetic): shared header helper, Atom updated-vs-published date
precedence, the sanctioned settings-tab cast.
2026-06-14 15:26:45 -04:00

28 lines
740 B
TypeScript

// Picks which configured feed to import from when more than one exists.
import { App, FuzzySuggestModal } from "obsidian";
import type { FeedConfig } from "./settings";
export class FeedPickerModal extends FuzzySuggestModal<FeedConfig> {
private readonly feeds: FeedConfig[];
private readonly onChoose: (feed: FeedConfig) => void;
constructor(app: App, feeds: FeedConfig[], onChoose: (feed: FeedConfig) => void) {
super(app);
this.feeds = feeds;
this.onChoose = onChoose;
this.setPlaceholder("Pick a feed to import from");
}
getItems(): FeedConfig[] {
return this.feeds;
}
getItemText(feed: FeedConfig): string {
return feed.publicationTitle;
}
onChooseItem(feed: FeedConfig): void {
this.onChoose(feed);
}
}