Merge branch 'main' into experiments/footnotes-modernisation
No files matched your search
|
After Width: | Height: | Size: 602 KiB |
|
After Width: | Height: | Size: 753 KiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 3.0 MiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 309 KiB |
|
After Width: | Height: | Size: 305 KiB |
|
After Width: | Height: | Size: 769 KiB |
|
After Width: | Height: | Size: 955 KiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 640 KiB |
|
After Width: | Height: | Size: 621 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
@@ -6,6 +6,136 @@
|
||||
<description>Most recent NetNewsWire changes with links to updates.</description>
|
||||
<language>en</language>
|
||||
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.4b1</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>Added Miniflux syncing — sign in with a username and password or an API token. Thanks to Dave Marquard (who also does the awesome NetNewsWire themes site) for this feature!
|
||||
<li>Made the article view inspectable with Safari’s Web Inspector
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Fri, 27 Nov 2026 20:15:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.4b1/NetNewsWire7.4b1.zip" sparkle:version="7245" sparkle:shortVersionString="7.4b1" length="10731329" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3.1</title>
|
||||
<description><![CDATA[
|
||||
<b>Changes since 7.3</b>
|
||||
<ul>
|
||||
<li>Fixed bug where smart feeds might not appear in the sidebar
|
||||
<li>Stopped refreshing Reddit feeds, since Reddit no longer offers RSS feeds
|
||||
<li>Renamed the feed notification setting to Notify About New Articles, in the inspector and in the sidebar’s contextual menu
|
||||
<li>Changed the Create button to Add when adding a Feedbin, NewsBlur, or Reader API account
|
||||
<li>Updated the Tiqoe Dark theme — styles for primary images, enclosures, and captions, and fixes for TechCrunch, Macworld, and the-ebook-reader articles
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Fri, 20 Nov 2026 09:00:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3.1/NetNewsWire7.3.1.zip" sparkle:version="7242" sparkle:shortVersionString="7.3.1" length="10473901" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3.1b1</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>Fixed bug where smart feeds might not appear in the sidebar
|
||||
<li>Stopped refreshing Reddit feeds, since Reddit no longer offers RSS feeds
|
||||
<li>Renamed the feed notification setting to Notify About New Articles, in the inspector and in the sidebar’s contextual menu
|
||||
<li>Changed the Create button to Add when adding a Feedbin, NewsBlur, or Reader API account
|
||||
<li>Updated the Tiqoe Dark theme — styles for primary images, enclosures, and captions, and fixes for TechCrunch, Macworld, and the-ebook-reader articles
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Thu, 19 Nov 2026 08:55:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3.1b1/NetNewsWire7.3.1b1.zip" sparkle:version="7240" sparkle:shortVersionString="7.3.1b1" length="10473891" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3</title>
|
||||
<description><![CDATA[
|
||||
<b>Changes since 7.2.1</b>
|
||||
<ul>
|
||||
<li>Restored the status bar from NetNewsWire of Yore (NetNewsWire 1-3) pretty much exactly. Show and hide it via the View menu. Status bar includes a gear menu for various commands, a status report next to it (click to change what’s shown), current URL, and Themes menu. Clicking the progress indicator during a refresh opens the Current Activity window
|
||||
<li>Added an Appearance settings pane — appearance (system, light, or dark), sidebar text size, sidebar icons, which smart feeds to show (Today, All Unread, Starred), and the article theme and text size (moved from General)
|
||||
<li>Added a Timeline settings pane — text size, feed icons (automatic, always, or never), feed icon size, thumbnails, rows (full title with no preview, or title and preview in 1 to 6 lines), separators, fading read articles, and showing the feed name and date above the title (on by default)
|
||||
<li>Added a Grayscale icons setting to Settings > Appearance — for feed icons and author avatars (article thumbnails stay in color)
|
||||
<li>Made separators a regular setting (it was a hidden preference) — your existing choice carries over
|
||||
<li>Reorganized the View menu into sections — sidebar, timeline, status bar, and toolbar
|
||||
<li>Added a Themes Gallery command to the Help menu, and renamed Discourse Forum to NetNewsWire Forum
|
||||
<li>Made the main window’s split view dividers a little darker in light mode
|
||||
<li>Added article thumbnails to the timeline — choose large or small in Settings > Timeline. Default is none. (Works in standard layout but not column layout)
|
||||
<li>Made rows fit their content (variable row heights) in the timeline
|
||||
<li>Made timeline rows always show the author or feed name, instead of leaving that spot empty
|
||||
<li>Fixed bug where the last article in the timeline had a separator below it
|
||||
<li>Added support for enclosures and Media RSS
|
||||
<li>Added enclosures to the article view — you can see images from Mastodon feeds, play an MP3 or video, etc.
|
||||
<li>Made YouTube enclosures play in the privacy-enhanced YouTube player (youtube-nocookie.com)
|
||||
<li>Made the article view show plain text or media:description when an article has no HTML content
|
||||
<li>Used an item’s only Gravatar as its author’s avatar, even when the author name is a username
|
||||
<li>Made image downloading kinder to servers — honors Retry-After, waits after errors, and limits downloads to two at a time per host
|
||||
<li>Added Gray theme — inspired by newsprint design but not meant to be a literal copy
|
||||
<li>Added Plum theme — uses the same layout as the Gray theme but with color
|
||||
<li>Added [[primary_media]] and [[enclosures]] tags for themes — primary_media is the article’s main image, video, or audio from the feed, when the article’s HTML doesn’t already include it
|
||||
<li>Allowed themes to include a template7.3.html file, which is used in 7.3 and later instead of template.html
|
||||
<li>Added an optional grayscaleIcon key to theme Info.plist files — when true, the feed icon or author avatar in the article view is grayscale. The Gray theme uses this new feature
|
||||
<li>Updated the built-in themes to use [[primary_media]] and [[enclosures]]
|
||||
<li>Added netnewswire, feed, feeds, and x-netnewswire-feed as allowed link schemes in the article view — so clicking a link to install a theme (for instance) works
|
||||
<li>Fixed extra vertical space in MacRumors articles
|
||||
<li>Fixed inline footnotes in FreshRSS articles
|
||||
<li>Fixed embedded YouTube videos (and other iframes) not loading on sites that use Optimole lazy loading
|
||||
<li>Fixed blog.rust-lang.org articles — JavaScript is turned off for them, and their noscript content is shown
|
||||
<li>Fixed footnote popover positioning near the edge of the article view and after resizing the window on Duo
|
||||
<li>Fixed bug where deleting a feed could remove the wrong row (usually the next row) from the sidebar
|
||||
<li>Fixed bug where restoring with no article selected, then clicking an article, would auto-scroll the article view
|
||||
<li>Fixed bug where double-clicking an article in an inactive window could open the wrong article
|
||||
<li>Made double-clicking an article in an inactive window mark it as read
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Tue, 17 Nov 2026 21:40:00 -0800</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3/NetNewsWire7.3.zip" sparkle:version="7239" sparkle:shortVersionString="7.3" length="10472470" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3b9</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>Added Open Themes Folder and Open Themes Gallery commands to the bottom of the themes menu in the status bar
|
||||
<li>Added a Themes Gallery command to the Help menu, and renamed Discourse Forum to NetNewsWire Forum
|
||||
<li>Made the filename of an audio enclosure a link — it’s underlined in the Default, Gray, Plum, and Verdana Revival themes
|
||||
<li>Fixed duplicate images in brettterpstra.com articles
|
||||
<li>Skipped Blogger’s tiny thumbnail as an article’s primary image
|
||||
<li>Allowed thumbnail downloading in Low Data Mode
|
||||
<li>Made the activity log show every thumbnail download (not just failures), with the feed name and article title
|
||||
<li>Fixed bug where double-clicking an article in an inactive window could open the wrong article
|
||||
<li>Made double-clicking an article in an inactive window mark it as read
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Mon, 16 Nov 2026 09:40:00 -0800</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3b9/NetNewsWire7.3b9.zip" sparkle:version="7237" sparkle:shortVersionString="7.3b9" length="10472470" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3b8</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>Added Gray theme — inspired by newsprint design but not meant to be a literal copy
|
||||
<li>Added Plum theme — uses the same layout as the Gray theme but with color
|
||||
<li>Added an optional grayscaleIcon key to theme Info.plist files — when true, the feed icon or author avatar in the article view is grayscale. The Gray theme uses this new feature
|
||||
<li>Fixed a crash in the timeline (too many layout passes) caused by row-height measurement mixing up same articles from different accounts
|
||||
<li>Fixed bug where deleting a feed could remove the wrong row (usually the next row) from the sidebar
|
||||
<li>Fixed bug where restoring with no article selected, then clicking an article, would auto-scroll the article view
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Wed, 11 Nov 2026 17:30:00 -0800</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3b8/NetNewsWire7.3b8.zip" sparkle:version="7235" sparkle:shortVersionString="7.3b8" length="10472470" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3b7</title>
|
||||
<description><![CDATA[
|
||||
|
||||
@@ -7,6 +7,69 @@
|
||||
<language>en</language>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3.1</title>
|
||||
<description><![CDATA[
|
||||
<b>Changes since 7.3</b>
|
||||
<ul>
|
||||
<li>Fixed bug where smart feeds might not appear in the sidebar
|
||||
<li>Stopped refreshing Reddit feeds, since Reddit no longer offers RSS feeds
|
||||
<li>Renamed the feed notification setting to Notify About New Articles, in the inspector and in the sidebar’s contextual menu
|
||||
<li>Changed the Create button to Add when adding a Feedbin, NewsBlur, or Reader API account
|
||||
<li>Updated the Tiqoe Dark theme — styles for primary images, enclosures, and captions, and fixes for TechCrunch, Macworld, and the-ebook-reader articles
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Fri, 20 Nov 2026 09:00:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3.1/NetNewsWire7.3.1.zip" sparkle:version="7242" sparkle:shortVersionString="7.3.1" length="10473901" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3</title>
|
||||
<description><![CDATA[
|
||||
<b>Changes since 7.2.1</b>
|
||||
<ul>
|
||||
<li>Restored the status bar from NetNewsWire of Yore (NetNewsWire 1-3) pretty much exactly. Show and hide it via the View menu. Status bar includes a gear menu for various commands, a status report next to it (click to change what’s shown), current URL, and Themes menu. Clicking the progress indicator during a refresh opens the Current Activity window
|
||||
<li>Added an Appearance settings pane — appearance (system, light, or dark), sidebar text size, sidebar icons, which smart feeds to show (Today, All Unread, Starred), and the article theme and text size (moved from General)
|
||||
<li>Added a Timeline settings pane — text size, feed icons (automatic, always, or never), feed icon size, thumbnails, rows (full title with no preview, or title and preview in 1 to 6 lines), separators, fading read articles, and showing the feed name and date above the title (on by default)
|
||||
<li>Added a Grayscale icons setting to Settings > Appearance — for feed icons and author avatars (article thumbnails stay in color)
|
||||
<li>Made separators a regular setting (it was a hidden preference) — your existing choice carries over
|
||||
<li>Reorganized the View menu into sections — sidebar, timeline, status bar, and toolbar
|
||||
<li>Added a Themes Gallery command to the Help menu, and renamed Discourse Forum to NetNewsWire Forum
|
||||
<li>Made the main window’s split view dividers a little darker in light mode
|
||||
<li>Added article thumbnails to the timeline — choose large or small in Settings > Timeline. Default is none. (Works in standard layout but not column layout)
|
||||
<li>Made rows fit their content (variable row heights) in the timeline
|
||||
<li>Made timeline rows always show the author or feed name, instead of leaving that spot empty
|
||||
<li>Fixed bug where the last article in the timeline had a separator below it
|
||||
<li>Added support for enclosures and Media RSS
|
||||
<li>Added enclosures to the article view — you can see images from Mastodon feeds, play an MP3 or video, etc.
|
||||
<li>Made YouTube enclosures play in the privacy-enhanced YouTube player (youtube-nocookie.com)
|
||||
<li>Made the article view show plain text or media:description when an article has no HTML content
|
||||
<li>Used an item’s only Gravatar as its author’s avatar, even when the author name is a username
|
||||
<li>Made image downloading kinder to servers — honors Retry-After, waits after errors, and limits downloads to two at a time per host
|
||||
<li>Added Gray theme — inspired by newsprint design but not meant to be a literal copy
|
||||
<li>Added Plum theme — uses the same layout as the Gray theme but with color
|
||||
<li>Added [[primary_media]] and [[enclosures]] tags for themes — primary_media is the article’s main image, video, or audio from the feed, when the article’s HTML doesn’t already include it
|
||||
<li>Allowed themes to include a template7.3.html file, which is used in 7.3 and later instead of template.html
|
||||
<li>Added an optional grayscaleIcon key to theme Info.plist files — when true, the feed icon or author avatar in the article view is grayscale. The Gray theme uses this new feature
|
||||
<li>Updated the built-in themes to use [[primary_media]] and [[enclosures]]
|
||||
<li>Added netnewswire, feed, feeds, and x-netnewswire-feed as allowed link schemes in the article view — so clicking a link to install a theme (for instance) works
|
||||
<li>Fixed extra vertical space in MacRumors articles
|
||||
<li>Fixed inline footnotes in FreshRSS articles
|
||||
<li>Fixed embedded YouTube videos (and other iframes) not loading on sites that use Optimole lazy loading
|
||||
<li>Fixed blog.rust-lang.org articles — JavaScript is turned off for them, and their noscript content is shown
|
||||
<li>Fixed footnote popover positioning near the edge of the article view and after resizing the window on Duo
|
||||
<li>Fixed bug where deleting a feed could remove the wrong row (usually the next row) from the sidebar
|
||||
<li>Fixed bug where restoring with no article selected, then clicking an article, would auto-scroll the article view
|
||||
<li>Fixed bug where double-clicking an article in an inactive window could open the wrong article
|
||||
<li>Made double-clicking an article in an inactive window mark it as read
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Tue, 17 Nov 2026 21:40:00 -0800</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3/NetNewsWire7.3.zip" sparkle:version="7239" sparkle:shortVersionString="7.3" length="10472470" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.2.1</title>
|
||||
<description><![CDATA[
|
||||
Changes since 7.2:
|
||||
|
||||
@@ -2,10 +2,140 @@
|
||||
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
|
||||
<channel>
|
||||
<title>NetNewsWire Betas</title>
|
||||
<link>https://ranchero.com/downloads/netnewswire6-beta.xml</link>
|
||||
<link>https://ranchero.com/downloads/netnewswire-beta.xml</link>
|
||||
<description>Most recent NetNewsWire changes with links to updates.</description>
|
||||
<language>en</language>
|
||||
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.4b1</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>Added Miniflux syncing — sign in with a username and password or an API token. Thanks to Dave Marquard (who also does the awesome NetNewsWire themes site) for this feature!
|
||||
<li>Made the article view inspectable with Safari’s Web Inspector
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Fri, 27 Nov 2026 20:15:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.4b1/NetNewsWire7.4b1.zip" sparkle:version="7245" sparkle:shortVersionString="7.4b1" length="10731329" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3.1</title>
|
||||
<description><![CDATA[
|
||||
<b>Changes since 7.3</b>
|
||||
<ul>
|
||||
<li>Fixed bug where smart feeds might not appear in the sidebar
|
||||
<li>Stopped refreshing Reddit feeds, since Reddit no longer offers RSS feeds
|
||||
<li>Renamed the feed notification setting to Notify About New Articles, in the inspector and in the sidebar’s contextual menu
|
||||
<li>Changed the Create button to Add when adding a Feedbin, NewsBlur, or Reader API account
|
||||
<li>Updated the Tiqoe Dark theme — styles for primary images, enclosures, and captions, and fixes for TechCrunch, Macworld, and the-ebook-reader articles
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Fri, 20 Nov 2026 09:00:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3.1/NetNewsWire7.3.1.zip" sparkle:version="7242" sparkle:shortVersionString="7.3.1" length="10473901" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3.1b1</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>Fixed bug where smart feeds might not appear in the sidebar
|
||||
<li>Stopped refreshing Reddit feeds, since Reddit no longer offers RSS feeds
|
||||
<li>Renamed the feed notification setting to Notify About New Articles, in the inspector and in the sidebar’s contextual menu
|
||||
<li>Changed the Create button to Add when adding a Feedbin, NewsBlur, or Reader API account
|
||||
<li>Updated the Tiqoe Dark theme — styles for primary images, enclosures, and captions, and fixes for TechCrunch, Macworld, and the-ebook-reader articles
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Thu, 19 Nov 2026 08:55:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3.1b1/NetNewsWire7.3.1b1.zip" sparkle:version="7240" sparkle:shortVersionString="7.3.1b1" length="10473891" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3</title>
|
||||
<description><![CDATA[
|
||||
<b>Changes since 7.2.1</b>
|
||||
<ul>
|
||||
<li>Restored the status bar from NetNewsWire of Yore (NetNewsWire 1-3) pretty much exactly. Show and hide it via the View menu. Status bar includes a gear menu for various commands, a status report next to it (click to change what’s shown), current URL, and Themes menu. Clicking the progress indicator during a refresh opens the Current Activity window
|
||||
<li>Added an Appearance settings pane — appearance (system, light, or dark), sidebar text size, sidebar icons, which smart feeds to show (Today, All Unread, Starred), and the article theme and text size (moved from General)
|
||||
<li>Added a Timeline settings pane — text size, feed icons (automatic, always, or never), feed icon size, thumbnails, rows (full title with no preview, or title and preview in 1 to 6 lines), separators, fading read articles, and showing the feed name and date above the title (on by default)
|
||||
<li>Added a Grayscale icons setting to Settings > Appearance — for feed icons and author avatars (article thumbnails stay in color)
|
||||
<li>Made separators a regular setting (it was a hidden preference) — your existing choice carries over
|
||||
<li>Reorganized the View menu into sections — sidebar, timeline, status bar, and toolbar
|
||||
<li>Added a Themes Gallery command to the Help menu, and renamed Discourse Forum to NetNewsWire Forum
|
||||
<li>Made the main window’s split view dividers a little darker in light mode
|
||||
<li>Added article thumbnails to the timeline — choose large or small in Settings > Timeline. Default is none. (Works in standard layout but not column layout)
|
||||
<li>Made rows fit their content (variable row heights) in the timeline
|
||||
<li>Made timeline rows always show the author or feed name, instead of leaving that spot empty
|
||||
<li>Fixed bug where the last article in the timeline had a separator below it
|
||||
<li>Added support for enclosures and Media RSS
|
||||
<li>Added enclosures to the article view — you can see images from Mastodon feeds, play an MP3 or video, etc.
|
||||
<li>Made YouTube enclosures play in the privacy-enhanced YouTube player (youtube-nocookie.com)
|
||||
<li>Made the article view show plain text or media:description when an article has no HTML content
|
||||
<li>Used an item’s only Gravatar as its author’s avatar, even when the author name is a username
|
||||
<li>Made image downloading kinder to servers — honors Retry-After, waits after errors, and limits downloads to two at a time per host
|
||||
<li>Added Gray theme — inspired by newsprint design but not meant to be a literal copy
|
||||
<li>Added Plum theme — uses the same layout as the Gray theme but with color
|
||||
<li>Added [[primary_media]] and [[enclosures]] tags for themes — primary_media is the article’s main image, video, or audio from the feed, when the article’s HTML doesn’t already include it
|
||||
<li>Allowed themes to include a template7.3.html file, which is used in 7.3 and later instead of template.html
|
||||
<li>Added an optional grayscaleIcon key to theme Info.plist files — when true, the feed icon or author avatar in the article view is grayscale. The Gray theme uses this new feature
|
||||
<li>Updated the built-in themes to use [[primary_media]] and [[enclosures]]
|
||||
<li>Added netnewswire, feed, feeds, and x-netnewswire-feed as allowed link schemes in the article view — so clicking a link to install a theme (for instance) works
|
||||
<li>Fixed extra vertical space in MacRumors articles
|
||||
<li>Fixed inline footnotes in FreshRSS articles
|
||||
<li>Fixed embedded YouTube videos (and other iframes) not loading on sites that use Optimole lazy loading
|
||||
<li>Fixed blog.rust-lang.org articles — JavaScript is turned off for them, and their noscript content is shown
|
||||
<li>Fixed footnote popover positioning near the edge of the article view and after resizing the window on Duo
|
||||
<li>Fixed bug where deleting a feed could remove the wrong row (usually the next row) from the sidebar
|
||||
<li>Fixed bug where restoring with no article selected, then clicking an article, would auto-scroll the article view
|
||||
<li>Fixed bug where double-clicking an article in an inactive window could open the wrong article
|
||||
<li>Made double-clicking an article in an inactive window mark it as read
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Tue, 17 Nov 2026 21:40:00 -0800</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3/NetNewsWire7.3.zip" sparkle:version="7239" sparkle:shortVersionString="7.3" length="10472470" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3b9</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>Added Open Themes Folder and Open Themes Gallery commands to the bottom of the themes menu in the status bar
|
||||
<li>Added a Themes Gallery command to the Help menu, and renamed Discourse Forum to NetNewsWire Forum
|
||||
<li>Made the filename of an audio enclosure a link — it’s underlined in the Default, Gray, Plum, and Verdana Revival themes
|
||||
<li>Fixed duplicate images in brettterpstra.com articles
|
||||
<li>Skipped Blogger’s tiny thumbnail as an article’s primary image
|
||||
<li>Allowed thumbnail downloading in Low Data Mode
|
||||
<li>Made the activity log show every thumbnail download (not just failures), with the feed name and article title
|
||||
<li>Fixed bug where double-clicking an article in an inactive window could open the wrong article
|
||||
<li>Made double-clicking an article in an inactive window mark it as read
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Mon, 16 Nov 2026 09:40:00 -0800</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3b9/NetNewsWire7.3b9.zip" sparkle:version="7237" sparkle:shortVersionString="7.3b9" length="10472470" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3b8</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>Added Gray theme — inspired by newsprint design but not meant to be a literal copy
|
||||
<li>Added Plum theme — uses the same layout as the Gray theme but with color
|
||||
<li>Added an optional grayscaleIcon key to theme Info.plist files — when true, the feed icon or author avatar in the article view is grayscale. The Gray theme uses this new feature
|
||||
<li>Fixed a crash in the timeline (too many layout passes) caused by row-height measurement mixing up same articles from different accounts
|
||||
<li>Fixed bug where deleting a feed could remove the wrong row (usually the next row) from the sidebar
|
||||
<li>Fixed bug where restoring with no article selected, then clicking an article, would auto-scroll the article view
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Wed, 11 Nov 2026 17:30:00 -0800</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.3b8/NetNewsWire7.3b8.zip" sparkle:version="7235" sparkle:shortVersionString="7.3b8" length="10472470" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.3b7</title>
|
||||
<description><![CDATA[
|
||||
@@ -157,6 +287,88 @@ Changes since 7.2:
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.2</title>
|
||||
<description><![CDATA[
|
||||
In case you missed 7.2b1 — note the new <code>View > Use Column Layout</code> menu item. Also note the new setting for unread counts at the top of the General (first) settings tab.
|
||||
<p>
|
||||
Changes since 7.2b4:
|
||||
<ul>
|
||||
<li>Fixed column view bug where next-unread could scroll to a row that’s hidden under the column headers
|
||||
</ul>
|
||||
Changes since 7.1.5:
|
||||
<ul>
|
||||
<li>Added unread count display setting — show the count, show a dot, or hide it — which applies to the Dock icon badge, window title, and sidebar
|
||||
<li>Added column layout for the timeline — choose View > Use Column Layout
|
||||
<li>Expanded View > Sort Articles By with more options (works with standard and column layouts)
|
||||
<li>Made timeline sorting per window instead of one setting for the whole app
|
||||
<li>Made the Add Feed sheet start with the folder or account selected in the sidebar
|
||||
<li>Changed the message for adding a feed that’s already added to include the name of the folder (or folders)
|
||||
<li>Fixed bug where YouTube embeds in articles showed an error instead of playing
|
||||
<li>Fixed bug where embedded videos with no set height — such as Inoreader’s YouTube player — collapsed to a short strip
|
||||
<li>Fixed extra whitespace at the end of Slashdot articles and paragraphs running together
|
||||
<li>Fixed parsing of RSS feed titles when a feed contains a textinput section (Slashdot, for instance)
|
||||
<li>Added support for the instapaper_ignore class — elements marked with it are now removed from articles
|
||||
<li>Changed tabs in pre and code elements in articles to display as four spaces
|
||||
<li>Improved finding feeds in a page by skipping links to PDFs, movies, and other files that can’t be feeds
|
||||
<li>Changed finding a feed to use the redirected-to URL
|
||||
<li>Sped up Today and unread count queries
|
||||
<li>Added up to 500 characters of the HTTP error response body to Error Log entries
|
||||
<li>Fixed bug where the sidebar could reopen with no width when it had been collapsed in 7.1.x
|
||||
<li>Fixed a memory leak when closing a main window
|
||||
<li>Fixed a possible crash when the sidebar or timeline had no visible rows
|
||||
<li>Changed sorting by title and by feed to sort numbers by value — “Episode 2” comes before “Episode 10”
|
||||
<li>Added support for Substack-style footnotes
|
||||
<li>Improved CJK text rendering in the article view by adding text-autospace
|
||||
<li>Fixed horizontal overflow of WordPress Math blocks and SVGs in the Tiqoe Dark theme
|
||||
<li>Improved font sizing and fixed superscript orphans in table cells in the Tiqoe Dark theme`
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Wed, 14 Oct 2026 08:20:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.2/NetNewsWire7.2.zip" sparkle:version="7222" sparkle:shortVersionString="7.2" length="10000415" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.2b4</title>
|
||||
<description><![CDATA[
|
||||
In case you missed 7.2b1 — note the new <code>View > Use Column Layout</code> menu item. Also note the new setting for unread counts at the top of the General (first) settings tab.
|
||||
<p>
|
||||
Changes since 7.2b3:
|
||||
<ul>
|
||||
<li>Fixed bug where embedded videos with no set height — such as Inoreader’s YouTube player — collapsed to a short strip
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Sun, 11 Oct 2026 11:10:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.2b4/NetNewsWire7.2b4.zip" sparkle:version="7221" sparkle:shortVersionString="7.2b4" length="9999900" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.2b3</title>
|
||||
<description><![CDATA[
|
||||
In case you missed 7.2b1 — note the new <code>View > Use Column Layout</code> menu item. Also note the new setting for unread counts at the top of the General (first) settings tab.
|
||||
<p>
|
||||
Changes since 7.2b2:
|
||||
<ul>
|
||||
<li>Fixed the Settings layout on macOS 15
|
||||
<li>Added Spanish translations for Settings and the Sort Articles By menu
|
||||
<li>Made each Settings pane size itself to fit, for languages that need more room
|
||||
<li>Fixed bug where the sidebar could reopen with no width when it had been collapsed in 7.1.x
|
||||
<li>Fixed a memory leak when closing a main window
|
||||
<li>Fixed a possible crash when the sidebar or timeline had no visible rows
|
||||
<li>Changed sorting by title and by feed to sort numbers by value — “Episode 2” comes before “Episode 10”
|
||||
<li>Improved finding feeds in a page by skipping links to X, Twitter, Facebook, and Instagram, and links to files with uppercase extensions or URL queries (such as .PDF or .jpg?w=600)
|
||||
<li>Fixed bug where some sites with “youtube” in their names were treated as YouTube
|
||||
<li>Fixed Slashdot feed detection (for Slashdot special cases) when the feed comes through a proxy such as FeedBurner
|
||||
<li>Changed VoiceOver to say “unread” for sidebar unread counts shown as dots
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>Sat, 10 Oct 2026 09:05:00 -0700</pubDate>
|
||||
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.2b3/NetNewsWire7.2b3.zip" sparkle:version="7220" sparkle:shortVersionString="7.2b3" length="9999861" type="application/zip" />
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.2b2</title>
|
||||
<description><![CDATA[
|
||||
@@ -214,6 +426,7 @@ Changes since 7.2b1:
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>NetNewsWire 7.1.4</title>
|
||||
<description><![CDATA[
|
||||
|
||||
@@ -33,7 +33,6 @@ enum StatusBarCountMode: Int {
|
||||
}
|
||||
|
||||
extension AppDefaults.Key {
|
||||
static let legacyWindowState = "windowState"
|
||||
static let secureWindowState = "secureWindowState"
|
||||
static let useColumnLayout = "useColumnLayout"
|
||||
static let timelineShowSeparators = "timelineShowSeparators"
|
||||
@@ -60,18 +59,6 @@ extension AppDefaults.Key {
|
||||
|
||||
extension AppDefaults {
|
||||
|
||||
/// Stores window state prior to switching to secure state restoration.
|
||||
///
|
||||
/// This is referenced temporarily, only to be able to provide migration from legacy to secure window state.
|
||||
/// TODO: delete for NetNewsWire 7.
|
||||
static var legacyWindowState: [AnyHashable: Any]? {
|
||||
UserDefaults.standard.object(forKey: Key.legacyWindowState) as? [AnyHashable: Any]
|
||||
}
|
||||
|
||||
static func deleteLegacyWindowState() {
|
||||
UserDefaults.standard.removeObject(forKey: Key.legacyWindowState)
|
||||
}
|
||||
|
||||
static var secureWindowState: Data? {
|
||||
get {
|
||||
UserDefaults.standard.object(forKey: Key.secureWindowState) as? Data
|
||||
@@ -263,9 +250,6 @@ extension AppDefaults {
|
||||
static var refreshInterval: RefreshInterval {
|
||||
get {
|
||||
let rawValue = UserDefaults.standard.integer(forKey: Key.refreshInterval)
|
||||
if rawValue == 2 { // Old every-10-minutes setting — now using 30 minutes as minimum.
|
||||
return .every30Minutes
|
||||
}
|
||||
return RefreshInterval(rawValue: rawValue) ?? .every2Hours
|
||||
}
|
||||
set {
|
||||
@@ -274,12 +258,6 @@ extension AppDefaults {
|
||||
}
|
||||
|
||||
@MainActor static func registerDefaults() {
|
||||
// Migrate every-10-minute refresh interval to 30 minutes.
|
||||
let rawValue = UserDefaults.standard.integer(forKey: Key.refreshInterval)
|
||||
if rawValue == 2 {
|
||||
UserDefaults.standard.set(RefreshInterval.every30Minutes.rawValue, forKey: Key.refreshInterval)
|
||||
}
|
||||
|
||||
migrateLegacyTimelineShowSeparators()
|
||||
|
||||
#if DEBUG
|
||||
|
||||
@@ -117,6 +117,9 @@ let appName = "NetNewsWire"
|
||||
self.crashReporter = crashReporter
|
||||
}
|
||||
|
||||
// Register before window restoration, which happens before applicationDidFinishLaunching.
|
||||
AppDefaults.registerDefaults()
|
||||
|
||||
AccountManager.shared.start()
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: AccountManager.shared)
|
||||
@@ -183,7 +186,6 @@ let appName = "NetNewsWire"
|
||||
Self.logger.error("Failed to start software updater with error: \(error.localizedDescription)")
|
||||
}
|
||||
|
||||
AppDefaults.registerDefaults()
|
||||
let isFirstRun = AppDefaults.isFirstRun
|
||||
if isFirstRun {
|
||||
Self.logger.debug("Is first run.")
|
||||
@@ -721,6 +723,10 @@ let appName = "NetNewsWire"
|
||||
HelpURL.discourse.open()
|
||||
}
|
||||
|
||||
@IBAction func openThemesGallery(_ sender: Any?) {
|
||||
HelpURL.themesGallery.open()
|
||||
}
|
||||
|
||||
@IBAction func showHelp(_ sender: Any?) {
|
||||
HelpURL.helpHome.open()
|
||||
}
|
||||
@@ -839,13 +845,13 @@ extension AppDelegate {
|
||||
accountStatsWindowController?.showWindow(self)
|
||||
}
|
||||
|
||||
@IBAction func showiCloudDriveMissingAlert(_ sender: Any?) {
|
||||
@IBAction func showiCloudUnavailableAlert(_ sender: Any?) {
|
||||
// Manual testing for alert in AccountsAddCloudKitWindowController
|
||||
// Check for:
|
||||
// - Expected text
|
||||
// - Button for opening Settings
|
||||
// - Button works
|
||||
mainWindowController?.presentError(AddCloudKitAccountError.iCloudDriveMissing)
|
||||
mainWindowController?.presentError(AddCloudKitAccountError.iCloudUnavailable)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</textField>
|
||||
<button horizontalHuggingPriority="1000" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="ZBX-E8-k9c">
|
||||
<rect key="frame" x="20" y="154" width="231" height="16"/>
|
||||
<buttonCell key="cell" type="check" title="Show notifications for new articles" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Bw5-c7-yDX">
|
||||
<buttonCell key="cell" type="check" title="Notify about new articles" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Bw5-c7-yDX">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
|
||||
@@ -175,7 +175,6 @@ private extension FeedInspectorViewController {
|
||||
}
|
||||
|
||||
func updateNewArticleNotificationsEnabled() {
|
||||
newArticleNotificationsEnabledCheckBox?.title = feed?.notificationDisplayName ?? NSLocalizedString("Show notifications for new articles", comment: "Show notifications for new articles")
|
||||
newArticleNotificationsEnabledCheckBox?.state = (feed?.newArticleNotificationsEnabled ?? false) ? .on : .off
|
||||
}
|
||||
|
||||
|
||||
@@ -20,19 +20,19 @@
|
||||
}
|
||||
},
|
||||
"Bw5-c7-yDX.title" : {
|
||||
"comment" : "Class = \"NSButtonCell\"; title = \"Show notifications for new articles\"; ObjectID = \"Bw5-c7-yDX\";",
|
||||
"comment" : "Class = \"NSButtonCell\"; title = \"Notify about new articles\"; ObjectID = \"Bw5-c7-yDX\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Show notifications for new articles"
|
||||
"value" : "Notify about new articles"
|
||||
}
|
||||
},
|
||||
"es" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Mostrar notificaciones de artículos nuevos"
|
||||
"value" : "Notificar sobre artículos nuevos"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,10 +591,10 @@
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="dgO-u4-aEs"/>
|
||||
<menuItem title="Show iCloud Drive Missing Alert" id="m0T-w3-neT">
|
||||
<menuItem title="Show iCloud Unavailable Alert" id="m0T-w3-neT">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="showiCloudDriveMissingAlert:" target="-1" id="kfQ-dM-8vB"/>
|
||||
<action selector="showiCloudUnavailableAlert:" target="-1" id="kfQ-dM-8vB"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="AQO-MD-QVj"/>
|
||||
@@ -718,6 +718,18 @@
|
||||
<action selector="openWebsite:" target="-1" id="rmL-lt-p8g"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="NetNewsWire Forum" id="OKC-FV-V33">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openDiscourse:" target="-1" id="pHL-0j-vVt"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Themes Gallery" id="TgL-mK-7pQ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openThemesGallery:" target="-1" id="hW3-zR-9sN"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Release Notes" id="b5s-xg-B1w" userLabel="Release Notes">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
@@ -742,12 +754,6 @@
|
||||
<action selector="openBugTracker:" target="-1" id="fZQ-ng-gIm"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Discourse Forum" id="OKC-FV-V33">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openDiscourse:" target="-1" id="pHL-0j-vVt"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
|
||||
@@ -1298,19 +1298,19 @@
|
||||
}
|
||||
},
|
||||
"m0T-w3-neT.title" : {
|
||||
"comment" : "Class = \"NSMenuItem\"; title = \"Show iCloud Drive Missing Alert\"; ObjectID = \"m0T-w3-neT\";",
|
||||
"comment" : "Class = \"NSMenuItem\"; title = \"Show iCloud Unavailable Alert\"; ObjectID = \"m0T-w3-neT\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Show iCloud Drive Missing Alert"
|
||||
"value" : "Show iCloud Unavailable Alert"
|
||||
}
|
||||
},
|
||||
"es" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Mostrar alerta de iCloud Drive no disponible"
|
||||
"value" : "Mostrar alerta de iCloud no disponible"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1442,19 +1442,19 @@
|
||||
}
|
||||
},
|
||||
"OKC-FV-V33.title" : {
|
||||
"comment" : "Class = \"NSMenuItem\"; title = \"Discourse Forum\"; ObjectID = \"OKC-FV-V33\";",
|
||||
"comment" : "Class = \"NSMenuItem\"; title = \"NetNewsWire Forum\"; ObjectID = \"OKC-FV-V33\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Discourse Forum"
|
||||
"value" : "NetNewsWire Forum"
|
||||
}
|
||||
},
|
||||
"es" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Foro de Discourse"
|
||||
"value" : "Foro de NetNewsWire"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2005,6 +2005,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"TgL-mK-7pQ.title" : {
|
||||
"comment" : "Class = \"NSMenuItem\"; title = \"Themes Gallery\"; ObjectID = \"TgL-mK-7pQ\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Themes Gallery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"TNS-TV-n0U.title" : {
|
||||
"comment" : "Class = \"NSMenuItem\"; title = \"Descending\"; ObjectID = \"TNS-TV-n0U\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
|
||||
@@ -10,7 +10,7 @@ import AppKit
|
||||
|
||||
/// The split between the timeline and the article view in column layout.
|
||||
/// On macOS 26 it extends under the sidebar, so the divider is drawn in the visible part only — otherwise the dimple is off-center.
|
||||
final class ColumnLayoutSplitView: MainWindowSplitView {
|
||||
final class ColumnLayoutSplitView: NSSplitView {
|
||||
|
||||
override func drawDivider(in rect: NSRect) {
|
||||
super.drawDivider(in: rect.intersection(safeAreaRect))
|
||||
|
||||
@@ -12,26 +12,24 @@ import RSCore
|
||||
|
||||
final class DetailWebView: WKWebView {
|
||||
weak var keyboardDelegate: KeyboardDelegate?
|
||||
private var isObservingResizeNotifications = false
|
||||
private var contentLayoutRectObservation: NSKeyValueObservation?
|
||||
|
||||
private static let estimatedToolbarHeight: CGFloat = 52 // Height of macOS 26.2 icon-only toolbar
|
||||
|
||||
// How much of the web view sits under the titlebar and toolbar: the toolbar height when the article view
|
||||
// How much of the web view sits under the titlebar and toolbar: the titlebar and toolbar height when the article view
|
||||
// is beside the timeline, zero when it’s below the timeline in column layout.
|
||||
private var obscuredTopInset: CGFloat {
|
||||
guard let window, let toolbar = window.toolbar, toolbar.isVisible, superview != nil else {
|
||||
return lastObscuredTopInset ?? Self.estimatedToolbarHeight
|
||||
guard let window, superview != nil else {
|
||||
return Self.estimatedToolbarHeight
|
||||
}
|
||||
|
||||
let frameInWindow = convert(bounds, to: nil)
|
||||
let inset = max(0.0, frameInWindow.maxY - window.contentLayoutRect.maxY)
|
||||
lastObscuredTopInset = inset
|
||||
return inset
|
||||
return max(0.0, frameInWindow.maxY - window.contentLayoutRect.maxY)
|
||||
}
|
||||
private var lastObscuredTopInset: CGFloat?
|
||||
|
||||
override init(frame: CGRect, configuration: WKWebViewConfiguration) {
|
||||
super.init(frame: frame, configuration: configuration)
|
||||
isInspectable = true
|
||||
updateObscuredContentInsets()
|
||||
}
|
||||
|
||||
@@ -58,21 +56,14 @@ final class DetailWebView: WKWebView {
|
||||
super.viewDidMoveToWindow()
|
||||
updateObscuredContentInsets()
|
||||
|
||||
if let window, !isObservingResizeNotifications {
|
||||
NotificationCenter.default.addObserver(
|
||||
self,
|
||||
selector: #selector(windowDidResize(_:)),
|
||||
name: NSWindow.didResizeNotification,
|
||||
object: window
|
||||
)
|
||||
isObservingResizeNotifications = true
|
||||
// contentLayoutRect changes when the window resizes and when the toolbar is shown or hidden.
|
||||
contentLayoutRectObservation = window?.observe(\.contentLayoutRect) { [weak self] _, _ in
|
||||
Task { @MainActor in
|
||||
self?.updateObscuredContentInsets()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc func windowDidResize(_ notification: Notification) {
|
||||
updateObscuredContentInsets()
|
||||
}
|
||||
|
||||
override func layout() {
|
||||
super.layout()
|
||||
// The frame moves when the layout switches or the split view divider is dragged.
|
||||
|
||||
@@ -27,7 +27,6 @@ final class MainWindowController: NSWindowController, NSUserInterfaceValidations
|
||||
private var sharingServicePickerDelegate: SharingServicePickerDelegate?
|
||||
|
||||
private let windowAutosaveName = NSWindow.FrameAutosaveName("MainWindow")
|
||||
private static let mainWindowWidthsStateKey = "mainWindowWidthsStateKey"
|
||||
|
||||
private var currentFeedOrFolder: AnyObject? {
|
||||
// Nil for none or multiple selection.
|
||||
@@ -181,11 +180,6 @@ final class MainWindowController: NSWindowController, NSUserInterfaceValidations
|
||||
Self.logger.debug("MainWindowController: restoring state from UserDefaults: \(state)")
|
||||
window?.setFrameUsingName(windowAutosaveName, force: true)
|
||||
restoreState(from: state)
|
||||
} else if let state = AppDefaults.legacyWindowState {
|
||||
// Migrate from previous window state data. Delete data when finished.
|
||||
window?.setFrameUsingName(windowAutosaveName, force: true)
|
||||
restoreLegacyState(from: state)
|
||||
AppDefaults.deleteLegacyWindowState()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1270,7 +1264,7 @@ private extension MainWindowController {
|
||||
return (splitViewController, contentSplitViewController)
|
||||
}
|
||||
|
||||
func makeEmptySplitViewController(isVertical: Bool, splitView: NSSplitView = MainWindowSplitView()) -> NSSplitViewController {
|
||||
func makeEmptySplitViewController(isVertical: Bool, splitView: NSSplitView = NSSplitView()) -> NSSplitViewController {
|
||||
let splitViewController = NSSplitViewController()
|
||||
splitViewController.splitView = splitView
|
||||
splitViewController.splitView.isVertical = isVertical
|
||||
@@ -1435,32 +1429,6 @@ private extension MainWindowController {
|
||||
}
|
||||
}
|
||||
|
||||
/// Restore state using pre-secure-state-restoration data.
|
||||
///
|
||||
/// It’s up to the caller to call this only when:
|
||||
/// 1. Legacy state exists, and
|
||||
/// 2. Secure state data does not exist.
|
||||
///
|
||||
/// TODO: delete this for NetNewsWire 7.
|
||||
func restoreLegacyState(from state: [AnyHashable: Any]) {
|
||||
if let fullScreen = state[UserInfoKey.windowFullScreenState] as? Bool, fullScreen {
|
||||
window?.toggleFullScreen(self)
|
||||
}
|
||||
restoreLegacySplitViewState(from: state)
|
||||
|
||||
sidebarViewController?.restoreLegacyState(from: state)
|
||||
|
||||
let articleWindowScrollY = state[UserInfoKey.articleWindowScrollY] as? CGFloat
|
||||
restoreArticleWindowScrollY = articleWindowScrollY
|
||||
timelineContainerViewController?.restoreLegacyState(from: state)
|
||||
|
||||
let isShowingExtractedArticle = state[UserInfoKey.isShowingExtractedArticle] as? Bool ?? false
|
||||
if isShowingExtractedArticle {
|
||||
restoreArticleWindowScrollY = articleWindowScrollY
|
||||
startArticleExtractorForCurrentLink()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Command Validation
|
||||
|
||||
func canCopyArticleURL() -> Bool {
|
||||
@@ -1783,37 +1751,6 @@ private extension MainWindowController {
|
||||
sidebarSplitViewItem?.isCollapsed = state.isSidebarHidden
|
||||
}
|
||||
|
||||
/// Restore main window split view using legacy state restoration data.
|
||||
///
|
||||
/// TODO: Delete this for NetNewsWire 7.
|
||||
func restoreLegacySplitViewState(from state: [AnyHashable: Any]) {
|
||||
guard let splitView = splitViewController?.splitView,
|
||||
let widths = state[MainWindowController.mainWindowWidthsStateKey] as? [Int],
|
||||
widths.count == 3,
|
||||
let window = window else {
|
||||
return
|
||||
}
|
||||
|
||||
let windowWidth = Int(floor(window.frame.width))
|
||||
let dividerThickness: Int = Int(splitView.dividerThickness)
|
||||
let sidebarWidth: Int = widths[0]
|
||||
let timelineWidth: Int = widths[1]
|
||||
|
||||
// Make sure the detail view has its minimum thickness, at least.
|
||||
if windowWidth < sidebarWidth + dividerThickness + timelineWidth + dividerThickness + Self.detailViewMinimumWidth {
|
||||
return
|
||||
}
|
||||
|
||||
rememberedStandardLayoutWidths = widths
|
||||
applyRememberedGeometry()
|
||||
|
||||
let isSidebarHidden = state[UserInfoKey.isSidebarHidden] as? Bool ?? false
|
||||
|
||||
if !(sidebarSplitViewItem?.isCollapsed ?? false) && isSidebarHidden {
|
||||
sidebarSplitViewItem?.isCollapsed = true
|
||||
}
|
||||
}
|
||||
|
||||
func buildToolbarButton(_ itemIdentifier: NSToolbarItem.Identifier, _ title: String, _ image: NSImage, _ selector: String) -> NSToolbarItem {
|
||||
let toolbarItem = RSToolbarItem(itemIdentifier: itemIdentifier)
|
||||
toolbarItem.autovalidates = true
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
//
|
||||
// MainWindowSplitView.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 11/7/26.
|
||||
// Copyright © 2026 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
|
||||
/// The main window’s split views. In light mode, the dividers are a little darker than the system’s.
|
||||
class MainWindowSplitView: NSSplitView {
|
||||
|
||||
private static let lightDividerColor = NSColor(srgbRed: 200 / 255, green: 200 / 255, blue: 200 / 255, alpha: 1)
|
||||
|
||||
override var dividerColor: NSColor {
|
||||
if effectiveAppearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua {
|
||||
return super.dividerColor
|
||||
}
|
||||
return Self.lightDividerColor
|
||||
}
|
||||
}
|
||||
@@ -260,7 +260,7 @@ private extension SidebarViewController {
|
||||
}
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
|
||||
let notificationText = feed.notificationDisplayName.capitalized
|
||||
let notificationText = NSLocalizedString("Notify About New Articles", comment: "Notify About New Articles")
|
||||
|
||||
let notificationMenuItem = menuItem(notificationText, #selector(toggleNotificationsFromContextMenu(_:)), feed)
|
||||
notificationMenuItem.state = feed.newArticleNotificationsEnabled ? .on : .off
|
||||
|
||||
@@ -172,49 +172,6 @@ extension Notification.Name {
|
||||
isReadFiltered = state.isReadFiltered
|
||||
}
|
||||
|
||||
/// Restore state using legacy state restoration data.
|
||||
///
|
||||
/// TODO: Delete for NetNewsWire 7.
|
||||
func restoreLegacyState(from state: [AnyHashable: Any]) {
|
||||
|
||||
if let containerExpandedWindowState = state[UserInfoKey.containerExpandedWindowState] as? [[AnyHashable: AnyHashable]] {
|
||||
let containerIdentifiers = containerExpandedWindowState.compactMap( { ContainerIdentifier(userInfo: $0) })
|
||||
expandedTable = Set(containerIdentifiers)
|
||||
}
|
||||
|
||||
guard let selectedFeedsState = state[UserInfoKey.selectedFeedsState] as? [[String: String]] else {
|
||||
return
|
||||
}
|
||||
|
||||
let selectedFeedIdentifiers = Set(selectedFeedsState.compactMap( { SidebarItemIdentifier(userInfo: $0) }))
|
||||
for identifier in selectedFeedIdentifiers {
|
||||
treeControllerDelegate.addFilterException(identifier)
|
||||
}
|
||||
|
||||
rebuildTreeAndReloadDataIfNeeded()
|
||||
|
||||
var selectIndexes = IndexSet()
|
||||
|
||||
func selectFeedsVisitor(node: Node) {
|
||||
if let sidebarItemID = (node.representedObject as? SidebarItemIdentifiable)?.sidebarItemID {
|
||||
if selectedFeedIdentifiers.contains(sidebarItemID) {
|
||||
let row = outlineView.row(forItem: node)
|
||||
if row >= 0 {
|
||||
selectIndexes.insert(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
treeController.visitNodes(selectFeedsVisitor(node:))
|
||||
outlineView.selectRowIndexes(selectIndexes, byExtendingSelection: false)
|
||||
focus()
|
||||
|
||||
if let readFeedsFilterState = state[UserInfoKey.readFeedsFilterState] as? Bool {
|
||||
isReadFiltered = readFeedsFilterState
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
|
||||
@objc func unreadCountDidInitialize(_ notification: Notification) {
|
||||
|
||||
@@ -283,6 +283,16 @@ final class MainWindowStatusBarView: NSView {
|
||||
@objc func showActivityWindow(_ sender: Any?) {
|
||||
NSApp.sendAction(#selector(AppDelegate.showActivityWindow(_:)), to: nil, from: self)
|
||||
}
|
||||
|
||||
@objc func openThemesFolder(_ sender: Any?) {
|
||||
NSWorkspace.shared.open(URL(fileURLWithPath: ArticleThemesManager.shared.folderPath))
|
||||
selectCurrentThemeInPopUpButton()
|
||||
}
|
||||
|
||||
@objc func openThemesGallery(_ sender: Any?) {
|
||||
HelpURL.themesGallery.open()
|
||||
selectCurrentThemeInPopUpButton()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - NSMenuItemValidation
|
||||
@@ -515,11 +525,26 @@ private extension MainWindowStatusBarView {
|
||||
// MARK: - Theme
|
||||
|
||||
func updateThemePopUpButton() {
|
||||
themePopUpButton.menu = ArticleThemesManager.shared.makeArticleThemeMenu()
|
||||
themePopUpButton.selectItem(withTitle: ArticleThemesManager.shared.currentThemeName)
|
||||
let menu = ArticleThemesManager.shared.makeArticleThemeMenu()
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
addThemeCommand(to: menu, title: NSLocalizedString("Open Themes Folder", comment: "Open Themes Folder"), action: #selector(openThemesFolder(_:)))
|
||||
addThemeCommand(to: menu, title: NSLocalizedString("Open Themes Gallery", comment: "Open Themes Gallery"), action: #selector(openThemesGallery(_:)))
|
||||
themePopUpButton.menu = menu
|
||||
selectCurrentThemeInPopUpButton()
|
||||
updateThemePopUpButtonVisibility()
|
||||
}
|
||||
|
||||
func addThemeCommand(to menu: NSMenu, title: String, action: Selector) {
|
||||
let menuItem = NSMenuItem(title: title, action: action, keyEquivalent: "")
|
||||
menuItem.target = self
|
||||
menu.addItem(menuItem)
|
||||
}
|
||||
|
||||
/// Choosing a command in the pop-up button selects it, so this puts the current theme back.
|
||||
func selectCurrentThemeInPopUpButton() {
|
||||
themePopUpButton.selectItem(withTitle: ArticleThemesManager.shared.currentThemeName)
|
||||
}
|
||||
|
||||
/// Etches the pop-up button’s title and arrows. A view’s shadow doesn’t follow appearance changes, so it’s resolved here.
|
||||
func updateThemePopUpButtonShadow() {
|
||||
let shadow = NSShadow()
|
||||
|
||||
@@ -188,14 +188,6 @@ final class TimelineContainerViewController: NSViewController {
|
||||
regularTimelineViewController.restoreState(from: state)
|
||||
updateReadFilterButton()
|
||||
}
|
||||
|
||||
/// Restore state using legacy state restoration data.
|
||||
///
|
||||
/// TODO: Delete for NetNewsWire 7.
|
||||
func restoreLegacyState(from state: [AnyHashable: Any]) {
|
||||
regularTimelineViewController.restoreLegacyState(from: state)
|
||||
updateReadFilterButton()
|
||||
}
|
||||
}
|
||||
|
||||
extension TimelineContainerViewController: TimelineDelegate {
|
||||
|
||||
@@ -47,6 +47,15 @@ final class TimelineTableRowView: NSTableRowView {
|
||||
super.init(coder: coder)
|
||||
}
|
||||
|
||||
/// The table may set selection and emphasis before adding the cell view.
|
||||
override func didAddSubview(_ subview: NSView) {
|
||||
super.didAddSubview(subview)
|
||||
if let cellView = subview as? TimelineTableCellView {
|
||||
cellView.isEmphasized = isEmphasized
|
||||
cellView.isSelected = isSelected
|
||||
}
|
||||
}
|
||||
|
||||
private var cellView: TimelineTableCellView? {
|
||||
for oneSubview in subviews {
|
||||
if let foundView = oneSubview as? TimelineTableCellView {
|
||||
|
||||
@@ -20,12 +20,35 @@ final class TimelineTableView: NSTableView {
|
||||
weak var keyboardDelegate: KeyboardDelegate?
|
||||
weak var rowHeightDelegate: TimelineTableViewRowHeightDelegate?
|
||||
|
||||
private var lastMouseDownClickCount = 0
|
||||
private var lastMouseDownTimestamp: TimeInterval = 0
|
||||
private var uncountedClicks = 0
|
||||
|
||||
override func accessibilityLabel() -> String? {
|
||||
return NSLocalizedString("Timeline", comment: "Timeline")
|
||||
}
|
||||
|
||||
// MARK: - NSResponder
|
||||
|
||||
/// On macOS 27 the click that activates an inactive window doesn’t reach the table,
|
||||
/// but the next click still counts it — so selecting an article would also open it.
|
||||
/// Subtract clicks the table never received from `clickCount`.
|
||||
/// <https://github.com/Ranchero-Software/NetNewsWire/issues/5584>
|
||||
override func mouseDown(with event: NSEvent) {
|
||||
let continuesClickSequence = event.clickCount == lastMouseDownClickCount + 1 && event.timestamp - lastMouseDownTimestamp <= NSEvent.doubleClickInterval
|
||||
if !continuesClickSequence {
|
||||
uncountedClicks = event.clickCount - 1
|
||||
}
|
||||
lastMouseDownClickCount = event.clickCount
|
||||
lastMouseDownTimestamp = event.timestamp
|
||||
|
||||
guard uncountedClicks > 0, let adjustedEvent = NSEvent.mouseEvent(with: event.type, location: event.locationInWindow, modifierFlags: event.modifierFlags, timestamp: event.timestamp, windowNumber: event.windowNumber, context: nil, eventNumber: event.eventNumber, clickCount: event.clickCount - uncountedClicks, pressure: event.pressure) else {
|
||||
super.mouseDown(with: event)
|
||||
return
|
||||
}
|
||||
super.mouseDown(with: adjustedEvent)
|
||||
}
|
||||
|
||||
override func keyDown(with event: NSEvent) {
|
||||
if keyboardDelegate?.keydown(event, in: self) ?? false {
|
||||
return
|
||||
|
||||
@@ -138,6 +138,8 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
return
|
||||
}
|
||||
|
||||
let oldShowFeedNames = showFeedNames
|
||||
let oldShowIcons = showIcons
|
||||
if let representedObjects, representedObjects.count == 1 && representedObjects.first is Feed {
|
||||
showFeedNames = .byline
|
||||
} else {
|
||||
@@ -147,7 +149,11 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
|
||||
articleRowMap = [String: [Int]]()
|
||||
removeRowHeightsForMissingArticles()
|
||||
tableView.reloadData()
|
||||
if showFeedNames == oldShowFeedNames, showIcons == oldShowIcons, let rowChange = singleRowChange(comparedWith: oldValue) {
|
||||
animateSingleRowChange(rowChange, oldArticles: oldValue)
|
||||
} else {
|
||||
tableView.reloadData()
|
||||
}
|
||||
if showIcons {
|
||||
IconImageCache.shared.prefetchImagesForArticles(articles)
|
||||
}
|
||||
@@ -455,50 +461,22 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
}
|
||||
}
|
||||
|
||||
/// Restore state using legacy state restoration data.
|
||||
///
|
||||
/// TODO: Delete for NetNewsWire 7.
|
||||
func restoreLegacyState(from state: [AnyHashable: Any]) {
|
||||
guard let readArticlesFilterStateKeys = state[UserInfoKey.readArticlesFilterStateKeys] as? [[String: String]],
|
||||
let readArticlesFilterStateValues = state[UserInfoKey.readArticlesFilterStateValues] as? [Bool] else {
|
||||
return
|
||||
}
|
||||
|
||||
for i in 0..<readArticlesFilterStateKeys.count {
|
||||
if let sidebarItemID = SidebarItemIdentifier(userInfo: readArticlesFilterStateKeys[i]) {
|
||||
let hidesReadArticles = readArticlesFilterStateValues[i]
|
||||
if hidesReadArticles {
|
||||
noteSidebarItemHidesReadArticles(sidebarItemID)
|
||||
} else {
|
||||
noteSidebarItemShowsReadArticles(sidebarItemID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let articlePathUserInfo = state[UserInfoKey.articlePath] as? [AnyHashable: Any],
|
||||
let accountID = articlePathUserInfo[ArticlePathKey.accountID] as? String,
|
||||
let account = AccountManager.shared.existingAccount(accountID: accountID),
|
||||
let articleID = articlePathUserInfo[ArticlePathKey.articleID] as? String {
|
||||
|
||||
exceptionArticleFetcher = SingleArticleFetcher(account: account, articleID: articleID)
|
||||
fetchAndReplaceArticlesSync()
|
||||
|
||||
if let selectedIndex = articles.firstIndex(where: { $0.articleID == articleID }) {
|
||||
tableView.selectRow(selectedIndex)
|
||||
DispatchQueue.main.async {
|
||||
self.tableView.scrollTo(row: selectedIndex)
|
||||
}
|
||||
focus()
|
||||
}
|
||||
} else {
|
||||
fetchAndReplaceArticlesSync()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@objc func openArticleInBrowser(_ sender: Any?) {
|
||||
if let link = oneSelectedArticle?.preferredLink {
|
||||
guard let article = oneSelectedArticle else {
|
||||
return
|
||||
}
|
||||
|
||||
// A ⌘- or ⇧-double-click can leave a different article, or several, selected.
|
||||
// <https://github.com/Ranchero-Software/NetNewsWire/issues/5581>
|
||||
if let tableView = sender as? NSTableView, tableView === self.tableView {
|
||||
guard let clickedArticle = articles.articleAtRow(tableView.clickedRow), ArticleIdentityKey(clickedArticle) == ArticleIdentityKey(article) else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if let link = article.preferredLink {
|
||||
Browser.open(link, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false)
|
||||
}
|
||||
}
|
||||
@@ -759,6 +737,13 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
guard let articleIDs = note.userInfo?[Account.UserInfoKey.articleIDs] as? Set<String> else {
|
||||
return
|
||||
}
|
||||
if representedObjectsIsStarredFeed(), let account = note.object as? Account, let statusKey = note.userInfo?[Account.UserInfoKey.statusKey] as? ArticleStatus.Key, statusKey == .starred, let starred = note.userInfo?[Account.UserInfoKey.statusFlag] as? Bool {
|
||||
if starred {
|
||||
queueFetchAndMergeArticles()
|
||||
} else {
|
||||
removeUnstarredArticles(articleIDs, accountID: account.accountID)
|
||||
}
|
||||
}
|
||||
reloadVisibleCells(for: articleIDs)
|
||||
updateUnreadCount()
|
||||
}
|
||||
@@ -812,7 +797,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
}
|
||||
// The row already has room for the thumbnail, so only the image changes.
|
||||
tableView.enumerateAvailableRowViews { rowView, row in
|
||||
guard let article = articles.articleAtRow(row), ArticleThumbnailFinder.shared.thumbnailURL(for: article, mode: thumbnailMode) == url, let cell = cellForRowView(rowView) as? TimelineTableCellView, let thumbnail = ThumbnailDownloader.shared.thumbnail(url: url, mode: thumbnailMode, articleTitle: article.title) else {
|
||||
guard let article = articles.articleAtRow(row), ArticleThumbnailFinder.shared.thumbnailURL(for: article, mode: thumbnailMode) == url, let cell = cellForRowView(rowView) as? TimelineTableCellView, let thumbnail = ThumbnailDownloader.shared.thumbnail(url: url, mode: thumbnailMode, feedName: article.feed?.nameForDisplay, articleTitle: article.title) else {
|
||||
return
|
||||
}
|
||||
cell.thumbnail = thumbnail
|
||||
@@ -834,7 +819,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
// After ArticleThumbnailFinder forgets its choices, which it does on this notification too.
|
||||
Task { @MainActor in
|
||||
remeasureRowsWhoseThumbnailChanged()
|
||||
// Thumbnails that couldn’t download while offline or in Low Data Mode try again.
|
||||
// Thumbnails that couldn’t download while offline try again.
|
||||
if ThumbnailDownloader.shared.networkAllowsDownloads {
|
||||
reloadVisibleCells()
|
||||
}
|
||||
@@ -1075,6 +1060,47 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
remeasureRowHeights(rows)
|
||||
}
|
||||
|
||||
/// A row inserted into or removed from `articles`, with every other article in the same order.
|
||||
private enum SingleRowChange {
|
||||
case insertion(Int)
|
||||
case removal(Int)
|
||||
}
|
||||
|
||||
private func singleRowChange(comparedWith oldArticles: ArticleArray) -> SingleRowChange? {
|
||||
guard abs(articles.count - oldArticles.count) == 1 else {
|
||||
return nil
|
||||
}
|
||||
let isInsertion = articles.count > oldArticles.count
|
||||
let keys = articles.map { ArticleIdentityKey($0) }
|
||||
let oldKeys = oldArticles.map { ArticleIdentityKey($0) }
|
||||
var longerKeys = isInsertion ? keys : oldKeys
|
||||
let shorterKeys = isInsertion ? oldKeys : keys
|
||||
|
||||
let row = shorterKeys.indices.first { longerKeys[$0] != shorterKeys[$0] } ?? shorterKeys.count
|
||||
longerKeys.remove(at: row)
|
||||
guard longerKeys == shorterKeys else {
|
||||
return nil
|
||||
}
|
||||
return isInsertion ? .insertion(row) : .removal(row)
|
||||
}
|
||||
|
||||
private func animateSingleRowChange(_ rowChange: SingleRowChange, oldArticles: ArticleArray) {
|
||||
var unchangedOldArticles = oldArticles
|
||||
switch rowChange {
|
||||
case .insertion(let row):
|
||||
tableView.insertRows(at: IndexSet(integer: row), withAnimation: .effectFade)
|
||||
unchangedOldArticles.insert(articles[row], at: row)
|
||||
case .removal(let row):
|
||||
tableView.removeRows(at: IndexSet(integer: row), withAnimation: .effectFade)
|
||||
unchangedOldArticles.remove(at: row)
|
||||
}
|
||||
|
||||
// A fetch can return new instances of the other articles, with changed data.
|
||||
let changedRows = rowsWithChangedArticles(comparedWith: unchangedOldArticles)
|
||||
remeasureRowHeights(changedRows)
|
||||
reloadVisibleCells(for: changedRows)
|
||||
}
|
||||
|
||||
private func removeRowHeightsForMissingArticles() {
|
||||
let articleKeys = Set(articles.map { ArticleIdentityKey($0) })
|
||||
rowHeights = rowHeights.filter { articleKeys.contains($0.key) }
|
||||
@@ -1400,7 +1426,7 @@ extension TimelineViewController: NSTableViewDelegate {
|
||||
var showThumbnail = false
|
||||
if let thumbnailMode, let thumbnailURL = ArticleThumbnailFinder.shared.thumbnailURL(for: article, mode: thumbnailMode) {
|
||||
showThumbnail = true
|
||||
thumbnail = ThumbnailDownloader.shared.thumbnail(url: thumbnailURL, mode: thumbnailMode, articleTitle: article.title)
|
||||
thumbnail = ThumbnailDownloader.shared.thumbnail(url: thumbnailURL, mode: thumbnailMode, feedName: article.feed?.nameForDisplay, articleTitle: article.title)
|
||||
}
|
||||
cell.cellData = TimelineCellData(article: article, showFeedName: showFeedNames, feedName: article.feed?.nameForDisplay, byline: article.byline(), iconImage: iconImage, showIcon: showIcons, thumbnail: thumbnail, showThumbnail: showThumbnail)
|
||||
}
|
||||
@@ -1530,6 +1556,20 @@ private extension TimelineViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// Selected articles stay, so the article view doesn’t lose what the user is reading.
|
||||
func removeUnstarredArticles(_ articleIDs: Set<String>, accountID: String) {
|
||||
let selectedArticleKeys = Set(selectedArticles.map { ArticleIdentityKey($0) })
|
||||
let remainingArticles = articles.filter { article in
|
||||
article.status.starred || article.accountID != accountID || !articleIDs.contains(article.articleID) || selectedArticleKeys.contains(ArticleIdentityKey(article))
|
||||
}
|
||||
guard remainingArticles.count != articles.count else {
|
||||
return
|
||||
}
|
||||
performBlockAndRestoreSelection {
|
||||
articles = remainingArticles
|
||||
}
|
||||
}
|
||||
|
||||
func updateUnreadCount() {
|
||||
var count = 0
|
||||
for article in articles {
|
||||
@@ -1843,6 +1883,13 @@ private extension TimelineViewController {
|
||||
return representedObjects?.contains(where: { $0 === SmartFeedsController.shared.todayFeed }) ?? false
|
||||
}
|
||||
|
||||
func representedObjectsIsStarredFeed() -> Bool {
|
||||
guard let representedObjects, representedObjects.count == 1 else {
|
||||
return false
|
||||
}
|
||||
return representedObjects[0] === SmartFeedsController.shared.starredFeed
|
||||
}
|
||||
|
||||
func representedObjectsContainAnyFolder() -> Bool {
|
||||
return representedObjects?.contains(where: { $0 is Folder }) ?? false
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import Account
|
||||
|
||||
final class AccountsAddCloudKitWindowController: NSWindowController {
|
||||
private weak var hostWindow: NSWindow?
|
||||
private var isCheckingiCloud = false
|
||||
|
||||
convenience init() {
|
||||
self.init(windowNibName: "AccountsAddCloudKit")
|
||||
@@ -40,19 +41,29 @@ final class AccountsAddCloudKitWindowController: NSWindowController {
|
||||
}
|
||||
|
||||
@IBAction func create(_ sender: Any) {
|
||||
guard !isCheckingiCloud else {
|
||||
return
|
||||
}
|
||||
assert(!AccountManager.shared.hasiCloudAccount)
|
||||
|
||||
guard AddCloudKitAccountUtilities.isiCloudDriveEnabled else {
|
||||
presentError(AddCloudKitAccountError.iCloudDriveMissing)
|
||||
return
|
||||
}
|
||||
isCheckingiCloud = true
|
||||
Task {
|
||||
defer {
|
||||
isCheckingiCloud = false
|
||||
}
|
||||
|
||||
assert(hostWindow != nil && window != nil)
|
||||
guard let hostWindow, let window else {
|
||||
return
|
||||
}
|
||||
guard await AccountManager.shared.isiCloudAvailable() else {
|
||||
presentError(AddCloudKitAccountError.iCloudUnavailable)
|
||||
return
|
||||
}
|
||||
|
||||
_ = AccountManager.shared.createAccount(type: .cloudKit)
|
||||
hostWindow.endSheet(window, returnCode: NSApplication.ModalResponse.OK)
|
||||
assert(hostWindow != nil && window != nil)
|
||||
guard let hostWindow, let window else {
|
||||
return
|
||||
}
|
||||
|
||||
_ = AccountManager.shared.createAccount(type: .cloudKit)
|
||||
hostWindow.endSheet(window, returnCode: NSApplication.ModalResponse.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ struct AccountsDetailView: View {
|
||||
GridRow {
|
||||
Color.clear
|
||||
.gridCellUnsizedAxes([.horizontal, .vertical])
|
||||
Toggle("Active", isOn: $isActive)
|
||||
Toggle(String(localized: "Active", comment: "Active"), isOn: $isActive)
|
||||
.onChange(of: isActive) {
|
||||
account.isActive = isActive
|
||||
}
|
||||
@@ -79,7 +79,7 @@ struct AccountsDetailView: View {
|
||||
GridRow {
|
||||
Color.clear
|
||||
.gridCellUnsizedAxes([.horizontal, .vertical])
|
||||
Button("Credentials") {
|
||||
Button(String(localized: "Credentials", comment: "Credentials")) {
|
||||
onCredentials?()
|
||||
}
|
||||
.padding(.top, 12)
|
||||
@@ -94,7 +94,7 @@ struct AccountsDetailView: View {
|
||||
}
|
||||
.padding(.top, 12)
|
||||
|
||||
Text("Syncing article content increases iCloud storage use, sync time, and battery use.\n\nArticle status and the content of starred articles are always synced.")
|
||||
Text("Syncing article content increases iCloud storage use, sync time, and battery use.\n\nArticle status and the content of starred articles are always synced.", comment: "Sync content of unread articles footer")
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.padding(.top, 4)
|
||||
|
||||
@@ -57,6 +57,12 @@ final class AccountsDetailViewController: NSViewController {
|
||||
accountsNewsBlurWindowController.account = account
|
||||
accountsNewsBlurWindowController.runSheetOnWindow(window)
|
||||
|
||||
case .miniflux:
|
||||
let accountsMinifluxWindowController = AccountsMinifluxWindowController()
|
||||
accountsWindowController = accountsMinifluxWindowController
|
||||
accountsMinifluxWindowController.account = account
|
||||
accountsMinifluxWindowController.runSheetOnWindow(window)
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="62" id="hU1-wc-ebZ"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="push" title="Create" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IMO-YT-k9Z">
|
||||
<buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IMO-YT-k9Z">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
@@ -155,13 +155,13 @@ Gw
|
||||
<constraint firstAttribute="height" constant="32" id="NRl-GS-cHS"/>
|
||||
<constraint firstAttribute="width" constant="333" id="cNd-Nt-bdB"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" title="Your username and password will be encrypted and stored in Keychain. " id="HuQ-TS-tS3">
|
||||
<textFieldCell key="cell" title="Your username and password will be stored securely in your keychain." id="HuQ-TS-tS3">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MlB-jN-Ybe">
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MlB-jN-Ybe" customClass="LinkButton" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="266" y="192" width="105" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="105" id="fHd-fN-n8G"/>
|
||||
|
||||
@@ -38,7 +38,7 @@ final class AccountsFeedbinWindowController: NSWindowController {
|
||||
noAccountTextField.isHidden = true
|
||||
createNewAccountButton.isHidden = true
|
||||
} else {
|
||||
actionButton.title = NSLocalizedString("Create", comment: "Create")
|
||||
actionButton.title = NSLocalizedString("Add", comment: "Add button")
|
||||
signInTextField.stringValue = NSLocalizedString("Sign in to your Feedbin account.", comment: "SignIn")
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24506" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24506"/>
|
||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="AccountsMinifluxWindowController" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="actionButton" destination="9mz-D9-krh" id="ozu-6Q-9Lb"/>
|
||||
<outlet property="apiTokenTextField" destination="Mfx-C4-fld" id="Mfx-Ot-tok"/>
|
||||
<outlet property="apiURLTextField" destination="d7d-ZV-CcZ" id="Af4-uM-Dgd"/>
|
||||
<outlet property="authenticationPopUpButton" destination="Mfx-Pp-btn" id="Mfx-Pp-otl"/>
|
||||
<outlet property="createAccountButton" destination="kUQ-aj-Iu6" id="n9d-n0-mvN"/>
|
||||
<outlet property="errorMessageLabel" destination="Gyz-Mz-v08" id="fwM-K9-xnR"/>
|
||||
<outlet property="gridView" destination="zBB-JH-huI" id="ghz-ki-b0V"/>
|
||||
<outlet property="noAccountTextField" destination="R8e-67-Bwh" id="7oG-ro-jcB"/>
|
||||
<outlet property="passwordTextField" destination="JSa-LY-zNQ" id="E9W-0F-69m"/>
|
||||
<outlet property="progressIndicator" destination="B0W-bh-Evv" id="Tiq-gx-s3F"/>
|
||||
<outlet property="titleImageView" destination="Ssh-Dh-xbg" id="8Iy-jf-EYR"/>
|
||||
<outlet property="titleLabel" destination="lti-yM-8LV" id="AP0-ds-6tS"/>
|
||||
<outlet property="usernameTextField" destination="78p-Cf-f55" id="RWd-0q-oAL"/>
|
||||
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="209" width="433" height="306"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1410"/>
|
||||
<view key="contentView" id="se5-gp-TjO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="433" height="306"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<stackView distribution="fill" orientation="horizontal" alignment="bottom" spacing="19" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7Ht-Fn-0Ya">
|
||||
<rect key="frame" x="217" y="286" width="0.0" height="0.0"/>
|
||||
</stackView>
|
||||
<gridView xPlacement="trailing" yPlacement="center" rowAlignment="none" rowSpacing="7" columnSpacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="zBB-JH-huI">
|
||||
<rect key="frame" x="80" y="83" width="304" height="149"/>
|
||||
<rows>
|
||||
<gridRow id="DRl-lC-vUc"/>
|
||||
<gridRow id="Mfx-R0-ath"/>
|
||||
<gridRow id="eW8-uH-txq"/>
|
||||
<gridRow id="ebD-On-mOK"/>
|
||||
<gridRow id="Mfx-R4-tok"/>
|
||||
</rows>
|
||||
<columns>
|
||||
<gridColumn id="fCQ-jY-Mts"/>
|
||||
<gridColumn xPlacement="leading" id="7CY-bX-6x4"/>
|
||||
</columns>
|
||||
<gridCells>
|
||||
<gridCell row="DRl-lC-vUc" column="fCQ-jY-Mts" id="xwR-xz-N6h">
|
||||
<textField key="contentView" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="H6f-t4-SMg">
|
||||
<rect key="frame" x="37" y="129" width="61" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="API URL:" id="zBm-dZ-EF1">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</gridCell>
|
||||
<gridCell row="DRl-lC-vUc" column="7CY-bX-6x4" id="Wd5-Zp-t61">
|
||||
<textField key="contentView" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="d7d-ZV-CcZ" userLabel="API URL Text Field">
|
||||
<rect key="frame" x="104" y="125" width="200" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="200" id="Mki-bb-tDu"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="https://miniflux.example.com" drawsBackground="YES" id="0OO-BG-GXI">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</gridCell>
|
||||
<gridCell row="Mfx-R0-ath" column="fCQ-jY-Mts" id="Mfx-C0-lbc">
|
||||
<textField key="contentView" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Mfx-C0-lbf">
|
||||
<rect key="frame" x="-2" y="97" width="100" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Authentication:" id="Mfx-C0-lbl">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</gridCell>
|
||||
<gridCell row="Mfx-R0-ath" column="7CY-bX-6x4" id="Mfx-C0-ppc">
|
||||
<popUpButton key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Mfx-Pp-btn">
|
||||
<rect key="frame" x="101" y="89" width="107" height="25"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Password" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="Mfx-Mi-pwd" id="Mfx-Pp-cel">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<menu key="menu" id="Mfx-Pp-mnu">
|
||||
<items>
|
||||
<menuItem title="Password" state="on" id="Mfx-Mi-pwd"/>
|
||||
<menuItem title="API Token" tag="1" id="Mfx-Mi-tok"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
<connections>
|
||||
<action selector="authModeChanged:" target="-2" id="Mfx-Pp-act"/>
|
||||
</connections>
|
||||
</popUpButton>
|
||||
</gridCell>
|
||||
<gridCell row="eW8-uH-txq" column="fCQ-jY-Mts" id="4DI-01-jGD">
|
||||
<textField key="contentView" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Zy6-9c-8TI">
|
||||
<rect key="frame" x="30" y="66" width="68" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Username:" id="DqN-SV-v35">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</gridCell>
|
||||
<gridCell row="eW8-uH-txq" column="7CY-bX-6x4" id="Z0b-qS-MUJ">
|
||||
<textField key="contentView" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="78p-Cf-f55">
|
||||
<rect key="frame" x="104" y="62" width="200" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="200" id="Qin-jm-4zt"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="username" drawsBackground="YES" id="fCk-Tf-q01">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</gridCell>
|
||||
<gridCell row="ebD-On-mOK" column="fCQ-jY-Mts" id="Hqa-3w-cQv">
|
||||
<textField key="contentView" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wEx-TM-rPM">
|
||||
<rect key="frame" x="32" y="35" width="66" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Password:" id="7g8-Kk-ISg">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</gridCell>
|
||||
<gridCell row="ebD-On-mOK" column="7CY-bX-6x4" id="m16-3v-9pf">
|
||||
<secureTextField key="contentView" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JSa-LY-zNQ">
|
||||
<rect key="frame" x="104" y="31" width="200" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="200" id="eal-wa-1nU"/>
|
||||
</constraints>
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="••••••••" drawsBackground="YES" usesSingleLineMode="YES" id="trK-OG-tBe">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<allowedInputSourceLocales>
|
||||
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
|
||||
</allowedInputSourceLocales>
|
||||
</secureTextFieldCell>
|
||||
</secureTextField>
|
||||
</gridCell>
|
||||
<gridCell row="Mfx-R4-tok" column="fCQ-jY-Mts" id="Mfx-C4-lbc">
|
||||
<textField key="contentView" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Mfx-C4-lbf">
|
||||
<rect key="frame" x="31" y="4" width="67" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="API Token:" id="Mfx-C4-lbl">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</gridCell>
|
||||
<gridCell row="Mfx-R4-tok" column="7CY-bX-6x4" id="Mfx-C4-fdc">
|
||||
<secureTextField key="contentView" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Mfx-C4-fld">
|
||||
<rect key="frame" x="104" y="0.0" width="200" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="200" id="Mfx-C4-wid"/>
|
||||
</constraints>
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="Mfx-C4-fcl">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<allowedInputSourceLocales>
|
||||
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
|
||||
</allowedInputSourceLocales>
|
||||
</secureTextFieldCell>
|
||||
</secureTextField>
|
||||
</gridCell>
|
||||
</gridCells>
|
||||
</gridView>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9mz-D9-krh">
|
||||
<rect key="frame" x="354" y="20" width="62" height="24"/>
|
||||
<buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IMO-YT-k9Z">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
DQ
|
||||
</string>
|
||||
</buttonCell>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="62" id="afy-Zh-DIy"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<action selector="action:" target="-2" id="Kix-5a-5Og"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XAM-Hb-0Hw">
|
||||
<rect key="frame" x="280" y="20" width="62" height="24"/>
|
||||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ufs-ar-BAY">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
Gw
|
||||
</string>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="cancel:" target="-2" id="WAD-ES-hpq"/>
|
||||
</connections>
|
||||
</button>
|
||||
<progressIndicator hidden="YES" wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="B0W-bh-Evv">
|
||||
<rect key="frame" x="256" y="20" width="16" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="16" id="QuJ-Kk-QvB"/>
|
||||
<constraint firstAttribute="height" constant="16" id="SbP-MC-kng"/>
|
||||
</constraints>
|
||||
</progressIndicator>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Ssh-Dh-xbg">
|
||||
<rect key="frame" x="20" y="236" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="NYV-hM-AYz"/>
|
||||
<constraint firstAttribute="width" constant="50" id="qWk-4n-LXb"/>
|
||||
</constraints>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" id="y38-YL-woC"/>
|
||||
</imageView>
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lti-yM-8LV">
|
||||
<rect key="frame" x="78" y="270" width="337" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Sign in to your Miniflux account." id="ras-dj-nP8">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="R8e-67-Bwh">
|
||||
<rect key="frame" x="78" y="249" width="185" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Don’t have a Miniflux instance?" id="ker-hu-FEc">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kUQ-aj-Iu6" customClass="LinkButton" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="262" y="249" width="99" height="16"/>
|
||||
<buttonCell key="cell" type="roundRect" title="Find out more" bezelStyle="roundedRect" alignment="center" state="on" imageScaling="proportionallyDown" inset="2" id="xY9-Rw-8kx">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
</buttonCell>
|
||||
<color key="contentTintColor" name="AccentColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="NOr-5b-kRd"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<action selector="createAccountWithProvider:" target="-2" id="eQi-od-QJ3"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="q5z-LG-0Fm">
|
||||
<rect key="frame" x="78" y="29" width="337" height="39"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="39" id="Zv4-mj-po0"/>
|
||||
<constraint firstAttribute="width" constant="333" id="xsi-I6-XNM"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" title="Your credentials will be stored securely in your keychain." id="Ec9-bB-tQz">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Gyz-Mz-v08">
|
||||
<rect key="frame" x="78" y="11" width="337" height="16"/>
|
||||
<textFieldCell key="cell" id="AGV-EV-VmY">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Ssh-Dh-xbg" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" symbolic="YES" id="0Fq-9s-pKG"/>
|
||||
<constraint firstItem="zBB-JH-huI" firstAttribute="top" secondItem="R8e-67-Bwh" secondAttribute="bottom" constant="17" id="Mfx-Gd-top"/>
|
||||
<constraint firstItem="kUQ-aj-Iu6" firstAttribute="centerY" secondItem="R8e-67-Bwh" secondAttribute="centerY" id="2hZ-w7-Lne"/>
|
||||
<constraint firstItem="lti-yM-8LV" firstAttribute="leading" secondItem="Ssh-Dh-xbg" secondAttribute="trailing" constant="10" id="5a7-jI-SC9"/>
|
||||
<constraint firstAttribute="bottom" secondItem="B0W-bh-Evv" secondAttribute="bottom" constant="20" symbolic="YES" id="7OS-Ie-XXN"/>
|
||||
<constraint firstItem="XAM-Hb-0Hw" firstAttribute="leading" secondItem="B0W-bh-Evv" secondAttribute="trailing" constant="8" symbolic="YES" id="Ame-HX-mdC"/>
|
||||
<constraint firstItem="q5z-LG-0Fm" firstAttribute="leading" secondItem="R8e-67-Bwh" secondAttribute="leading" id="B2k-oM-YfG"/>
|
||||
<constraint firstItem="kUQ-aj-Iu6" firstAttribute="leading" secondItem="R8e-67-Bwh" secondAttribute="trailing" constant="1" id="BWQ-ly-Hcg"/>
|
||||
<constraint firstItem="9mz-D9-krh" firstAttribute="leading" secondItem="XAM-Hb-0Hw" secondAttribute="trailing" constant="12" symbolic="YES" id="CC8-HR-FDy"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lti-yM-8LV" secondAttribute="trailing" constant="20" symbolic="YES" id="CeA-ET-oeg"/>
|
||||
<constraint firstItem="Ssh-Dh-xbg" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="EKF-Yq-DxZ"/>
|
||||
<constraint firstItem="q5z-LG-0Fm" firstAttribute="top" relation="greaterThanOrEqual" secondItem="zBB-JH-huI" secondAttribute="bottom" constant="15" id="Hdb-dd-lM9"/>
|
||||
<constraint firstItem="9mz-D9-krh" firstAttribute="top" secondItem="q5z-LG-0Fm" secondAttribute="bottom" constant="17" priority="750" id="Mfx-Kc-btm"/>
|
||||
<constraint firstItem="XAM-Hb-0Hw" firstAttribute="width" secondItem="9mz-D9-krh" secondAttribute="width" id="IN4-Kx-qyK"/>
|
||||
<constraint firstItem="XAM-Hb-0Hw" firstAttribute="centerY" secondItem="9mz-D9-krh" secondAttribute="centerY" id="M2M-fb-kfR"/>
|
||||
<constraint firstItem="zBB-JH-huI" firstAttribute="leading" secondItem="R8e-67-Bwh" secondAttribute="leading" id="Mqa-R7-znW"/>
|
||||
<constraint firstAttribute="bottom" secondItem="9mz-D9-krh" secondAttribute="bottom" constant="20" id="PK2-Ye-400"/>
|
||||
<constraint firstItem="Gyz-Mz-v08" firstAttribute="top" secondItem="q5z-LG-0Fm" secondAttribute="bottom" constant="2" id="UVQ-eH-uwR"/>
|
||||
<constraint firstItem="R8e-67-Bwh" firstAttribute="leading" secondItem="Ssh-Dh-xbg" secondAttribute="trailing" constant="10" id="ah8-Mj-rXV"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9mz-D9-krh" secondAttribute="trailing" constant="17" id="fVQ-zN-rKd"/>
|
||||
<constraint firstItem="7Ht-Fn-0Ya" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" id="jlY-Jg-KJR"/>
|
||||
<constraint firstItem="B0W-bh-Evv" firstAttribute="leading" secondItem="Gyz-Mz-v08" secondAttribute="trailing" constant="8" id="Mfx-Er-trl"/>
|
||||
<constraint firstItem="Gyz-Mz-v08" firstAttribute="leading" secondItem="q5z-LG-0Fm" secondAttribute="leading" id="rTh-Ea-LYf"/>
|
||||
<constraint firstAttribute="trailing" secondItem="q5z-LG-0Fm" secondAttribute="trailing" constant="20" id="rky-el-9AK"/>
|
||||
<constraint firstItem="lti-yM-8LV" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="t4L-Nb-T2M"/>
|
||||
<constraint firstItem="7Ht-Fn-0Ya" firstAttribute="centerX" secondItem="se5-gp-TjO" secondAttribute="centerX" id="tAZ-Te-w3H"/>
|
||||
<constraint firstItem="R8e-67-Bwh" firstAttribute="top" secondItem="lti-yM-8LV" secondAttribute="bottom" constant="5" id="vL5-xO-f7d"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="116.5" y="149.5"/>
|
||||
</window>
|
||||
</objects>
|
||||
<resources>
|
||||
<namedColor name="AccentColor">
|
||||
<color red="0.030999999493360519" green="0.41600000858306885" blue="0.93300002813339233" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</namedColor>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -0,0 +1,223 @@
|
||||
//
|
||||
// AccountsMinifluxWindowController.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Dave Marquard on 7/15/26.
|
||||
// Copyright © 2026 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
import Account
|
||||
import RSWeb
|
||||
import Secrets
|
||||
|
||||
final class AccountsMinifluxWindowController: NSWindowController {
|
||||
|
||||
@IBOutlet var titleImageView: NSImageView?
|
||||
@IBOutlet var titleLabel: NSTextField?
|
||||
|
||||
@IBOutlet var gridView: NSGridView?
|
||||
@IBOutlet var progressIndicator: NSProgressIndicator?
|
||||
@IBOutlet var usernameTextField: NSTextField?
|
||||
@IBOutlet var apiURLTextField: NSTextField?
|
||||
@IBOutlet var passwordTextField: NSSecureTextField?
|
||||
@IBOutlet var apiTokenTextField: NSSecureTextField?
|
||||
@IBOutlet var authenticationPopUpButton: NSPopUpButton?
|
||||
@IBOutlet var createAccountButton: NSButton?
|
||||
@IBOutlet var errorMessageLabel: NSTextField?
|
||||
@IBOutlet var actionButton: NSButton?
|
||||
@IBOutlet var noAccountTextField: NSTextField?
|
||||
|
||||
var account: Account?
|
||||
|
||||
private weak var hostWindow: NSWindow?
|
||||
|
||||
private let labelColumnIndex = 0
|
||||
private let usernameRowIndex = 2
|
||||
private let passwordRowIndex = 3
|
||||
private let apiTokenRowIndex = 4
|
||||
|
||||
private enum AuthMode: Int {
|
||||
case usernameAndPassword = 0
|
||||
case apiToken = 1
|
||||
}
|
||||
|
||||
private var isTokenMode: Bool {
|
||||
authenticationPopUpButton?.selectedTag() == AuthMode.apiToken.rawValue
|
||||
}
|
||||
|
||||
convenience init() {
|
||||
self.init(windowNibName: NSNib.Name("AccountsMiniflux"))
|
||||
}
|
||||
|
||||
override func windowDidLoad() {
|
||||
titleImageView?.image = Assets.Images.accountMiniflux
|
||||
titleLabel?.stringValue = NSLocalizedString("Sign in to your Miniflux account.", comment: "Sign in to your Miniflux account.")
|
||||
noAccountTextField?.stringValue = NSLocalizedString("Don’t have a Miniflux instance?", comment: "Don’t have a Miniflux instance?")
|
||||
createAccountButton?.title = NSLocalizedString("Find out more", comment: "Find out more")
|
||||
apiURLTextField?.placeholderString = NSLocalizedString("https://miniflux.example.com", comment: "Miniflux API Helper")
|
||||
|
||||
authenticationPopUpButton?.menu?.item(withTag: AuthMode.usernameAndPassword.rawValue)?.title = NSLocalizedString("Password", comment: "Password")
|
||||
authenticationPopUpButton?.menu?.item(withTag: AuthMode.apiToken.rawValue)?.title = NSLocalizedString("API Token", comment: "API Token")
|
||||
authenticationPopUpButton?.selectItem(withTag: AuthMode.usernameAndPassword.rawValue)
|
||||
|
||||
if let account {
|
||||
if let tokenCredentials = try? account.retrieveCredentials(type: .minifluxAPIToken) {
|
||||
apiTokenTextField?.stringValue = tokenCredentials.secret
|
||||
authenticationPopUpButton?.selectItem(withTag: AuthMode.apiToken.rawValue)
|
||||
} else if let basicCredentials = try? account.retrieveCredentials(type: .minifluxBasic) {
|
||||
usernameTextField?.stringValue = basicCredentials.username
|
||||
authenticationPopUpButton?.selectItem(withTag: AuthMode.usernameAndPassword.rawValue)
|
||||
}
|
||||
apiURLTextField?.stringValue = account.endpointURL?.absoluteString ?? ""
|
||||
actionButton?.title = NSLocalizedString("Update", comment: "Update")
|
||||
} else {
|
||||
actionButton?.title = NSLocalizedString("Add", comment: "Add button")
|
||||
}
|
||||
|
||||
fixLabelColumnWidth()
|
||||
updateAuthModeVisibility()
|
||||
enableAutofill()
|
||||
apiURLTextField?.becomeFirstResponder()
|
||||
}
|
||||
|
||||
// MARK: API
|
||||
|
||||
func runSheetOnWindow(_ hostWindow: NSWindow, completion: ((NSApplication.ModalResponse) -> Void)? = nil) {
|
||||
guard let window else {
|
||||
return
|
||||
}
|
||||
|
||||
self.hostWindow = hostWindow
|
||||
hostWindow.beginSheet(window, completionHandler: completion)
|
||||
}
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
@IBAction func cancel(_ sender: Any) {
|
||||
guard let hostWindow, let window else {
|
||||
return
|
||||
}
|
||||
hostWindow.endSheet(window, returnCode: NSApplication.ModalResponse.cancel)
|
||||
}
|
||||
|
||||
@IBAction func action(_ sender: Any) {
|
||||
errorMessageLabel?.stringValue = ""
|
||||
|
||||
guard let apiURL = Miniflux.normalizedEndpointURL(from: apiURLTextField?.stringValue ?? "") else {
|
||||
errorMessageLabel?.stringValue = NSLocalizedString("Invalid API URL.", comment: "Invalid API URL")
|
||||
return
|
||||
}
|
||||
|
||||
let credentials: Credentials
|
||||
|
||||
if isTokenMode {
|
||||
let token = apiTokenTextField?.stringValue.trimmingWhitespace ?? ""
|
||||
guard !token.isEmpty else {
|
||||
errorMessageLabel?.stringValue = NSLocalizedString("An API token is required.", comment: "Credentials Error")
|
||||
return
|
||||
}
|
||||
credentials = Credentials(type: .minifluxAPIToken, username: "", secret: token)
|
||||
} else {
|
||||
let trimmedUsername = usernameTextField?.stringValue.trimmingWhitespace ?? ""
|
||||
let password = passwordTextField?.stringValue ?? ""
|
||||
guard !trimmedUsername.isEmpty, !password.isEmpty else {
|
||||
errorMessageLabel?.stringValue = NSLocalizedString("Username and password are required.", comment: "Credentials Error")
|
||||
return
|
||||
}
|
||||
credentials = Credentials(type: .minifluxBasic, username: trimmedUsername, secret: password)
|
||||
}
|
||||
|
||||
Task { @MainActor in
|
||||
actionButton?.isEnabled = false
|
||||
progressIndicator?.isHidden = false
|
||||
progressIndicator?.startAnimation(self)
|
||||
|
||||
@MainActor func stopAnimation() {
|
||||
actionButton?.isEnabled = true
|
||||
progressIndicator?.isHidden = true
|
||||
progressIndicator?.stopAnimation(self)
|
||||
}
|
||||
|
||||
do {
|
||||
let validatedCredentials = try await Account.validateCredentials(type: .miniflux, credentials: credentials, endpoint: apiURL)
|
||||
stopAnimation()
|
||||
|
||||
guard let validatedCredentials else {
|
||||
errorMessageLabel?.stringValue = NSLocalizedString("Invalid username/password combination, or invalid API token.", comment: "Credentials Error")
|
||||
return
|
||||
}
|
||||
|
||||
guard account != nil || !AccountManager.shared.duplicateServiceAccount(type: .miniflux, username: validatedCredentials.username, endpoint: apiURL) else {
|
||||
errorMessageLabel?.stringValue = NSLocalizedString("There is already a Miniflux account for this user on this server.", comment: "Duplicate Error")
|
||||
return
|
||||
}
|
||||
|
||||
let isNewAccount = account == nil
|
||||
if isNewAccount {
|
||||
account = AccountManager.shared.createAccount(type: .miniflux)
|
||||
}
|
||||
|
||||
do {
|
||||
// The Keychain key comes from the endpoint and username, so remove the old credentials before either changes.
|
||||
try? account?.removeCredentials(type: .minifluxBasic)
|
||||
try? account?.removeCredentials(type: .minifluxAPIToken)
|
||||
account?.endpointURL = apiURL
|
||||
try account?.storeCredentials(validatedCredentials)
|
||||
|
||||
if let hostWindow, let window {
|
||||
hostWindow.endSheet(window, returnCode: NSApplication.ModalResponse.OK)
|
||||
}
|
||||
|
||||
account?.triggerRefreshAll()
|
||||
} catch {
|
||||
if isNewAccount, let account {
|
||||
AccountManager.shared.deleteAccount(account)
|
||||
self.account = nil
|
||||
}
|
||||
errorMessageLabel?.stringValue = NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error")
|
||||
}
|
||||
|
||||
} catch {
|
||||
stopAnimation()
|
||||
errorMessageLabel?.stringValue = error.localizedDescription
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func createAccountWithProvider(_ sender: Any) {
|
||||
guard let url = URL(string: "https://miniflux.app") else {
|
||||
return
|
||||
}
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
|
||||
@IBAction func authModeChanged(_ sender: Any) {
|
||||
updateAuthModeVisibility()
|
||||
}
|
||||
|
||||
// MARK: Autofill
|
||||
|
||||
func enableAutofill() {
|
||||
usernameTextField?.contentType = .username
|
||||
passwordTextField?.contentType = .password
|
||||
}
|
||||
|
||||
// MARK: Auth Mode
|
||||
|
||||
/// Hidden rows don’t count toward column width, so pin the label column to its widest label to keep the fields from shifting.
|
||||
private func fixLabelColumnWidth() {
|
||||
guard let gridView else {
|
||||
return
|
||||
}
|
||||
let labelColumn = gridView.column(at: labelColumnIndex)
|
||||
let labelWidths = (0..<labelColumn.numberOfCells).compactMap { labelColumn.cell(at: $0).contentView?.fittingSize.width }
|
||||
labelColumn.width = labelWidths.max() ?? NSGridView.sizedForContent
|
||||
}
|
||||
|
||||
private func updateAuthModeVisibility() {
|
||||
gridView?.row(at: usernameRowIndex).isHidden = isTokenMode
|
||||
gridView?.row(at: passwordRowIndex).isHidden = isTokenMode
|
||||
gridView?.row(at: apiTokenRowIndex).isHidden = !isTokenMode
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="62" id="stL-0v-emB"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="push" title="Create" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IMO-YT-k9Z">
|
||||
<buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IMO-YT-k9Z">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
@@ -156,7 +156,7 @@ Gw
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9oE-Gq-qp7">
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9oE-Gq-qp7" customClass="LinkButton" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="277" y="193" width="105" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="105" id="Z91-fh-Mw5"/>
|
||||
@@ -176,7 +176,7 @@ Gw
|
||||
<constraint firstAttribute="width" constant="333" id="9Bx-xl-Lf4"/>
|
||||
<constraint firstAttribute="height" constant="39" id="dYs-8A-ml0"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" title="Your username and password will be encrypted and stored in Keychain. " id="VWI-0W-Duk">
|
||||
<textFieldCell key="cell" title="Your username and password will be stored securely in your keychain." id="VWI-0W-Duk">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
@@ -38,7 +38,7 @@ final class AccountsNewsBlurWindowController: NSWindowController {
|
||||
noAccountTextField.isHidden = true
|
||||
createNewAccountButton.isHidden = true
|
||||
} else {
|
||||
actionButton.title = NSLocalizedString("Create", comment: "Create")
|
||||
actionButton.title = NSLocalizedString("Add", comment: "Add button")
|
||||
signInTextField.stringValue = NSLocalizedString("Sign in to your NewsBlur account.", comment: "SignIn")
|
||||
}
|
||||
enableAutofill()
|
||||
|
||||
@@ -201,6 +201,11 @@ extension AccountsPreferencesViewController: AccountsPreferencesAddAccountDelega
|
||||
let accountsNewsBlurWindowController = AccountsNewsBlurWindowController()
|
||||
addAccountWindowController = accountsNewsBlurWindowController
|
||||
accountsNewsBlurWindowController.runSheetOnWindow(window)
|
||||
|
||||
case .miniflux:
|
||||
let accountsMinifluxWindowController = AccountsMinifluxWindowController()
|
||||
addAccountWindowController = accountsMinifluxWindowController
|
||||
accountsMinifluxWindowController.runSheetOnWindow(window)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
</gridView>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9mz-D9-krh">
|
||||
<rect key="frame" x="354" y="20" width="62" height="24"/>
|
||||
<buttonCell key="cell" type="push" title="Create" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IMO-YT-k9Z">
|
||||
<buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IMO-YT-k9Z">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
@@ -182,7 +182,7 @@ Gw
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kUQ-aj-Iu6">
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kUQ-aj-Iu6" customClass="LinkButton" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="262" y="218" width="99" height="16"/>
|
||||
<buttonCell key="cell" type="roundRect" title="Create one here." bezelStyle="roundedRect" alignment="center" state="on" imageScaling="proportionallyDown" inset="2" id="xY9-Rw-8kx">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
@@ -202,7 +202,7 @@ Gw
|
||||
<constraint firstAttribute="height" constant="39" id="Zv4-mj-po0"/>
|
||||
<constraint firstAttribute="width" constant="333" id="xsi-I6-XNM"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" title="Your username and password will be encrypted and stored in Keychain. " id="Ec9-bB-tQz">
|
||||
<textFieldCell key="cell" title="Your username and password will be stored securely in your keychain." id="Ec9-bB-tQz">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -230,7 +230,7 @@ Gw
|
||||
<constraint firstAttribute="trailing" secondItem="lti-yM-8LV" secondAttribute="trailing" constant="20" symbolic="YES" id="CeA-ET-oeg"/>
|
||||
<constraint firstItem="Ssh-Dh-xbg" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="EKF-Yq-DxZ"/>
|
||||
<constraint firstItem="q5z-LG-0Fm" firstAttribute="top" secondItem="zBB-JH-huI" secondAttribute="bottom" constant="15" id="Hdb-dd-lM9"/>
|
||||
<constraint firstItem="XAM-Hb-0Hw" firstAttribute="width" secondItem="9mz-D9-krh" secondAttribute="width" multiplier="0.951613" constant="3" id="IN4-Kx-qyK"/>
|
||||
<constraint firstItem="XAM-Hb-0Hw" firstAttribute="width" secondItem="9mz-D9-krh" secondAttribute="width" id="IN4-Kx-qyK"/>
|
||||
<constraint firstItem="XAM-Hb-0Hw" firstAttribute="centerY" secondItem="9mz-D9-krh" secondAttribute="centerY" id="M2M-fb-kfR"/>
|
||||
<constraint firstItem="zBB-JH-huI" firstAttribute="leading" secondItem="R8e-67-Bwh" secondAttribute="leading" id="Mqa-R7-znW"/>
|
||||
<constraint firstAttribute="bottom" secondItem="9mz-D9-krh" secondAttribute="bottom" constant="20" id="PK2-Ye-400"/>
|
||||
|
||||
@@ -42,7 +42,7 @@ final class AccountsReaderAPIWindowController: NSWindowController {
|
||||
titleImageView.image = Assets.Images.accountFreshRSS
|
||||
titleLabel.stringValue = NSLocalizedString("Sign in to your FreshRSS account.", comment: "FreshRSS")
|
||||
noAccountTextField.stringValue = NSLocalizedString("Don’t have a FreshRSS instance?", comment: "No FreshRSS")
|
||||
createAccountButton.title = NSLocalizedString("Find out more", comment: "No FreshRSS Button")
|
||||
createAccountButton.title = NSLocalizedString("Find out more", comment: "Find out more")
|
||||
apiURLTextField.placeholderString = NSLocalizedString("https://fresh.rss.net/api/greader.php", comment: "FreshRSS API Helper")
|
||||
case .inoreader:
|
||||
titleImageView.image = Assets.Images.accountInoreader
|
||||
@@ -69,7 +69,7 @@ final class AccountsReaderAPIWindowController: NSWindowController {
|
||||
apiURLTextField.stringValue = account.endpointURL?.absoluteString ?? ""
|
||||
actionButton.title = NSLocalizedString("Update", comment: "Update")
|
||||
} else {
|
||||
actionButton.title = NSLocalizedString("Create", comment: "Create")
|
||||
actionButton.title = NSLocalizedString("Add", comment: "Add button")
|
||||
}
|
||||
|
||||
enableAutofill()
|
||||
|
||||
@@ -60,7 +60,7 @@ enum AddAccountSections: Int, CaseIterable {
|
||||
return [.bazQux, .feedbin, .feedly, .inoreader, .newsBlur, .theOldReader]
|
||||
}
|
||||
case .selfhosted:
|
||||
return [.freshRSS]
|
||||
return [.freshRSS, .miniflux]
|
||||
case .allOrdered:
|
||||
return AddAccountSections.local.sectionContent +
|
||||
AddAccountSections.icloud.sectionContent +
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// LinkButton.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 11/27/26.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
|
||||
/// A button that acts like a link, matching `LinkLabel`: pointing-hand cursor, and highlighted and underlined while pressed.
|
||||
final class LinkButton: NSButton {
|
||||
private var isTracking = false
|
||||
private var isShowingHighlight = false
|
||||
private var originalAttributedTitle: NSAttributedString?
|
||||
|
||||
override func resetCursorRects() {
|
||||
addCursorRect(bounds, cursor: .pointingHand)
|
||||
}
|
||||
|
||||
override func mouseDown(with event: NSEvent) {
|
||||
guard isEnabled else {
|
||||
return
|
||||
}
|
||||
isTracking = true
|
||||
highlightLink()
|
||||
}
|
||||
|
||||
override func mouseDragged(with event: NSEvent) {
|
||||
guard isTracking else {
|
||||
return
|
||||
}
|
||||
|
||||
let isInside = isMouseInside(event)
|
||||
if isInside && !isShowingHighlight {
|
||||
highlightLink()
|
||||
} else if !isInside && isShowingHighlight {
|
||||
unhighlightLink()
|
||||
}
|
||||
}
|
||||
|
||||
override func mouseUp(with event: NSEvent) {
|
||||
guard isTracking else {
|
||||
return
|
||||
}
|
||||
isTracking = false
|
||||
|
||||
if isShowingHighlight {
|
||||
unhighlightLink()
|
||||
}
|
||||
if isMouseInside(event) {
|
||||
sendAction(action, to: target)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension LinkButton {
|
||||
func isMouseInside(_ event: NSEvent) -> Bool {
|
||||
bounds.contains(convert(event.locationInWindow, from: nil))
|
||||
}
|
||||
|
||||
func highlightLink() {
|
||||
originalAttributedTitle = attributedTitle
|
||||
|
||||
let highlightedTitle = NSMutableAttributedString(attributedString: attributedTitle)
|
||||
let fullRange = NSRange(location: 0, length: highlightedTitle.length)
|
||||
highlightedTitle.addAttribute(.foregroundColor, value: NSColor.systemOrange, range: fullRange)
|
||||
highlightedTitle.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: fullRange)
|
||||
highlightedTitle.addAttribute(.underlineColor, value: NSColor.systemOrange, range: fullRange)
|
||||
attributedTitle = highlightedTitle
|
||||
|
||||
isShowingHighlight = true
|
||||
}
|
||||
|
||||
func unhighlightLink() {
|
||||
if let originalAttributedTitle {
|
||||
attributedTitle = originalAttributedTitle
|
||||
}
|
||||
originalAttributedTitle = nil
|
||||
isShowingHighlight = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "accountMiniflux.pdf",
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"filename" : "accountMiniflux-dark.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true,
|
||||
"template-rendering-intent" : "original"
|
||||
}
|
||||
}
|
||||
@@ -129,21 +129,21 @@
|
||||
<rect id="right-margin" fill="#00AEEF" fill-rule="nonzero" opacity="0.4" x="1236.9137" y="405.79" width="8.74023" height="119.336"></rect>
|
||||
</g>
|
||||
<g id="Symbols" transform="translate(1399, 1016)" fill="#000000" fill-rule="nonzero">
|
||||
<g id="Regular-L" transform="translate(-6, 420)">
|
||||
<g id="Regular-L" transform="translate(-6, 391.58)">
|
||||
<g transform="translate(-7.9081, 48.7996)">
|
||||
<path d="M0,64.3945 A64.3945,64.3945 0 1 1 128.7889,64.3945 A64.3945,64.3945 0 1 1 0,64.3945 Z M9.4697,64.3945 A54.9248,54.9248 0 1 0 119.3192,64.3945 A54.9248,54.9248 0 1 0 9.4697,64.3945 Z" id="Ring"></path>
|
||||
<path d="M64.3945,4.7349 A59.6596,59.6596 0 0 0 64.3945,124.0541 L64.3945,91.8569 A27.4624,27.4624 0 0 1 64.3945,36.9321 Z" id="Left-half"></path>
|
||||
<path d="M64.3945,36.9321 A27.4624,27.4624 0 0 1 64.3945,91.8569 Z" id="Inner-right-half"></path>
|
||||
</g>
|
||||
</g>
|
||||
<g id="Regular-M" transform="translate(6, 7)">
|
||||
<g id="Regular-M" transform="translate(6, -14.11)">
|
||||
<g transform="translate(-6.2093, 38.3166)">
|
||||
<path d="M0,50.5615 A50.5615,50.5615 0 1 1 101.123,50.5615 A50.5615,50.5615 0 1 1 0,50.5615 Z M7.4355,50.5615 A43.126,43.126 0 1 0 93.6875,50.5615 A43.126,43.126 0 1 0 7.4355,50.5615 Z" id="Ring"></path>
|
||||
<path d="M50.5615,3.7177 A46.8438,46.8438 0 0 0 50.5615,97.4053 L50.5615,72.1245 A21.563,21.563 0 0 1 50.5615,28.9985 Z" id="Left-half"></path>
|
||||
<path d="M50.5615,28.9985 A21.563,21.563 0 0 1 50.5615,72.1245 Z" id="Inner-right-half"></path>
|
||||
</g>
|
||||
</g>
|
||||
<g id="Regular-S" transform="translate(18, -404)">
|
||||
<g id="Regular-S" transform="translate(18, -420.85)">
|
||||
<g transform="translate(-4.5842, 28.2881)">
|
||||
<path d="M0,37.3281 A37.3281,37.3281 0 1 1 74.6563,37.3281 A37.3281,37.3281 0 1 1 0,37.3281 Z M5.4894,37.3281 A31.8388,31.8388 0 1 0 69.1669,37.3281 A31.8388,31.8388 0 1 0 5.4894,37.3281 Z" id="Ring"></path>
|
||||
<path d="M37.3281,2.7447 A34.5835,34.5835 0 0 0 37.3281,71.9116 L37.3281,53.2475 A15.9194,15.9194 0 0 1 37.3281,21.4088 Z" id="Left-half"></path>
|
||||
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -19,6 +19,9 @@ App Icon\
|
||||
\pard\pardeftab720\sl168\slmult1\sa60\partightenfactor0
|
||||
{\field{\*\fldinst{HYPERLINK "https://hachyderm.io/@bradellis"}}{\fldrslt \cf2 Brad Ellis}}\
|
||||
\
|
||||
Miniflux Syncing\
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/dave-atx"}}{\fldrslt Dave Marquard}}\
|
||||
\
|
||||
Feedly Syncing\
|
||||
{\field{\*\fldinst{HYPERLINK "https://twitter.com/kielgillard"}}{\fldrslt Kiel Gillard}}\
|
||||
\
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
<enumerator name="inoreader" code="Inrd" description="An Inoreader account"/>
|
||||
<enumerator name="bazqux" code="Bzqx" description="A BazQux account"/>
|
||||
<enumerator name="the old reader" code="Tord" description="A The Old Reader account"/>
|
||||
<enumerator name="miniflux" code="Mnfx" description="A Miniflux account"/>
|
||||
</enumeration>
|
||||
|
||||
<class name="account" code="Acct" plural="accounts" description="An account for subscribing to feeds">
|
||||
|
||||
@@ -230,6 +230,8 @@ import RSCore
|
||||
osType = "Bzqx"
|
||||
case .theOldReader:
|
||||
osType = "Tord"
|
||||
case .miniflux:
|
||||
osType = "Mnfx"
|
||||
}
|
||||
return osType.fourCharCode
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ let package = Package(
|
||||
),
|
||||
.testTarget(
|
||||
name: "AccountTests",
|
||||
dependencies: ["Account"],
|
||||
dependencies: ["Account", "SyncDatabase"],
|
||||
resources: [
|
||||
.copy("JSON")
|
||||
],
|
||||
|
||||
@@ -48,6 +48,7 @@ nonisolated public enum AccountType: Int, Codable, Sendable {
|
||||
case inoreader = 21
|
||||
case bazQux = 22
|
||||
case theOldReader = 23
|
||||
case miniflux = 24
|
||||
|
||||
public var isDeveloperRestricted: Bool {
|
||||
return self == .cloudKit || self == .feedbin || self == .feedly || self == .inoreader
|
||||
@@ -74,6 +75,8 @@ nonisolated public enum AccountType: Int, Codable, Sendable {
|
||||
return NSLocalizedString("BazQux", comment: "Account name")
|
||||
case .theOldReader:
|
||||
return NSLocalizedString("The Old Reader", comment: "Account name")
|
||||
case .miniflux:
|
||||
return "Miniflux"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,6 +316,8 @@ public enum FetchType {
|
||||
self.delegate = ReaderAPIAccountDelegate(dataFolder: dataFolder, variant: .bazQux)
|
||||
case .theOldReader:
|
||||
self.delegate = ReaderAPIAccountDelegate(dataFolder: dataFolder, variant: .theOldReader)
|
||||
case .miniflux:
|
||||
self.delegate = MinifluxAccountDelegate(dataFolder: dataFolder)
|
||||
}
|
||||
|
||||
self.accountID = accountID
|
||||
@@ -411,6 +416,8 @@ public enum FetchType {
|
||||
return try await NewsBlurAccountDelegate.validateCredentials(credentials: credentials, endpoint: endpoint)
|
||||
case .freshRSS, .inoreader, .bazQux, .theOldReader:
|
||||
return try await ReaderAPIAccountDelegate.validateCredentials(credentials: credentials, endpoint: endpoint)
|
||||
case .miniflux:
|
||||
return try await MinifluxAccountDelegate.validateCredentials(credentials: credentials, endpoint: endpoint)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
@@ -1038,6 +1045,14 @@ public enum FetchType {
|
||||
await database.deleteAsync(articleIDs: articleIDs)
|
||||
}
|
||||
|
||||
/// Delete statuses for articles the sync service reports as deleted.
|
||||
func deleteStatuses(articleIDs: Set<String>) async {
|
||||
guard !articleIDs.isEmpty else {
|
||||
return
|
||||
}
|
||||
await database.deleteStatusesAsync(articleIDs: articleIDs)
|
||||
}
|
||||
|
||||
/// Empty caches that can reasonably be emptied. Call when the app goes in the background, for instance.
|
||||
func emptyCaches() {
|
||||
database.emptyCaches()
|
||||
|
||||
@@ -33,6 +33,7 @@ import ActivityLog
|
||||
|
||||
private var lastStatusRepairDate: Date?
|
||||
private static let statusRepairInterval: TimeInterval = 1 * 60 * 60
|
||||
private static let defaultPorts = ["http": 80, "https": 443]
|
||||
|
||||
public var isSuspended = false
|
||||
|
||||
@@ -186,6 +187,10 @@ import ActivityLog
|
||||
|
||||
// MARK: - API
|
||||
|
||||
public func isiCloudAvailable() async -> Bool {
|
||||
await CloudKitAccountDelegate.isiCloudAvailable()
|
||||
}
|
||||
|
||||
public func createAccount(type: AccountType) -> Account {
|
||||
if type == .cloudKit {
|
||||
if let existingiCloudAccount = iCloudAccount {
|
||||
@@ -240,19 +245,40 @@ import ActivityLog
|
||||
}
|
||||
|
||||
public func duplicateServiceAccount(type: AccountType, username: String?, endpoint: URL? = nil) -> Bool {
|
||||
Self.duplicateServiceAccount(type: type, username: username, endpoint: endpoint, among: accounts)
|
||||
}
|
||||
|
||||
/// Self-hosted services can have the same username on different servers, so when both endpoints are known, they must match too.
|
||||
static func duplicateServiceAccount(type: AccountType, username: String?, endpoint: URL?, among accounts: [Account]) -> Bool {
|
||||
guard type != .onMyMac else {
|
||||
return false
|
||||
}
|
||||
for account in accounts {
|
||||
if account.type == type && username == account.username {
|
||||
// Self-hosted services can have the same username on different servers.
|
||||
if let endpoint, let existingEndpoint = account.endpointURL, endpoint != existingEndpoint {
|
||||
continue
|
||||
}
|
||||
let normalizedEndpoint = normalizedEndpointForComparison(endpoint)
|
||||
return accounts.contains { account in
|
||||
guard account.type == type, account.username == username else {
|
||||
return false
|
||||
}
|
||||
guard let normalizedEndpoint, let existingEndpoint = normalizedEndpointForComparison(account.endpointURL) else {
|
||||
return true
|
||||
}
|
||||
return normalizedEndpoint == existingEndpoint
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/// Host, non-default port, and path, so that case, scheme, default port, and a trailing slash don’t hide a duplicate.
|
||||
static func normalizedEndpointForComparison(_ url: URL?) -> String? {
|
||||
guard let url, let host = url.host?.lowercased() else {
|
||||
return nil
|
||||
}
|
||||
var normalized = host
|
||||
if let port = url.port, port != defaultPorts[url.scheme?.lowercased() ?? ""] {
|
||||
normalized += ":\(port)"
|
||||
}
|
||||
var path = url.path
|
||||
while path.hasSuffix("/") {
|
||||
path.removeLast()
|
||||
}
|
||||
return normalized + path
|
||||
}
|
||||
|
||||
public func existingAccount(accountID: String) -> Account? {
|
||||
|
||||
@@ -21,6 +21,7 @@ import RSWeb
|
||||
case lastArticleFetchStartTime
|
||||
case lastRefreshCompletedDate
|
||||
case endpointURL
|
||||
case detectedServerVersion
|
||||
case externalID
|
||||
case imported
|
||||
}
|
||||
@@ -29,7 +30,6 @@ import RSWeb
|
||||
private static let etagKey = "etag"
|
||||
|
||||
private let accountID: String
|
||||
private let dataFolder: String
|
||||
|
||||
private var plistImported: Bool {
|
||||
get {
|
||||
@@ -130,6 +130,16 @@ import RSWeb
|
||||
}
|
||||
}
|
||||
|
||||
/// The version the sync server reports, for services whose endpoints vary by version.
|
||||
var detectedServerVersion: String? {
|
||||
get {
|
||||
UserDefaults.standard.string(forKey: defaultsKey(.detectedServerVersion))
|
||||
}
|
||||
set {
|
||||
UserDefaults.standard.set(newValue, forKey: defaultsKey(.detectedServerVersion))
|
||||
}
|
||||
}
|
||||
|
||||
var externalID: String? {
|
||||
get {
|
||||
UserDefaults.standard.string(forKey: defaultsKey(.externalID))
|
||||
@@ -141,7 +151,6 @@ import RSWeb
|
||||
|
||||
init(accountID: String, dataFolder: String) {
|
||||
self.accountID = accountID
|
||||
self.dataFolder = dataFolder
|
||||
|
||||
UserDefaults.standard.register(defaults: [defaultsKey(.isActive): true])
|
||||
|
||||
@@ -155,15 +164,6 @@ import RSWeb
|
||||
if self.username == nil || self.endpointURL == nil {
|
||||
readMissingSettingsFromPlist(accountID: accountID, dataFolder: dataFolder)
|
||||
}
|
||||
if self.username == nil || self.endpointURL == nil {
|
||||
readMissingSettingsFromDatabase()
|
||||
}
|
||||
}
|
||||
|
||||
// Call when an expected value is nil — perhaps it couldn’t be read on startup
|
||||
// from the settings file. Try again.
|
||||
func fetchFromSettingsFileIfNeeded() {
|
||||
readMissingSettingsFromPlist(accountID: accountID, dataFolder: dataFolder)
|
||||
}
|
||||
|
||||
func deleteSettings() {
|
||||
@@ -203,22 +203,6 @@ private extension AccountSettings {
|
||||
}
|
||||
}
|
||||
|
||||
/// Fall back to AccountSettingsDatabase for username and endpointURL
|
||||
/// if they weren't found in UserDefaults or Settings.plist.
|
||||
func readMissingSettingsFromDatabase() {
|
||||
let databasePath = AppConfig.dataFolder.appendingPathComponent("AccountSettings.db").path
|
||||
guard let database = AccountSettingsDatabase(databasePath: databasePath) else {
|
||||
return
|
||||
}
|
||||
|
||||
if self.username == nil, let username = database.username(for: accountID) {
|
||||
self.username = username
|
||||
}
|
||||
if self.endpointURL == nil, let urlString = database.endpointURL(for: accountID) {
|
||||
self.endpointURL = URL(string: urlString)
|
||||
}
|
||||
}
|
||||
|
||||
func storeImportedSettings(_ imported: AccountSettingsImporter.ImportedSettings) {
|
||||
if self.name == nil {
|
||||
self.name = imported.name
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
//
|
||||
// AccountSettingsDatabase.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Brent Simmons on 3/6/26.
|
||||
//
|
||||
|
||||
// TODO: Delete this file in 7.2.
|
||||
|
||||
import Foundation
|
||||
import RSDatabase
|
||||
import RSDatabaseObjC
|
||||
|
||||
@MainActor final class AccountSettingsDatabase {
|
||||
|
||||
private struct AccountCredentials {
|
||||
let username: String?
|
||||
let endpointURL: String?
|
||||
}
|
||||
|
||||
private let credentialsByAccountID: [String: AccountCredentials]
|
||||
|
||||
init?(databasePath: String) {
|
||||
guard FileManager.default.fileExists(atPath: databasePath) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let database = FMDatabase(path: databasePath), database.open() else {
|
||||
return nil
|
||||
}
|
||||
defer {
|
||||
database.close()
|
||||
}
|
||||
|
||||
var credentials = [String: AccountCredentials]()
|
||||
|
||||
if let resultSet = database.executeQuery("SELECT accountID, username, endpointURL FROM accountSettings;", withArgumentsIn: []) {
|
||||
while resultSet.next() {
|
||||
guard let accountID = resultSet.swiftString(forColumn: "accountID") else {
|
||||
continue
|
||||
}
|
||||
let username = resultSet.swiftString(forColumn: "username")
|
||||
let endpointURL = resultSet.swiftString(forColumn: "endpointURL")
|
||||
if username != nil || endpointURL != nil {
|
||||
credentials[accountID] = AccountCredentials(username: username, endpointURL: endpointURL)
|
||||
}
|
||||
}
|
||||
resultSet.close()
|
||||
}
|
||||
|
||||
self.credentialsByAccountID = credentials
|
||||
}
|
||||
|
||||
func username(for accountID: String) -> String? {
|
||||
credentialsByAccountID[accountID]?.username
|
||||
}
|
||||
|
||||
func endpointURL(for accountID: String) -> String? {
|
||||
credentialsByAccountID[accountID]?.endpointURL
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,7 @@ enum CloudKitAccountDelegateError: LocalizedError, Sendable {
|
||||
|
||||
private let syncDatabase: SyncDatabase
|
||||
|
||||
private let container: CKContainer = {
|
||||
let orgID = Bundle.main.object(forInfoDictionaryKey: "OrganizationIdentifier") as! String
|
||||
return CKContainer(identifier: "iCloud.\(orgID).NetNewsWire")
|
||||
}()
|
||||
private let container = CloudKitAccountDelegate.makeContainer()
|
||||
|
||||
private let accountZone: CloudKitAccountZone
|
||||
private let articlesZone: CloudKitArticlesZone
|
||||
@@ -113,6 +110,25 @@ enum CloudKitAccountDelegateError: LocalizedError, Sendable {
|
||||
Self.logger.debug("CloudKitAccountDelegate: \(#function, privacy: .public) did complete")
|
||||
}
|
||||
|
||||
nonisolated static func makeContainer() -> CKContainer {
|
||||
let orgID = Bundle.main.object(forInfoDictionaryKey: "OrganizationIdentifier") as! String
|
||||
return CKContainer(identifier: "iCloud.\(orgID).NetNewsWire")
|
||||
}
|
||||
|
||||
/// False when there’s no iCloud account, the account is restricted, or iCloud is turned off for this app.
|
||||
/// True when the status check itself fails, since sync reports its own errors.
|
||||
nonisolated static func isiCloudAvailable() async -> Bool {
|
||||
guard let status = try? await makeContainer().accountStatus() else {
|
||||
return true
|
||||
}
|
||||
switch status {
|
||||
case .noAccount, .restricted:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// CKAccountChanged can arrive on any thread.
|
||||
@objc nonisolated func handleCKAccountChanged(_ note: Notification) {
|
||||
Task { @MainActor in
|
||||
|
||||
@@ -236,23 +236,6 @@ import Articles
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - NotificationDisplayName
|
||||
public var notificationDisplayName: String {
|
||||
#if os(macOS)
|
||||
if self.url.contains("www.reddit.com") {
|
||||
return NSLocalizedString("Show notifications for new posts", comment: "notifyNameDisplay / Reddit")
|
||||
} else {
|
||||
return NSLocalizedString("Show notifications for new articles", comment: "Show notifications for new articles")
|
||||
}
|
||||
#else
|
||||
if self.url.contains("www.reddit.com") {
|
||||
return NSLocalizedString("Notify about new posts", comment: "notifyNameDisplay / Reddit")
|
||||
} else {
|
||||
return NSLocalizedString("Notify about new articles", comment: "notifyNameDisplay / Default")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
var settings: FeedSettings
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
@@ -87,13 +87,12 @@ import os
|
||||
|
||||
@MainActor private func refreshFeeds(_ feeds: Set<Feed>, completion: (() -> Void)? = nil) {
|
||||
let specialCaseCutoffDate = Date().bySubtracting(hours: 25)
|
||||
let redditURLToRefresh = Self.redditURLToRefresh(in: feeds)
|
||||
|
||||
var filteredFeeds = Set<Feed>()
|
||||
var skippedFeeds = [(Feed, String)]() // feed and skip reason
|
||||
|
||||
for feed in feeds {
|
||||
let (shouldSkip, reason) = Self.feedShouldBeSkipped(feed, specialCaseCutoffDate, redditURLToRefresh)
|
||||
let (shouldSkip, reason) = Self.feedShouldBeSkipped(feed, specialCaseCutoffDate)
|
||||
if shouldSkip, let reason {
|
||||
skippedFeeds.append((feed, reason))
|
||||
} else {
|
||||
@@ -488,7 +487,11 @@ private extension LocalAccountRefresher {
|
||||
]
|
||||
|
||||
/// Returns whether this feed should be skipped and the reason if so.
|
||||
static func feedShouldBeSkipped(_ feed: Feed, _ specialCaseCutoffDate: Date, _ redditURLToRefresh: String?) -> (Bool, String?) {
|
||||
static func feedShouldBeSkipped(_ feed: Feed, _ specialCaseCutoffDate: Date) -> (Bool, String?) {
|
||||
let (skipForReddit, redditReason) = feedShouldBeSkippedForRedditReasons(feed)
|
||||
if skipForReddit {
|
||||
return (true, redditReason)
|
||||
}
|
||||
let (skipForCacheControl, cacheControlReason) = feedShouldBeSkippedForCacheControlReasons(feed)
|
||||
if skipForCacheControl {
|
||||
return (true, cacheControlReason)
|
||||
@@ -497,10 +500,6 @@ private extension LocalAccountRefresher {
|
||||
if skipForDisallowedHost {
|
||||
return (true, disallowedHostReason)
|
||||
}
|
||||
let (skipForReddit, redditReason) = feedShouldBeSkippedForRedditReasons(feed, redditURLToRefresh)
|
||||
if skipForReddit {
|
||||
return (true, redditReason)
|
||||
}
|
||||
let (skipForTiming, timingReason) = feedShouldBeSkippedForTimingReasons(feed, specialCaseCutoffDate)
|
||||
if skipForTiming {
|
||||
return (true, timingReason)
|
||||
@@ -508,26 +507,12 @@ private extension LocalAccountRefresher {
|
||||
return (false, nil)
|
||||
}
|
||||
|
||||
/// Reddit rate-limits to one feed per minute, so we
|
||||
/// refresh the least recently checked one.
|
||||
static func redditURLToRefresh(in feeds: Set<Feed>) -> String? {
|
||||
let redditFeeds = feeds.filter { SpecialCase.urlStringMatchesDomain($0.url, [SpecialCase.redditHostName]) }
|
||||
let winner = redditFeeds.min { ($0.lastCheckDate ?? .distantPast) < ($1.lastCheckDate ?? .distantPast) }
|
||||
return winner?.url
|
||||
}
|
||||
|
||||
static func feedShouldBeSkippedForRedditReasons(_ feed: Feed, _ redditURLToRefresh: String?) -> (Bool, String?) {
|
||||
static func feedShouldBeSkippedForRedditReasons(_ feed: Feed) -> (Bool, String?) {
|
||||
guard SpecialCase.urlStringMatchesDomain(feed.url, [SpecialCase.redditHostName]) else {
|
||||
return (false, nil)
|
||||
}
|
||||
if feed.url == redditURLToRefresh {
|
||||
return (false, nil)
|
||||
}
|
||||
var reason = "Skipped — Reddit allows only one feed per minute"
|
||||
if let redditURLToRefresh {
|
||||
reason += " — refreshing \(redditURLToRefresh) this time"
|
||||
}
|
||||
return (true, reason)
|
||||
Self.logger.info("LocalAccountRefresher: Dropping request because it’s Reddit, which no longer provides feeds: \(feed.url)")
|
||||
return (true, "Skipped — Reddit feed — Reddit no longer offers RSS feeds")
|
||||
}
|
||||
|
||||
static func feedShouldBeSkippedForDisallowedHostReasons(_ feed: Feed) -> (Bool, String?) {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Miniflux.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import os
|
||||
import RSCore
|
||||
|
||||
public struct Miniflux {
|
||||
// Convention with this logger is to put "Miniflux: " at the beginning of each message.
|
||||
static let logger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "NetNewsWire", category: "Miniflux")
|
||||
|
||||
/// Turns what the user typed into a Miniflux base URL: adds `https://` if there’s no scheme, and drops trailing slashes and a trailing `/v1`. Returns nil if there’s no host.
|
||||
public static func normalizedEndpointURL(from string: String) -> URL? {
|
||||
var text = string.trimmingWhitespace
|
||||
guard !text.isEmpty else {
|
||||
return nil
|
||||
}
|
||||
if !text.contains("://") {
|
||||
text = "https://" + text
|
||||
}
|
||||
|
||||
while text.hasSuffix("/") {
|
||||
text.removeLast()
|
||||
}
|
||||
if text.hasSuffix("/v1") {
|
||||
text.removeLast(3)
|
||||
}
|
||||
while text.hasSuffix("/") {
|
||||
text.removeLast()
|
||||
}
|
||||
|
||||
guard let url = URL(string: text), let host = url.host, !host.isEmpty else {
|
||||
return nil
|
||||
}
|
||||
return url
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,446 @@
|
||||
//
|
||||
// MinifluxAPICaller.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import RSWeb
|
||||
import Secrets
|
||||
|
||||
@MainActor final class MinifluxAPICaller {
|
||||
|
||||
static let entriesPageSize = 500
|
||||
// Miniflux caps /v1/entries/ids at MaxEntryIDsLimit (10000) per response, so page at that size.
|
||||
static let entryIDsPageSize = 10000
|
||||
static let statusChunkSize = 1000
|
||||
private static let entryIDsScanAttempts = 3
|
||||
private static let feedAlreadyExistsMessage = "already exists"
|
||||
private static let jsonContentType = "application/json; charset=utf-8"
|
||||
private static let xmlContentType = "text/xml; charset=utf-8"
|
||||
|
||||
private static let minimumVersion = MinifluxVersion(2, 0, 49)
|
||||
/// For /v1/entries/ids and batch starred updates.
|
||||
private static let entryIDsMinimumVersion = MinifluxVersion(2, 3, 2)
|
||||
|
||||
private let session = URLSession.makeWebserviceSession()
|
||||
private var suspended = false
|
||||
|
||||
var credentials: Credentials?
|
||||
var accountSettings: AccountSettings?
|
||||
|
||||
/// Keychain server key: host, port, and path, so accounts on one host don’t share credentials.
|
||||
var server: String? {
|
||||
guard let apiBaseURL, let host = apiBaseURL.host else {
|
||||
return nil
|
||||
}
|
||||
var server = host
|
||||
if let port = apiBaseURL.port {
|
||||
server += ":\(port)"
|
||||
}
|
||||
var path = apiBaseURL.path
|
||||
while path.hasSuffix("/") {
|
||||
path.removeLast()
|
||||
}
|
||||
server += path
|
||||
return server
|
||||
}
|
||||
|
||||
private var apiBaseURL: URL? {
|
||||
accountSettings?.endpointURL
|
||||
}
|
||||
|
||||
/// Cancels all pending requests and rejects any that come in later.
|
||||
func suspend() {
|
||||
session.cancelAll()
|
||||
suspended = true
|
||||
}
|
||||
|
||||
func resume() {
|
||||
suspended = false
|
||||
}
|
||||
|
||||
/// Validates credentials against a caller-supplied endpoint. This runs before an Account exists,
|
||||
/// so it can’t rely on `accountSettings` (and thus not on `makeRequest`).
|
||||
func validateCredentials(endpoint: URL) async throws -> Credentials? {
|
||||
if suspended {
|
||||
throw WebserviceError.suspended
|
||||
}
|
||||
guard let credentials else {
|
||||
throw CredentialsError.missingUsername
|
||||
}
|
||||
|
||||
let callURL = endpoint.appendingPathComponent("v1/me")
|
||||
let request = URLRequest(url: callURL, credentials: credentials)
|
||||
|
||||
let validatedCredentials: Credentials
|
||||
do {
|
||||
let (_, me) = try await session.send(request: request, resultType: MinifluxUser.self)
|
||||
guard let me else {
|
||||
throw WebserviceError.noData
|
||||
}
|
||||
|
||||
validatedCredentials = credentials.username.isEmpty ? Credentials(type: credentials.type, username: me.username, secret: credentials.secret) : credentials
|
||||
} catch {
|
||||
if case WebserviceError.httpError(let status, _) = error {
|
||||
if status == HTTPResponseCode.unauthorized {
|
||||
return nil
|
||||
}
|
||||
if status == HTTPResponseCode.notFound {
|
||||
throw AccountError.urlNotFound
|
||||
}
|
||||
}
|
||||
throw error
|
||||
}
|
||||
|
||||
try await validateServerVersion(endpoint: endpoint)
|
||||
|
||||
return validatedCredentials
|
||||
}
|
||||
|
||||
/// Saves the server version, so a server upgrade is noticed. On failure, the previous version stays.
|
||||
func detectServerVersion() async {
|
||||
guard let response: MinifluxVersionResponse = try? await fetch("version") else {
|
||||
return
|
||||
}
|
||||
accountSettings?.detectedServerVersion = response.version
|
||||
}
|
||||
|
||||
func retrieveCategories() async throws -> [MinifluxCategory] {
|
||||
try await fetch("categories")
|
||||
}
|
||||
|
||||
func createCategory(title: String) async throws -> MinifluxCategory {
|
||||
var request = try makeRequest(path: "categories")
|
||||
request.addValue(Self.jsonContentType, forHTTPHeaderField: HTTPRequestHeader.contentType)
|
||||
|
||||
let payload = try JSONEncoder().encode(MinifluxCategoryPayload(title: title))
|
||||
let (_, category) = try await session.send(request: request, method: HTTPMethod.post, data: payload, resultType: MinifluxCategory.self)
|
||||
|
||||
guard let category else {
|
||||
throw WebserviceError.noData
|
||||
}
|
||||
return category
|
||||
}
|
||||
|
||||
func renameCategory(categoryID: Int, title: String) async throws {
|
||||
try await session.send(request: makeRequest(path: "categories/\(categoryID)"), method: HTTPMethod.put, payload: MinifluxCategoryPayload(title: title))
|
||||
}
|
||||
|
||||
func deleteCategory(categoryID: Int) async throws {
|
||||
try await session.send(request: makeRequest(path: "categories/\(categoryID)"), method: HTTPMethod.delete)
|
||||
}
|
||||
|
||||
func retrieveFeeds() async throws -> [MinifluxFeed] {
|
||||
try await fetch("feeds")
|
||||
}
|
||||
|
||||
/// Miniflux has no error code for an existing feed, so the error message text is the only way to tell.
|
||||
func createFeed(url urlString: String, categoryID: Int) async throws -> Int {
|
||||
var request = try makeRequest(path: "feeds")
|
||||
request.addValue(Self.jsonContentType, forHTTPHeaderField: HTTPRequestHeader.contentType)
|
||||
let payload = try JSONEncoder().encode(MinifluxCreateFeed(feedURL: urlString, categoryID: categoryID))
|
||||
|
||||
do {
|
||||
let (_, response) = try await session.send(request: request, method: HTTPMethod.post, data: payload, resultType: MinifluxCreateFeedResponse.self)
|
||||
guard let response else {
|
||||
throw WebserviceError.noData
|
||||
}
|
||||
return response.feedID
|
||||
} catch WebserviceError.httpError(let status, let responseBody?) {
|
||||
guard let errorResponse = try? JSONDecoder().decode(MinifluxErrorResponse.self, from: Data(responseBody.utf8)) else {
|
||||
throw WebserviceError.httpError(status: status, responseBody: responseBody)
|
||||
}
|
||||
if errorResponse.errorMessage.contains(Self.feedAlreadyExistsMessage) {
|
||||
throw AccountError.createErrorAlreadySubscribed
|
||||
}
|
||||
throw MinifluxError.serverError(message: errorResponse.errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
func retrieveFeed(feedID: Int) async throws -> MinifluxFeed {
|
||||
try await fetch("feeds/\(feedID)")
|
||||
}
|
||||
|
||||
func renameFeed(feedID: Int, title: String) async throws {
|
||||
try await session.send(request: makeRequest(path: "feeds/\(feedID)"), method: HTTPMethod.put, payload: MinifluxUpdateFeed(title: title, categoryID: nil))
|
||||
}
|
||||
|
||||
func moveFeed(feedID: Int, categoryID: Int) async throws {
|
||||
try await session.send(request: makeRequest(path: "feeds/\(feedID)"), method: HTTPMethod.put, payload: MinifluxUpdateFeed(title: nil, categoryID: categoryID))
|
||||
}
|
||||
|
||||
func deleteFeed(feedID: Int) async throws {
|
||||
try await session.send(request: makeRequest(path: "feeds/\(feedID)"), method: HTTPMethod.delete)
|
||||
}
|
||||
|
||||
func retrieveEntries(offset: Int, changedAfter: Date?, publishedAfter: Date?) async throws -> MinifluxEntriesResponse {
|
||||
var query = Self.entriesPageQueryItems(offset: offset)
|
||||
if let changedAfter {
|
||||
query.append(URLQueryItem(name: QueryName.changedAfter, value: String(Int(changedAfter.timeIntervalSince1970))))
|
||||
}
|
||||
if let publishedAfter {
|
||||
query.append(URLQueryItem(name: QueryName.publishedAfter, value: String(Int(publishedAfter.timeIntervalSince1970))))
|
||||
}
|
||||
|
||||
return try await fetch("entries", query: query)
|
||||
}
|
||||
|
||||
func retrieveEntries(feedID: Int, offset: Int) async throws -> MinifluxEntriesResponse {
|
||||
try await fetch("feeds/\(feedID)/entries", query: Self.entriesPageQueryItems(offset: offset))
|
||||
}
|
||||
|
||||
/// Returns `nil` if the entry has been removed server-side.
|
||||
func retrieveEntry(entryID: Int) async throws -> MinifluxEntry? {
|
||||
do {
|
||||
return try await fetch("entries/\(entryID)")
|
||||
} catch {
|
||||
if case WebserviceError.httpError(let status, _) = error, status == HTTPResponseCode.notFound {
|
||||
return nil
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
func retrieveUnreadEntryIDs() async throws -> Set<Int> {
|
||||
try await retrieveEntryIDs(matching: [URLQueryItem(name: QueryName.status, value: MinifluxEntryStatus.unread.rawValue)])
|
||||
}
|
||||
|
||||
func retrieveStarredEntryIDs() async throws -> Set<Int> {
|
||||
try await retrieveEntryIDs(matching: [URLQueryItem(name: QueryName.starred, value: QueryValue.true)])
|
||||
}
|
||||
|
||||
func updateEntries(entryIDs: [Int], read: Bool) async throws {
|
||||
try await updateEntries(entryIDs: entryIDs, payload: MinifluxUpdateEntriesPayload(entryIDs: entryIDs, status: read ? .read : .unread, starred: nil))
|
||||
}
|
||||
|
||||
/// Older servers have no batch starred update, only a per-entry toggle.
|
||||
func updateEntries(entryIDs: [Int], starred: Bool) async throws {
|
||||
guard !entryIDs.isEmpty else {
|
||||
return
|
||||
}
|
||||
if supportsBatchStarredUpdates {
|
||||
try await updateEntries(entryIDs: entryIDs, payload: MinifluxUpdateEntriesPayload(entryIDs: entryIDs, status: nil, starred: starred))
|
||||
} else {
|
||||
try await updateEntriesStarredFallback(entryIDs: entryIDs, starred: starred)
|
||||
}
|
||||
}
|
||||
|
||||
/// Synchronous — Miniflux’s OPML import doesn’t require polling for completion.
|
||||
func importOPML(opmlData: Data) async throws {
|
||||
var request = try makeRequest(path: "import")
|
||||
request.addValue(Self.xmlContentType, forHTTPHeaderField: HTTPRequestHeader.contentType)
|
||||
|
||||
_ = try await session.send(request: request, method: HTTPMethod.post, payload: opmlData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private extension MinifluxAPICaller {
|
||||
|
||||
struct QueryName {
|
||||
static let afterEntryID = "after_entry_id"
|
||||
static let changedAfter = "changed_after"
|
||||
static let direction = "direction"
|
||||
static let limit = "limit"
|
||||
static let offset = "offset"
|
||||
static let order = "order"
|
||||
static let publishedAfter = "published_after"
|
||||
static let starred = "starred"
|
||||
static let status = "status"
|
||||
}
|
||||
|
||||
struct QueryValue {
|
||||
static let ascending = "asc"
|
||||
static let id = "id"
|
||||
static let `true` = "true"
|
||||
}
|
||||
|
||||
/// Builds an authenticated request for `v1/<path>`, honoring `suspend()`.
|
||||
func makeRequest(path: String, query: [URLQueryItem] = []) throws -> URLRequest {
|
||||
if suspended {
|
||||
throw WebserviceError.suspended
|
||||
}
|
||||
return URLRequest(url: try apiURL(path: path, queryItems: query), credentials: credentials)
|
||||
}
|
||||
|
||||
/// Sends a GET for `v1/<path>` and decodes the JSON body.
|
||||
func fetch<R: Decodable & Sendable>(_ path: String, query: [URLQueryItem] = []) async throws -> R {
|
||||
let (_, result) = try await session.send(request: makeRequest(path: path, query: query), resultType: R.self)
|
||||
guard let result else {
|
||||
throw WebserviceError.noData
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/// Uses `/v1/entries/ids` when the server has it, and pages `/v1/entries` otherwise.
|
||||
func retrieveEntryIDs(matching filter: [URLQueryItem]) async throws -> Set<Int> {
|
||||
guard supportsEntryIDsEndpoint else {
|
||||
return try await retrieveEntryIDsByPagingEntries(matching: filter)
|
||||
}
|
||||
|
||||
for _ in 0..<Self.entryIDsScanAttempts {
|
||||
if let entryIDs = try await scanEntryIDs(matching: filter) {
|
||||
return entryIDs
|
||||
}
|
||||
}
|
||||
throw MinifluxError.entriesChangedDuringSync
|
||||
}
|
||||
|
||||
/// Returns nil if `total` changed during the scan, since offset paging may then have skipped IDs.
|
||||
func scanEntryIDs(matching filter: [URLQueryItem]) async throws -> Set<Int>? {
|
||||
var entryIDs = Set<Int>()
|
||||
var offset = 0
|
||||
var firstTotal: Int?
|
||||
|
||||
while true {
|
||||
let query = filter + [
|
||||
URLQueryItem(name: QueryName.limit, value: String(Self.entryIDsPageSize)),
|
||||
URLQueryItem(name: QueryName.offset, value: String(offset))
|
||||
]
|
||||
let response: MinifluxEntryIDsResponse = try await fetch("entries/ids", query: query)
|
||||
|
||||
if let firstTotal, firstTotal != response.total {
|
||||
return nil
|
||||
}
|
||||
firstTotal = response.total
|
||||
|
||||
entryIDs.formUnion(response.entryIDs)
|
||||
offset += response.entryIDs.count
|
||||
if response.entryIDs.isEmpty || offset >= response.total {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return entryIDs
|
||||
}
|
||||
|
||||
/// For servers without `/v1/entries/ids`.
|
||||
func retrieveEntryIDsByPagingEntries(matching filter: [URLQueryItem]) async throws -> Set<Int> {
|
||||
var entryIDs = Set<Int>()
|
||||
var afterEntryID = 0
|
||||
|
||||
// Keyset paging, since offset paging skips IDs when the filtered set shrinks during the scan.
|
||||
while true {
|
||||
let query = filter + [
|
||||
URLQueryItem(name: QueryName.order, value: QueryValue.id),
|
||||
URLQueryItem(name: QueryName.direction, value: QueryValue.ascending),
|
||||
URLQueryItem(name: QueryName.limit, value: String(Self.entriesPageSize)),
|
||||
URLQueryItem(name: QueryName.afterEntryID, value: String(afterEntryID))
|
||||
]
|
||||
let response: MinifluxEntriesResponse = try await fetch("entries", query: query)
|
||||
guard let lastEntryID = response.entries.map(\.entryID).max() else {
|
||||
break
|
||||
}
|
||||
entryIDs.formUnion(response.entries.map(\.entryID))
|
||||
if response.entries.count >= response.total {
|
||||
break
|
||||
}
|
||||
afterEntryID = lastEntryID
|
||||
}
|
||||
|
||||
return entryIDs
|
||||
}
|
||||
|
||||
func updateEntries(entryIDs: [Int], payload: MinifluxUpdateEntriesPayload) async throws {
|
||||
guard !entryIDs.isEmpty else {
|
||||
return
|
||||
}
|
||||
try await session.send(request: makeRequest(path: "entries"), method: HTTPMethod.put, payload: payload)
|
||||
}
|
||||
|
||||
/// Older servers only have a toggle, so this toggles only entries whose starred state differs.
|
||||
/// Not atomic: a change made elsewhere between the fetch and the toggle gets flipped.
|
||||
func updateEntriesStarredFallback(entryIDs: [Int], starred: Bool) async throws {
|
||||
for entryID in entryIDs {
|
||||
guard let entry = try await retrieveEntry(entryID: entryID) else {
|
||||
continue
|
||||
}
|
||||
// Unknown state can’t be toggled safely, and the correct state needs no toggle.
|
||||
guard let entryStarred = entry.starred, entryStarred != starred else {
|
||||
continue
|
||||
}
|
||||
try await toggleBookmark(entryID: entryID)
|
||||
}
|
||||
}
|
||||
|
||||
func toggleBookmark(entryID: Int) async throws {
|
||||
try await session.send(request: makeRequest(path: "entries/\(entryID)/bookmark"), method: HTTPMethod.put)
|
||||
}
|
||||
|
||||
static func entriesPageQueryItems(offset: Int) -> [URLQueryItem] {
|
||||
[
|
||||
URLQueryItem(name: QueryName.order, value: QueryValue.id),
|
||||
URLQueryItem(name: QueryName.direction, value: QueryValue.ascending),
|
||||
URLQueryItem(name: QueryName.limit, value: String(entriesPageSize)),
|
||||
URLQueryItem(name: QueryName.offset, value: String(offset))
|
||||
]
|
||||
}
|
||||
|
||||
/// The caller has already validated the credentials, so a 404 means the server predates `/v1/version` (2.0.49).
|
||||
func validateServerVersion(endpoint: URL) async throws {
|
||||
let response: MinifluxVersionResponse
|
||||
do {
|
||||
response = try await fetchVersionResponse(endpoint: endpoint)
|
||||
} catch {
|
||||
if case WebserviceError.httpError(let status, _) = error, status == HTTPResponseCode.notFound {
|
||||
throw MinifluxError.serverVersionTooOld(foundVersion: nil)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
|
||||
guard let version = MinifluxVersion(string: response.version) else {
|
||||
return
|
||||
}
|
||||
guard version >= Self.minimumVersion else {
|
||||
throw MinifluxError.serverVersionTooOld(foundVersion: response.version)
|
||||
}
|
||||
}
|
||||
|
||||
func fetchVersionResponse(endpoint: URL) async throws -> MinifluxVersionResponse {
|
||||
let callURL = endpoint.appendingPathComponent("v1/version")
|
||||
let request = URLRequest(url: callURL, credentials: credentials)
|
||||
let (_, versionResponse) = try await session.send(request: request, resultType: MinifluxVersionResponse.self)
|
||||
guard let versionResponse else {
|
||||
throw WebserviceError.noData
|
||||
}
|
||||
return versionResponse
|
||||
}
|
||||
|
||||
/// Nil until `detectServerVersion()` has succeeded once.
|
||||
var detectedVersion: MinifluxVersion? {
|
||||
MinifluxVersion(string: accountSettings?.detectedServerVersion)
|
||||
}
|
||||
|
||||
/// False when the version is unknown, since the fallback works on every supported server.
|
||||
var supportsEntryIDsEndpoint: Bool {
|
||||
guard let detectedVersion else {
|
||||
return false
|
||||
}
|
||||
return detectedVersion >= Self.entryIDsMinimumVersion
|
||||
}
|
||||
|
||||
var supportsBatchStarredUpdates: Bool {
|
||||
// Batch starred updates arrived in 2.3.2, along with the ids endpoint.
|
||||
supportsEntryIDsEndpoint
|
||||
}
|
||||
|
||||
func apiURL(path: String, queryItems: [URLQueryItem] = []) throws -> URL {
|
||||
guard let apiBaseURL else {
|
||||
throw CredentialsError.missingEndpointURL
|
||||
}
|
||||
|
||||
let base = apiBaseURL.appendingPathComponent("v1/\(path)")
|
||||
guard !queryItems.isEmpty else {
|
||||
return base
|
||||
}
|
||||
|
||||
guard let url = base.appendingQueryItems(queryItems) else {
|
||||
throw WebserviceError.noURL
|
||||
}
|
||||
return url
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// MinifluxCategory.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// GET /v1/categories → [{"id":38,"title":"All","user_id":35,"hide_globally":false},...]
|
||||
// A Miniflux category maps one-to-one to an NNW folder.
|
||||
struct MinifluxCategory: Decodable, Sendable {
|
||||
let categoryID: Int
|
||||
let title: String
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case categoryID = "id"
|
||||
case title
|
||||
}
|
||||
}
|
||||
|
||||
// Used for both category creation and rename — Miniflux takes the same body for both.
|
||||
struct MinifluxCategoryPayload: Encodable, Sendable {
|
||||
let title: String
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// MinifluxEntry.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import RSParser
|
||||
|
||||
// GET /v1/entries?limit=1 → {"total":2043,"entries":[{"id":121624,"feed_id":310,"status":"unread",
|
||||
// "hash":"...","title":"...","url":"...","published_at":"2026-07-07T05:12:06Z",
|
||||
// "created_at":"2026-07-07T05:13:22.668113Z","changed_at":"2026-07-07T05:13:22.668113Z",
|
||||
// "content":"...","author":"...","starred":false,"reading_time":1,"enclosures":[],
|
||||
// "feed":{...},"tags":[...]}]}
|
||||
struct MinifluxEntry: Decodable, Sendable {
|
||||
let entryID: Int
|
||||
let feedID: Int
|
||||
let title: String?
|
||||
let url: String?
|
||||
let author: String?
|
||||
let contentHTML: String?
|
||||
let datePublished: String?
|
||||
let enclosures: [MinifluxEnclosure]?
|
||||
let status: MinifluxEntryStatus?
|
||||
let starred: Bool?
|
||||
|
||||
/// Decoded as a String, since JSONDecoder’s .iso8601 strategy can’t parse Miniflux’s fractional seconds.
|
||||
var parsedDatePublished: Date? {
|
||||
guard let datePublished else {
|
||||
return nil
|
||||
}
|
||||
return DateParser.date(from: datePublished)
|
||||
}
|
||||
|
||||
var attachments: [ParsedAttachment]? {
|
||||
let attachments = enclosures?.compactMap { $0.parsedAttachment } ?? []
|
||||
return attachments.isEmpty ? nil : attachments
|
||||
}
|
||||
|
||||
var imageURL: String? {
|
||||
enclosures?.first { $0.isImage }?.url
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case entryID = "id"
|
||||
case feedID = "feed_id"
|
||||
case title
|
||||
case url
|
||||
case author
|
||||
case contentHTML = "content"
|
||||
case datePublished = "published_at"
|
||||
case enclosures
|
||||
case status
|
||||
case starred
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
entryID = try container.decode(Int.self, forKey: .entryID)
|
||||
feedID = try container.decode(Int.self, forKey: .feedID)
|
||||
title = try? container.decode(String.self, forKey: .title)
|
||||
url = try? container.decode(String.self, forKey: .url)
|
||||
author = try? container.decode(String.self, forKey: .author)
|
||||
contentHTML = try? container.decode(String.self, forKey: .contentHTML)
|
||||
datePublished = try? container.decode(String.self, forKey: .datePublished)
|
||||
enclosures = try? container.decode([MinifluxEnclosure].self, forKey: .enclosures)
|
||||
status = try? container.decode(MinifluxEntryStatus.self, forKey: .status)
|
||||
starred = try? container.decode(Bool.self, forKey: .starred)
|
||||
}
|
||||
}
|
||||
|
||||
enum MinifluxEntryStatus: String, Codable, Sendable {
|
||||
case read
|
||||
case unread
|
||||
case removed
|
||||
}
|
||||
|
||||
struct MinifluxEnclosure: Decodable, Sendable {
|
||||
let url: String?
|
||||
let mimeType: String?
|
||||
let size: Int?
|
||||
|
||||
var parsedAttachment: ParsedAttachment? {
|
||||
guard let url else {
|
||||
return nil
|
||||
}
|
||||
return ParsedAttachment(url: url, mimeType: mimeType, title: nil, sizeInBytes: sizeInBytes, durationInSeconds: nil, width: nil, height: nil, medium: nil)
|
||||
}
|
||||
|
||||
var isImage: Bool {
|
||||
mimeType?.lowercased().hasPrefix("image/") == true
|
||||
}
|
||||
|
||||
private var sizeInBytes: Int? {
|
||||
guard let size, size > 0 else {
|
||||
return nil
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case url
|
||||
case mimeType = "mime_type"
|
||||
case size
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
url = try? container.decode(String.self, forKey: .url)
|
||||
mimeType = try? container.decode(String.self, forKey: .mimeType)
|
||||
size = try? container.decode(Int.self, forKey: .size)
|
||||
}
|
||||
}
|
||||
|
||||
struct MinifluxEntriesResponse: Decodable, Sendable {
|
||||
let total: Int
|
||||
let entries: [MinifluxEntry]
|
||||
}
|
||||
|
||||
// GET /v1/entries/ids?status=unread → {"total":1960,"entry_ids":[121634,121624,...]}
|
||||
struct MinifluxEntryIDsResponse: Decodable, Sendable {
|
||||
let total: Int
|
||||
let entryIDs: [Int]
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case total
|
||||
case entryIDs = "entry_ids"
|
||||
}
|
||||
}
|
||||
|
||||
struct MinifluxUpdateEntriesPayload: Encodable, Sendable {
|
||||
let entryIDs: [Int]
|
||||
let status: MinifluxEntryStatus?
|
||||
let starred: Bool?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case entryIDs = "entry_ids"
|
||||
case status
|
||||
case starred
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// MinifluxError.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// Miniflux error responses look like: {"error_message": "This feed already exists (feed_id: 123)"}
|
||||
struct MinifluxErrorResponse: Decodable, Sendable {
|
||||
let errorMessage: String
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case errorMessage = "error_message"
|
||||
}
|
||||
}
|
||||
|
||||
enum MinifluxError: LocalizedError {
|
||||
|
||||
case serverVersionTooOld(foundVersion: String?)
|
||||
case serverError(message: String)
|
||||
case entriesChangedDuringSync
|
||||
|
||||
var errorDescription: String? {
|
||||
switch self {
|
||||
case .serverVersionTooOld(let foundVersion):
|
||||
guard let foundVersion else {
|
||||
return NSLocalizedString("NetNewsWire requires Miniflux 2.0.49 or later.", comment: "Server version too old")
|
||||
}
|
||||
let localizedText = NSLocalizedString("This Miniflux server is version %@, but NetNewsWire requires Miniflux 2.0.49 or later.", comment: "Server version too old")
|
||||
return NSString.localizedStringWithFormat(localizedText as NSString, foundVersion) as String
|
||||
case .serverError(let message):
|
||||
let localizedText = NSLocalizedString("The Miniflux server reported an error: %@", comment: "Server error")
|
||||
return NSString.localizedStringWithFormat(localizedText as NSString, message) as String
|
||||
case .entriesChangedDuringSync:
|
||||
return NSLocalizedString("Articles on the Miniflux server kept changing during sync. NetNewsWire will try again on the next refresh.", comment: "Entries changed during sync")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// MinifluxFeed.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// GET /v1/feeds → [{"id":311,"feed_url":"...","site_url":"...","title":"...",
|
||||
// "category":{"id":39,...},"icon":{"feed_id":311,...},...}]
|
||||
struct MinifluxFeed: Decodable, Sendable {
|
||||
let feedID: Int
|
||||
let feedURL: String
|
||||
let siteURL: String?
|
||||
let title: String?
|
||||
let category: MinifluxCategory?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case feedID = "id"
|
||||
case feedURL = "feed_url"
|
||||
case siteURL = "site_url"
|
||||
case title
|
||||
case category
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
feedID = try container.decode(Int.self, forKey: .feedID)
|
||||
feedURL = try container.decode(String.self, forKey: .feedURL)
|
||||
siteURL = try? container.decode(String.self, forKey: .siteURL)
|
||||
title = try? container.decode(String.self, forKey: .title)
|
||||
// Decoded leniently: older servers, or feeds mid-import, may omit or malform this.
|
||||
category = try? container.decode(MinifluxCategory.self, forKey: .category)
|
||||
}
|
||||
}
|
||||
|
||||
struct MinifluxCreateFeed: Encodable, Sendable {
|
||||
let feedURL: String
|
||||
let categoryID: Int
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case feedURL = "feed_url"
|
||||
case categoryID = "category_id"
|
||||
}
|
||||
}
|
||||
|
||||
struct MinifluxCreateFeedResponse: Decodable, Sendable {
|
||||
let feedID: Int
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case feedID = "feed_id"
|
||||
}
|
||||
}
|
||||
|
||||
// Only non-nil properties are encoded, so callers can send a title-only or category-only update.
|
||||
struct MinifluxUpdateFeed: Encodable, Sendable {
|
||||
let title: String?
|
||||
let categoryID: Int?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case title
|
||||
case categoryID = "category_id"
|
||||
}
|
||||
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(title, forKey: .title)
|
||||
try container.encodeIfPresent(categoryID, forKey: .categoryID)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// MinifluxUser.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// GET /v1/me → {"id":35,"username":"claude","is_admin":false,...}
|
||||
struct MinifluxUser: Decodable, Sendable {
|
||||
let username: String
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// MinifluxVersion.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Dave Marquard on 7/8/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// GET /v1/version → {"version":"2.3.2","commit":"...","build_date":"...",...}
|
||||
struct MinifluxVersionResponse: Decodable, Sendable {
|
||||
let version: String
|
||||
}
|
||||
|
||||
/// A dotted numeric version, e.g. "2.3.2". Tolerates a non-numeric suffix on the last
|
||||
/// component, e.g. "2.3.2-dev", but fails to parse a wholly non-numeric component.
|
||||
struct MinifluxVersion: Comparable, Sendable {
|
||||
|
||||
private let components: [Int]
|
||||
|
||||
init(_ components: Int...) {
|
||||
self.components = components
|
||||
}
|
||||
|
||||
init?(string: String?) {
|
||||
guard let string else {
|
||||
return nil
|
||||
}
|
||||
let parts = string.split(separator: ".")
|
||||
guard !parts.isEmpty else {
|
||||
return nil
|
||||
}
|
||||
|
||||
var parsedComponents = [Int]()
|
||||
for part in parts {
|
||||
let digits = part.prefix { $0.isNumber }
|
||||
guard let value = Int(digits) else {
|
||||
return nil
|
||||
}
|
||||
parsedComponents.append(value)
|
||||
}
|
||||
|
||||
components = parsedComponents
|
||||
}
|
||||
|
||||
static func == (lhs: MinifluxVersion, rhs: MinifluxVersion) -> Bool {
|
||||
lhs.compare(rhs) == .orderedSame
|
||||
}
|
||||
|
||||
static func < (lhs: MinifluxVersion, rhs: MinifluxVersion) -> Bool {
|
||||
lhs.compare(rhs) == .orderedAscending
|
||||
}
|
||||
|
||||
private func compare(_ other: MinifluxVersion) -> ComparisonResult {
|
||||
let count = max(components.count, other.components.count)
|
||||
for i in 0..<count {
|
||||
let lhsValue = i < components.count ? components[i] : 0
|
||||
let rhsValue = i < other.components.count ? other.components[i] : 0
|
||||
if lhsValue != rhsValue {
|
||||
return lhsValue < rhsValue ? .orderedAscending : .orderedDescending
|
||||
}
|
||||
}
|
||||
return .orderedSame
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,13 @@ public extension URLRequest {
|
||||
case .readerAPIKey:
|
||||
let auth = "GoogleLogin auth=\(credentials.secret)"
|
||||
setValue(auth, forHTTPHeaderField: HTTPRequestHeader.authorization)
|
||||
case .minifluxBasic:
|
||||
let data = Data("\(credentials.username):\(credentials.secret)".utf8)
|
||||
let base64 = data.base64EncodedString()
|
||||
let auth = "Basic \(base64)"
|
||||
setValue(auth, forHTTPHeaderField: HTTPRequestHeader.authorization)
|
||||
case .minifluxAPIToken:
|
||||
setValue(credentials.secret, forHTTPHeaderField: HTTPRequestHeader.minifluxAuthToken)
|
||||
case .oauthAccessToken:
|
||||
let auth = "OAuth \(credentials.secret)"
|
||||
setValue(auth, forHTTPHeaderField: "Authorization")
|
||||
@@ -77,3 +84,8 @@ public extension URLRequest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension HTTPRequestHeader {
|
||||
|
||||
static let minifluxAuthToken = "X-Auth-Token"
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// AccountManagerDuplicateEndpointTests.swift
|
||||
// AccountTests
|
||||
//
|
||||
// Created by Dave Marquard on 7/15/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Account
|
||||
|
||||
@MainActor struct AccountManagerDuplicateEndpointTests {
|
||||
|
||||
@Test func hostCaseTrailingSlashSchemeAndDefaultPortAreIgnored() {
|
||||
let endpoint = AccountManager.normalizedEndpointForComparison(URL(string: "https://miniflux.example.com"))
|
||||
#expect(AccountManager.normalizedEndpointForComparison(URL(string: "https://Miniflux.Example.com/")) == endpoint)
|
||||
#expect(AccountManager.normalizedEndpointForComparison(URL(string: "https://miniflux.example.com:443")) == endpoint)
|
||||
#expect(AccountManager.normalizedEndpointForComparison(URL(string: "http://miniflux.example.com")) == endpoint)
|
||||
}
|
||||
|
||||
@Test func differentPathsDoNotMatch() {
|
||||
let first = AccountManager.normalizedEndpointForComparison(URL(string: "https://example.com/miniflux"))
|
||||
let second = AccountManager.normalizedEndpointForComparison(URL(string: "https://example.com/other"))
|
||||
#expect(first != second)
|
||||
}
|
||||
|
||||
@Test func duplicateRequiresSameUsernameAndServer() {
|
||||
let existingAccount = TestAccountManager.shared.createAccount(type: .miniflux)
|
||||
defer {
|
||||
TestAccountManager.shared.deleteAccount(existingAccount)
|
||||
}
|
||||
existingAccount.username = "admin"
|
||||
existingAccount.endpointURL = URL(string: "https://first.miniflux.test")
|
||||
|
||||
#expect(AccountManager.duplicateServiceAccount(type: .miniflux, username: "admin", endpoint: URL(string: "https://first.miniflux.test"), among: [existingAccount]))
|
||||
#expect(!AccountManager.duplicateServiceAccount(type: .miniflux, username: "admin", endpoint: URL(string: "https://second.miniflux.test"), among: [existingAccount]))
|
||||
#expect(!AccountManager.duplicateServiceAccount(type: .miniflux, username: "claude", endpoint: URL(string: "https://first.miniflux.test"), among: [existingAccount]))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"title": "All",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Tech",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "News",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Reviews",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"title": "All",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Tech",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"title": "All",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Tech",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "News",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"total": 5,
|
||||
"entries": [
|
||||
{
|
||||
"id": 5001,
|
||||
"feed_id": 101,
|
||||
"status": "unread",
|
||||
"hash": "hash5001",
|
||||
"title": "Unread and starred entry",
|
||||
"url": "https://general.example/posts/1",
|
||||
"published_at": "2026-07-07T05:12:06.668113Z",
|
||||
"created_at": "2026-07-07T05:13:22.668113Z",
|
||||
"changed_at": "2026-07-07T05:13:22.668113Z",
|
||||
"content": "<p>Body of the unread starred entry.</p>",
|
||||
"author": "Jane Doe",
|
||||
"starred": true,
|
||||
"reading_time": 2,
|
||||
"feed_id_str": "101"
|
||||
},
|
||||
{
|
||||
"id": 5002,
|
||||
"feed_id": 102,
|
||||
"status": "read",
|
||||
"hash": "hash5002",
|
||||
"title": "Read entry",
|
||||
"url": "https://tech-a.example/posts/2",
|
||||
"published_at": "2026-07-06T09:00:00Z",
|
||||
"created_at": "2026-07-06T09:05:00Z",
|
||||
"changed_at": "2026-07-06T09:05:00Z",
|
||||
"content": "<p>Body of the read entry.</p>",
|
||||
"author": "John Smith",
|
||||
"starred": false,
|
||||
"reading_time": 4
|
||||
},
|
||||
{
|
||||
"id": 5003,
|
||||
"feed_id": 103,
|
||||
"status": "unread",
|
||||
"hash": "hash5003",
|
||||
"title": "Entry with no author",
|
||||
"url": "https://tech-b.example/posts/3",
|
||||
"published_at": "2026-07-05T12:30:00Z",
|
||||
"created_at": "2026-07-05T12:31:00Z",
|
||||
"changed_at": "2026-07-05T12:31:00Z",
|
||||
"content": "<p>Body of the entry with no author.</p>",
|
||||
"starred": false,
|
||||
"reading_time": 1
|
||||
},
|
||||
{
|
||||
"id": 5004,
|
||||
"feed_id": 104,
|
||||
"status": "unread",
|
||||
"hash": "hash5004",
|
||||
"title": "Entry with empty enclosures",
|
||||
"url": "https://news-a.example/posts/4",
|
||||
"published_at": "2026-07-04T08:15:00Z",
|
||||
"created_at": "2026-07-04T08:16:00Z",
|
||||
"changed_at": "2026-07-04T08:16:00Z",
|
||||
"content": "<p>Body of the entry with empty enclosures.</p>",
|
||||
"author": "News Desk",
|
||||
"starred": false,
|
||||
"reading_time": 3,
|
||||
"enclosures": []
|
||||
},
|
||||
{
|
||||
"id": 5005,
|
||||
"feed_id": 105,
|
||||
"status": "read",
|
||||
"hash": "hash5005",
|
||||
"title": "Entry with an enclosure",
|
||||
"url": "https://general-b.example/posts/5",
|
||||
"published_at": "2026-07-03T18:45:00Z",
|
||||
"created_at": "2026-07-03T18:46:00Z",
|
||||
"changed_at": "2026-07-03T18:46:00Z",
|
||||
"content": "<p>Body of the entry with an enclosure.</p>",
|
||||
"author": "Jane Doe",
|
||||
"starred": false,
|
||||
"reading_time": 5,
|
||||
"enclosures": [
|
||||
{
|
||||
"url": "https://media.example/ep1.mp3",
|
||||
"mime_type": "audio/mpeg",
|
||||
"size": 1234567
|
||||
},
|
||||
{
|
||||
"url": "https://media.example/ep1.jpg",
|
||||
"mime_type": "image/jpeg",
|
||||
"size": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"id": 5001,
|
||||
"feed_id": 101,
|
||||
"status": "unread",
|
||||
"hash": "hash5001",
|
||||
"title": "Unread and starred entry",
|
||||
"url": "https://general.example/posts/1",
|
||||
"published_at": "2026-07-07T05:12:06.668113Z",
|
||||
"created_at": "2026-07-07T05:13:22.668113Z",
|
||||
"changed_at": "2026-07-07T05:13:22.668113Z",
|
||||
"content": "<p>Body of the unread starred entry.</p>",
|
||||
"author": "Jane Doe",
|
||||
"starred": true,
|
||||
"reading_time": 2
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"id": 5002,
|
||||
"feed_id": 102,
|
||||
"status": "read",
|
||||
"hash": "hash5002",
|
||||
"title": "Read entry",
|
||||
"url": "https://tech-a.example/posts/2",
|
||||
"published_at": "2026-07-06T09:00:00Z",
|
||||
"created_at": "2026-07-06T09:05:00Z",
|
||||
"changed_at": "2026-07-06T09:05:00Z",
|
||||
"content": "<p>Body of the read entry.</p>",
|
||||
"author": "John Smith",
|
||||
"starred": false,
|
||||
"reading_time": 4
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"total": 3,
|
||||
"entry_ids": [5001, 5003, 5004]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"total": 1,
|
||||
"entry_ids": [9001]
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
[
|
||||
{
|
||||
"id": 101,
|
||||
"feed_url": "https://miniflux.test/feeds/general.xml",
|
||||
"site_url": "https://general.example",
|
||||
"title": "General Feed",
|
||||
"checked_at": "2026-07-07T05:00:00Z",
|
||||
"category": {
|
||||
"id": 1,
|
||||
"title": "All",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
"icon": {
|
||||
"feed_id": 101,
|
||||
"icon_id": 201,
|
||||
"external_icon_id": "abc101"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 102,
|
||||
"feed_url": "https://tech-a.example/rss.xml",
|
||||
"site_url": "https://tech-a.example",
|
||||
"title": "Tech Feed A",
|
||||
"checked_at": "2026-07-07T05:00:00Z",
|
||||
"category": {
|
||||
"id": 2,
|
||||
"title": "Tech",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
"icon": {
|
||||
"feed_id": 102,
|
||||
"icon_id": 202,
|
||||
"external_icon_id": "abc102"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 103,
|
||||
"feed_url": "https://tech-b.example/feed",
|
||||
"site_url": "https://tech-b.example",
|
||||
"title": "Tech Feed B",
|
||||
"checked_at": "2026-07-07T05:00:00Z",
|
||||
"category": {
|
||||
"id": 2,
|
||||
"title": "Tech",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
"icon": {
|
||||
"feed_id": 103,
|
||||
"icon_id": 203,
|
||||
"external_icon_id": "abc103"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 104,
|
||||
"feed_url": "https://news-a.example/atom.xml",
|
||||
"site_url": "https://news-a.example",
|
||||
"title": "News Feed A",
|
||||
"checked_at": "2026-07-07T05:00:00Z",
|
||||
"category": {
|
||||
"id": 3,
|
||||
"title": "News",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
},
|
||||
"icon": {
|
||||
"feed_id": 104,
|
||||
"icon_id": 204,
|
||||
"external_icon_id": "abc104"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 105,
|
||||
"feed_url": "https://general-b.example/feed.json",
|
||||
"site_url": "https://general-b.example",
|
||||
"title": "General Feed B",
|
||||
"checked_at": "2026-07-07T05:00:00Z",
|
||||
"category": {
|
||||
"id": 1,
|
||||
"title": "All",
|
||||
"user_id": 35,
|
||||
"hide_globally": false
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "2.3.2",
|
||||
"commit": "abc1234",
|
||||
"build_date": "2026-06-01T00:00:00Z",
|
||||
"go_version": "go1.24.0",
|
||||
"compiler": "gc",
|
||||
"arch": "arm64",
|
||||
"os": "linux"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"commit": "def5678",
|
||||
"build_date": "2026-01-01T00:00:00Z",
|
||||
"go_version": "go1.23.0",
|
||||
"compiler": "gc",
|
||||
"arch": "amd64",
|
||||
"os": "linux"
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// AccountMinifluxFolderSyncTest.swift
|
||||
// AccountTests
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Testing
|
||||
import RSWeb
|
||||
@testable import Account
|
||||
|
||||
@Suite(.isolatedWebserviceResponses) @MainActor struct AccountMinifluxFolderSyncTest {
|
||||
|
||||
@Test func feedsLandInTheirCategoryFolders() async throws {
|
||||
setInitialSyncResponses()
|
||||
|
||||
let account = TestAccountManager.shared.createAccount(type: .miniflux)
|
||||
defer {
|
||||
TestAccountManager.shared.deleteAccount(account)
|
||||
}
|
||||
account.endpointURL = URL(string: "https://miniflux.test")
|
||||
|
||||
try await account.refreshAll()
|
||||
|
||||
#expect(folderExternalIDsByName(account) == ["All": "1", "Tech": "2", "News": "3"])
|
||||
#expect(feedExternalIDsByFolderName(account) == ["All": ["101", "105"], "Tech": ["102", "103"], "News": ["104"]])
|
||||
#expect(account.topLevelFeeds.isEmpty)
|
||||
|
||||
let generalFeed = try #require(account.existingFeed(withExternalID: "101"))
|
||||
#expect(generalFeed.url == "https://miniflux.test/feeds/general.xml")
|
||||
#expect(generalFeed.name == "General Feed")
|
||||
}
|
||||
|
||||
@Test func removedAndAddedCategoriesUpdateFolders() async throws {
|
||||
setInitialSyncResponses()
|
||||
|
||||
let account = TestAccountManager.shared.createAccount(type: .miniflux)
|
||||
defer {
|
||||
TestAccountManager.shared.deleteAccount(account)
|
||||
}
|
||||
account.endpointURL = URL(string: "https://miniflux.test")
|
||||
|
||||
try await account.refreshAll()
|
||||
|
||||
TestingURLProtocol.setResponse("/v1/categories", file: "JSON/miniflux_categories_delete.json")
|
||||
try await account.refreshAll()
|
||||
#expect(folderExternalIDsByName(account) == ["All": "1", "Tech": "2"])
|
||||
|
||||
TestingURLProtocol.setResponse("/v1/categories", file: "JSON/miniflux_categories_add.json")
|
||||
try await account.refreshAll()
|
||||
#expect(folderExternalIDsByName(account) == ["All": "1", "Tech": "2", "News": "3", "Reviews": "4"])
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private func setInitialSyncResponses() {
|
||||
TestingURLProtocol.setResponse("/v1/version", file: "JSON/miniflux_version.json")
|
||||
TestingURLProtocol.setResponse("/v1/categories", file: "JSON/miniflux_categories_initial.json")
|
||||
TestingURLProtocol.setResponse("/v1/feeds", file: "JSON/miniflux_feeds_initial.json")
|
||||
TestingURLProtocol.setResponse("/v1/entries/ids", file: "JSON/miniflux_entry_ids.json")
|
||||
TestingURLProtocol.setResponse("/v1/entries?", file: "JSON/miniflux_entries_page1.json")
|
||||
}
|
||||
|
||||
@MainActor private func folderExternalIDsByName(_ account: Account) -> [String: String] {
|
||||
var externalIDsByName = [String: String]()
|
||||
for folder in account.folders ?? [] {
|
||||
externalIDsByName[folder.name ?? ""] = folder.externalID
|
||||
}
|
||||
return externalIDsByName
|
||||
}
|
||||
|
||||
@MainActor private func feedExternalIDsByFolderName(_ account: Account) -> [String: Set<String>] {
|
||||
var externalIDsByName = [String: Set<String>]()
|
||||
for folder in account.folders ?? [] {
|
||||
externalIDsByName[folder.name ?? ""] = Set(folder.topLevelFeeds.map { $0.externalID ?? "" })
|
||||
}
|
||||
return externalIDsByName
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// MinifluxEndpointURLTests.swift
|
||||
// AccountTests
|
||||
//
|
||||
// Created by Brent Simmons on 11/25/26.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Account
|
||||
|
||||
@MainActor struct MinifluxEndpointURLTests {
|
||||
|
||||
@Test func pastedAPIURLBecomesBaseURL() {
|
||||
#expect(Miniflux.normalizedEndpointURL(from: " miniflux.example.com/v1/ ") == URL(string: "https://miniflux.example.com"))
|
||||
}
|
||||
|
||||
@Test func schemeWithNoHostIsRejected() {
|
||||
#expect(Miniflux.normalizedEndpointURL(from: "https://") == nil)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// MinifluxEntryIDPagingTests.swift
|
||||
// AccountTests
|
||||
//
|
||||
// Created by Brent Simmons on 11/24/26.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Testing
|
||||
import RSWeb
|
||||
import Secrets
|
||||
@testable import Account
|
||||
|
||||
@Suite(.isolatedWebserviceResponses) @MainActor struct MinifluxEntryIDPagingTests {
|
||||
|
||||
/// Entry 1 is read on another device after the first page. Offset paging would then skip entry 3.
|
||||
@Test func pagingByEntryIDDoesNotSkipWhenUnreadSetShrinks() async throws {
|
||||
TestingURLProtocol.setResponse(entriesResponse(entryIDs: [1, 2], total: 4), forURLContaining: "after_entry_id=0")
|
||||
TestingURLProtocol.setResponse(entriesResponse(entryIDs: [3, 4], total: 2), forURLContaining: "after_entry_id=2")
|
||||
|
||||
let accountSettings = AccountSettings(accountID: UUID().uuidString, dataFolder: NSTemporaryDirectory())
|
||||
defer {
|
||||
accountSettings.deleteSettings()
|
||||
}
|
||||
accountSettings.endpointURL = URL(string: "https://miniflux.test")
|
||||
accountSettings.detectedServerVersion = "2.1.0"
|
||||
|
||||
let caller = MinifluxAPICaller()
|
||||
caller.credentials = Credentials(type: .minifluxAPIToken, username: "", secret: "token")
|
||||
caller.accountSettings = accountSettings
|
||||
|
||||
let entryIDs = try await caller.retrieveUnreadEntryIDs()
|
||||
#expect(entryIDs == [1, 2, 3, 4])
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private func entriesResponse(entryIDs: [Int], total: Int) -> TestingURLProtocol.Response {
|
||||
let entries = entryIDs.map { "{\"id\": \($0), \"feed_id\": 1}" }.joined(separator: ", ")
|
||||
let json = "{\"total\": \(total), \"entries\": [\(entries)]}"
|
||||
return TestingURLProtocol.Response(data: Data(json.utf8))
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// MinifluxKeychainServerTests.swift
|
||||
// AccountTests
|
||||
//
|
||||
// Created by Brent Simmons on 11/24/26.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Account
|
||||
|
||||
@MainActor struct MinifluxKeychainServerTests {
|
||||
|
||||
@Test func serverIncludesPortAndPath() {
|
||||
#expect(server(for: "https://example.com/miniflux/") == "example.com/miniflux")
|
||||
#expect(server(for: "https://example.com:8443/miniflux") == "example.com:8443/miniflux")
|
||||
#expect(server(for: "https://example.com/") == "example.com")
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
@MainActor private func server(for urlString: String) -> String? {
|
||||
let accountSettings = AccountSettings(accountID: UUID().uuidString, dataFolder: NSTemporaryDirectory())
|
||||
defer {
|
||||
accountSettings.deleteSettings()
|
||||
}
|
||||
accountSettings.endpointURL = URL(string: urlString)
|
||||
|
||||
let caller = MinifluxAPICaller()
|
||||
caller.accountSettings = accountSettings
|
||||
return caller.server
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// MinifluxModelDecodingTests.swift
|
||||
// AccountTests
|
||||
//
|
||||
// Created by Dave Marquard on 7/7/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import Account
|
||||
|
||||
struct MinifluxModelDecodingTests {
|
||||
|
||||
@Test func entriesResponse() throws {
|
||||
let resourceURL = try #require(Bundle.module.resourceURL)
|
||||
let data = try Data(contentsOf: resourceURL.appendingPathComponent("JSON/miniflux_entries_page1.json"))
|
||||
let entries = try JSONDecoder().decode(MinifluxEntriesResponse.self, from: data).entries
|
||||
|
||||
let unreadStarred = try #require(entries.first { $0.entryID == 5001 })
|
||||
#expect(unreadStarred.status == .unread)
|
||||
#expect(unreadStarred.starred == true)
|
||||
// published_at has fractional seconds, which JSONDecoder’s .iso8601 strategy can’t parse.
|
||||
#expect(unreadStarred.parsedDatePublished != nil)
|
||||
|
||||
let read = try #require(entries.first { $0.entryID == 5002 })
|
||||
#expect(read.status == .read)
|
||||
|
||||
let missingAuthor = try #require(entries.first { $0.entryID == 5003 })
|
||||
#expect(missingAuthor.author == nil)
|
||||
|
||||
let emptyEnclosures = try #require(entries.first { $0.entryID == 5004 })
|
||||
#expect(emptyEnclosures.enclosures?.isEmpty == true)
|
||||
#expect(emptyEnclosures.attachments == nil)
|
||||
|
||||
let withEnclosures = try #require(entries.first { $0.entryID == 5005 })
|
||||
let attachments = try #require(withEnclosures.attachments)
|
||||
#expect(attachments.map(\.url) == ["https://media.example/ep1.mp3", "https://media.example/ep1.jpg"])
|
||||
#expect(attachments.first?.sizeInBytes == 1234567)
|
||||
#expect(attachments.last?.sizeInBytes == nil)
|
||||
#expect(withEnclosures.imageURL == "https://media.example/ep1.jpg")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// MinifluxStarredFallbackTests.swift
|
||||
// AccountTests
|
||||
//
|
||||
// Created by Dave Marquard on 7/15/26.
|
||||
// Copyright © 2026 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Testing
|
||||
import RSWeb
|
||||
import Secrets
|
||||
@testable import Account
|
||||
|
||||
@Suite(.isolatedWebserviceResponses) @MainActor struct MinifluxStarredFallbackTests {
|
||||
|
||||
@Test func fallbackOnlyTogglesEntriesWhoseStateDiffers() async throws {
|
||||
let accountSettings = AccountSettings(accountID: UUID().uuidString, dataFolder: NSTemporaryDirectory())
|
||||
defer {
|
||||
accountSettings.deleteSettings()
|
||||
}
|
||||
accountSettings.endpointURL = URL(string: "https://miniflux.test")
|
||||
accountSettings.detectedServerVersion = "2.1.0"
|
||||
|
||||
let caller = MinifluxAPICaller()
|
||||
caller.credentials = Credentials(type: .minifluxAPIToken, username: "", secret: "token")
|
||||
caller.accountSettings = accountSettings
|
||||
|
||||
// 5001 is already starred, and 5002 isn’t.
|
||||
TestingURLProtocol.setResponse("/v1/entries/5001", file: "JSON/miniflux_entry_5001_starred.json")
|
||||
TestingURLProtocol.setResponse("/v1/entries/5002", file: "JSON/miniflux_entry_5002_unstarred.json")
|
||||
|
||||
try await caller.updateEntries(entryIDs: [5001, 5002], starred: true)
|
||||
|
||||
#expect(TestingURLProtocol.requestCount(forURLContaining: "/entries/5001/bookmark") == 0)
|
||||
#expect(TestingURLProtocol.requestCount(forURLContaining: "/entries/5002/bookmark") > 0)
|
||||
}
|
||||
}
|
||||