mirror of
https://github.com/ckelsoe/obsidian-rss-importer.git
synced 2026-07-22 07:48:56 +00:00
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.
28 lines
740 B
TypeScript
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);
|
|
}
|
|
}
|