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

farcaster extension: add support for nook #12123

Merged
merged 1 commit into from
May 2, 2024
Merged
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
4 changes: 4 additions & 0 deletions extensions/farcaster/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Farcaster Changelog

## Support for Nook 2024-05-01

- Support for farcaster client, Nook

## [Initial Version] - 2024-03-09

Features Added:
Expand Down
9 changes: 7 additions & 2 deletions extensions/farcaster/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Farcaster

Most comprehensive extension for Forecaster. Search for casts, profiles and more.
Most comprehensive extension for Farecaster. Search for casts, profiles and more. In order to use this extension, you'll need a [Neynar API Key](https://neynar.com?ref=raycast)

In order to use this extension, you'll need a [Neynar API Key](https://neynar.com?ref=raycast)
### Feedback

[Request Feature](https://github.com/raycast/extensions/issues/new?assignees=&labels=extension%2Cfeature+request&template=extension_feature_request.yml&title=%5BFarcaster%5D+...&extension-url=https://www.raycast.com/artivilla/farcaster)

[Report Bug](https://github.com/raycast/extensions/issues/new?assignees=&labels=extension%2Cbug&template=extension_bug_report.yml&title=%5BFarcaster%5D+...&extension-url=https://www.raycast.com/artivilla/farcaster)

### Author

[artivilla.com](https://artivilla.com)

[warpcast](https://warpcast.com/artivilla.eth)
49 changes: 25 additions & 24 deletions extensions/farcaster/package-lock.json

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

16 changes: 10 additions & 6 deletions extensions/farcaster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
{
"title": "Supercast",
"value": "supercast"
},
{
"title": "Nook",
"value": "nook"
}
]
},
Expand All @@ -73,21 +77,21 @@
}
],
"dependencies": {
"@raycast/api": "^1.70.3",
"@raycast/utils": "^1.14.0",
"@types/linkify-it": "^3.0.5",
"@raycast/api": "^1.72.1",
"@raycast/utils": "^1.15.0",
"dedupe": "^4.0.3",
"linkify-it": "^5.0.0",
"tlds": "^1.252.0",
"use-debounce": "^10.0.0"
},
"devDependencies": {
"@types/linkify-it": "^5.0.0",
"@raycast/eslint-config": "^1.0.8",
"@types/node": "20.12.6",
"@types/react": "18.2.75",
"@types/node": "20.12.8",
"@types/react": "18.3.1",
"eslint": "^8.57.0",
"prettier": "^3.2.5",
"typescript": "^5.4.4"
"typescript": "^5.4.5"
},
"scripts": {
"build": "ray build -e dist",
Expand Down
36 changes: 30 additions & 6 deletions extensions/farcaster/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Linkify from 'linkify-it';
import tlds from 'tlds';
import { preferences } from './preferences';

const isWarpcast = preferences.farcasterClient === 'warpcast';
const isEtherscan = preferences.walletAddressClient === 'etherscan';

export function getUserIcon(user: Pick<CastAuthor, 'username' | 'pfp_url'>) {
Expand All @@ -31,13 +30,38 @@ export function truncateEthAddress(address: string) {
}

export function getCastUrl(cast: Cast) {
return isWarpcast
? `https://warpcast.com/${cast.author.username}/${cast.hash.substring(0, 8)}`
: `https://www.supercast.xyz/c/${cast.hash}`;
let baseUrl;
switch (preferences.farcasterClient) {
case 'supercast':
baseUrl = `https://www.supercast.xyz/c/${cast.hash}`;
break;
case 'nook':
baseUrl = `https://nook.social/casts/${cast.hash}`;
break;
case 'warpcast':
default:
baseUrl = `https://warpcast.com/${cast.author.username}/${cast.hash.substring(0, 8)}`;
break;
}

return baseUrl;
}

export function getProfileUrl(author: CastAuthor) {
return isWarpcast ? `https://warpcast.com/${author.username}` : `https://www.supercast.xyz/${author.username}`;
let baseUrl;
switch (preferences.farcasterClient) {
case 'supercast':
baseUrl = `https://www.supercast.xyz/${author.username}`;
break;
case 'nook':
baseUrl = `https://nook.social/users/${author.username}`;
break;
case 'warpcast':
default:
baseUrl = `https://warpcast.com/${author.username}`;
break;
}
return baseUrl;
}

export function getEthAddressUrl(walletAddress: string) {
Expand All @@ -48,7 +72,7 @@ export function getSolanaAddressUrl(walletAddress: string) {
return `https://solscan.io/token/${walletAddress}`;
}

const _linkify = Linkify().tlds(tlds);
const _linkify = new Linkify().tlds(tlds);
export function linkify(text: string): string {
const matches = _linkify.match(text);

Expand Down