Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hacker-news extension #16749

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions extensions/hacker-news/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Hacker News Changelog

## [🚀 Add Readwise Reader integration] - (2025-01-31)

- Add ability to save articles to Readwise Reader
- Show visual indicator for previously saved articles

## [🐛 Fixes] - (2022-08-16)

- Use custom User Agent + cache responses for each topic for 5 minutes to avoid being rate limited
Expand Down
184 changes: 168 additions & 16 deletions extensions/hacker-news/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions extensions/hacker-news/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"contributors": [
"GastroGeek",
"sxn",
"itsnwa"
"itsnwa",
"russellyeo"
],
"categories": [
"News"
Expand All @@ -22,11 +23,21 @@
"mode": "view"
}
],
"preferences": [
{
"name": "readwiseToken",
"type": "password",
"title": "Readwise API Token",
"description": "Your Readwise API token (found in https://readwise.io/access_token)",
"required": false
}
],
"dependencies": {
"@raycast/api": "^1.47.3",
"@raycast/utils": "^1.4.16",
"lodash": "^4.17.21",
"rss-parser": "3.12.0"
"rss-parser": "3.12.0",
"node-fetch": "^3.3.0"
},
"devDependencies": {
"@types/lodash": "^4.14.180",
Expand All @@ -35,12 +46,15 @@
"eslint": "8.11.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-react-hooks": "4.3.0",
"prettier": "^2.8.0",
"react-devtools": "^4.24.1",
"typescript": "4.6.2"
},
"scripts": {
"build": "ray build -e dist",
"dev": "ray develop",
"lint": "ray lint"
"lint": "ray lint",
"format": "prettier 'src/**' '!**/.DS_Store' --write",
"publish": "npx @raycast/api@latest publish"
}
}
}
10 changes: 9 additions & 1 deletion extensions/hacker-news/src/frontpage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Action, ActionPanel, List } from "@raycast/api";
import { Action, ActionPanel, Icon, List } from "@raycast/api";
import { startCase } from "lodash";
import { getStories } from "./hackernews";
import { Topic } from "./types";
import { useState } from "react";
import { usePromise } from "@raycast/utils";
import Parser from "rss-parser";
import { getIcon, getAccessories } from "./utils";
import { saveToReadwise, hasReadwiseToken } from "./readwise";

export default function Command() {
const [topic, setTopic] = useState<Topic | null>(null);
Expand Down Expand Up @@ -74,6 +75,13 @@ function Actions(props: { item: Parser.Item }) {
shortcut={{ modifiers: ["cmd"], key: "." }}
/>
)}
{props.item.link && hasReadwiseToken() && (
<Action
icon={Icon.SaveDocument}
title="Save to Readwise Reader"
onAction={() => saveToReadwise(props.item.link || "")}
/>
)}
</ActionPanel.Section>
</ActionPanel>
);
Expand Down
Loading
Loading