Show HN:一款带有集成待办/已完成追踪功能的原生 Hacker News 阅读器
Show HN: A native Hacker News reader with integrated todo/done tracking

原始链接: https://github.com/haojiang99/hacker_news_reader

这是一个用Rust和egui构建的Hacker News原生桌面应用程序,提供了一个简洁现代的界面,用于浏览热门、最新、Show HN、Ask HN、招聘和最佳等各个板块。它显示的故事包含颜色编码的分数、作者、域名和评论数。用户可以在浏览器中打开文章,并以类似Reddit的线程化格式查看评论,该格式具有自动折叠、可调节字体大小和作者高亮显示功能。 主要功能包括深色/浅色模式、离线缓存和带有本地存储的收藏夹系统。导航直观,具有标签切换、键盘快捷键和用于从评论视图返回的返回按钮。搜索界面允许按标题、域名或作者进行筛选。故事会在您滚动时自动加载。 该应用程序使用三个主要组件构建:使用`egui`的UI层、定义故事和评论的数据模型以及负责从Hacker News获取和解析数据的`hn_client`模块。

Hacker News用户coolwulf分享了一个用Rust和egui构建的原生HN阅读器。厌倦了在浏览器标签页和书签中管理感兴趣的帖子,他创建了一个集成了“待办事项”和“已完成”跟踪的工具。该应用允许用户浏览所有HN板块(热门、最新等),按关键词搜索,并查看线程评论。其功能包括暗/亮模式、键盘快捷键、自动加载和故事评分的颜色编码。它直接抓取HN的HTML,并使用SQLite进行本地存储。该项目解决了改进HN阅读工作流管理的需求,提供了诸如标记稍后阅读的故事、过滤和高效搜索等功能。代码采用MIT许可证,可在GitHub上获取。其他用户也分享了类似的工具。作者计划在未来的版本中添加基于LLM的自动摘要功能。
相关文章

原文

A native desktop application for browsing Hacker News with a clean, modern interface. Built with Rust and egui.

Hacker News Reader Logo

Hacker News Reader Screenshot

  • Browse top stories from different Hacker News sections:
    • Hot Stories (front page)
    • New Stories
    • Show HN
    • Ask HN
    • Jobs
    • Best Stories
  • View comments in a threaded, Reddit-like format with auto-folding and adjustable font size
  • Search and filter stories by title, domain, or author
  • Automatically loads more content when scrolling to the bottom
  • Color-coded stories based on score
  • Dark and light mode support
  • Offline capability with local caching
  • Favorite stories for later reading
  • Open articles in your default browser
  • Rust (1.70.0 or newer)
  • Cargo package manager
  1. Clone the repository:

    git clone <repository-url>
    cd hacker_news_reader
  2. Build the application:

  3. Run the application:

The compiled binary will be available at target/release/hacker_news_reader.

  • Tabs: Click the tabs at the top to switch between different Hacker News sections (Hot, New, Show, Ask, Jobs, Best).
  • Stories: Click on a story title to open it in your default web browser.
  • Comments: Click on the comments count to view the comments for a story.
  • Back: Use the back button or press Backspace to return to the story list from comments view.
  • Refresh: Click the refresh button to reload the current section. Hold Shift while clicking to bypass the cache.
  • Theme: Toggle between dark and light themes using the theme button.
  • Favorites: Click the hamburger menu (☰) to show or hide your favorite stories.
  • Arrow Keys: Use arrow keys to scroll.
  • Space / Page Down: Scroll down a page.
  • Page Up: Scroll up a page.
  • Home: Scroll to the top.
  • End: Scroll to the bottom.
  • Backspace: Return to the story list from the comments view.
  • C: When viewing comments, collapse all top-level comments.
  • Shift+C: When viewing comments, expand all comments.
  • + (Plus): Increase comment font size when in comments view.
  • - (Minus): Decrease comment font size when in comments view.
  • Ctrl+F: Show search interface to filter stories.
  • Escape: Close search interface.
  • 1-6 Number Keys: Switch between tabs (1=Hot, 2=New, 3=Show, 4=Ask, 5=Jobs, 6=Best).

The story list displays up to 150 stories per section (5 pages of 30 stories each). Each story shows:

  • Story number
  • Title (color-coded by score)
  • Source domain
  • Author
  • Score
  • Time posted
  • Comments count

The comments view shows a threaded display of comments. Features include:

  • Auto-folding of comments when first loaded for better overview
  • Collapsible comment threads
  • Adjustable font size with + and - keys or buttons
  • Author highlighting
  • Nested replies
  • Comment age display
  • HTML formatting preserved from original comments

To save a story to your favorites:

  1. Click the star icon next to a story.
  2. Access your favorites by clicking the hamburger menu (☰) in the upper left.

Favorites are stored locally in a SQLite database.

The application follows a simple architecture with three main components:

  1. UI Layer (main.rs): Contains the main application structure (HackerNewsReaderApp) and handles rendering with egui.

  2. Data Models (models.rs): Defines the core data structures:

    • HackerNewsItem: Represents a story/post
    • HackerNewsComment: Represents a comment with nested children
  3. Hacker News Client (hn_client.rs): Handles HTTP requests to fetch Hacker News content and parses HTML responses using the scraper library.

MIT License - see the LICENSE file for details.

联系我们 contact @ memedata.com