diff --git a/src/components/DiscoverPluginsDialog.tsx b/src/components/DiscoverPluginsDialog.tsx
index ec1c7722..02f3b32e 100644
--- a/src/components/DiscoverPluginsDialog.tsx
+++ b/src/components/DiscoverPluginsDialog.tsx
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { Search, Download, ExternalLink, Loader2, Check, Globe, Package } from 'lucide-react';
+import { Search, Download, ExternalLink, Loader2, Check, Globe, Package, LogIn } from 'lucide-react';
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -10,8 +10,10 @@ import { useDiscoverPlugins } from '@/hooks/useDiscoverPlugins';
import { usePlugins } from '@/hooks/usePlugins';
import { useAuthor } from '@/hooks/useAuthor';
import { useToast } from '@/hooks/useToast';
+import { useCurrentUser } from '@/hooks/useCurrentUser';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { genUserName } from '@/lib/genUserName';
+import { Link } from 'react-router-dom';
import type { NostrMetadata } from '@nostrify/nostrify';
interface DiscoverPluginsDialogProps {
@@ -21,6 +23,7 @@ interface DiscoverPluginsDialogProps {
export function DiscoverPluginsDialog({ open, onOpenChange }: DiscoverPluginsDialogProps) {
const { t } = useTranslation();
+ const { user } = useCurrentUser();
const { data: plugins, isLoading } = useDiscoverPlugins();
const [searchQuery, setSearchQuery] = useState('');
@@ -61,7 +64,28 @@ export function DiscoverPluginsDialog({ open, onOpenChange }: DiscoverPluginsDia
{/* Plugins List */}
- {isLoading && (
+ {!user && (
+
+
+
+
+
+
{t('loginRequired')}
+
+ {t('loginToDiscoverPlugins')}
+
+
+
+
+
+
+ )}
+
+ {user && isLoading && (
<>
{[...Array(3)].map((_, i) => (
@@ -80,13 +104,28 @@ export function DiscoverPluginsDialog({ open, onOpenChange }: DiscoverPluginsDia
>
)}
- {!isLoading && filteredPlugins?.length === 0 && (
-
- {searchQuery ? t('noPluginsFound') : t('noPluginsAvailable')}
-
+ {user && !isLoading && filteredPlugins?.length === 0 && (
+
+
+
+
+
+
+ {searchQuery ? t('noPluginsFound') : t('noPluginsFromNetwork')}
+
+
+ {searchQuery
+ ? t('tryDifferentSearch')
+ : t('noPluginsFromNetworkDescription')
+ }
+
+
+
+
+
)}
- {!isLoading && filteredPlugins?.map((plugin) => (
+ {user && !isLoading && filteredPlugins?.map((plugin) => (
))}
diff --git a/src/hooks/useDiscoverPlugins.ts b/src/hooks/useDiscoverPlugins.ts
index 43443099..4770322c 100644
--- a/src/hooks/useDiscoverPlugins.ts
+++ b/src/hooks/useDiscoverPlugins.ts
@@ -1,6 +1,8 @@
import { useQuery } from '@tanstack/react-query';
import { useNostr } from '@nostrify/react';
import type { NostrEvent } from '@nostrify/nostrify';
+import { useCurrentUser } from './useCurrentUser';
+import { useContacts } from './useContacts';
export interface DiscoveredPlugin {
id: string;
@@ -15,20 +17,39 @@ export interface DiscoveredPlugin {
/**
* Hook to discover Shakespeare plugins on Nostr
* Queries NIP-34 git repository announcements with t-tag "shakespeare-plugin"
+ * Filters to only show plugins by the current user and people they follow
*/
export function useDiscoverPlugins() {
const { nostr } = useNostr();
+ const { user } = useCurrentUser();
+ const { data: contacts } = useContacts(user?.pubkey);
return useQuery({
- queryKey: ['discover-plugins'],
+ queryKey: ['discover-plugins', user?.pubkey, contacts],
queryFn: async (c) => {
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
+ // Build authors list: current user + people they follow
+ const authors: string[] = [];
+ if (user?.pubkey) {
+ authors.push(user.pubkey);
+ }
+ if (contacts && contacts.length > 0) {
+ authors.push(...contacts);
+ }
+
+ // If no authors (user not logged in or no follows), return empty array
+ if (authors.length === 0) {
+ return [];
+ }
+
// Query NIP-34 repository announcements (kind 30617) with shakespeare-plugin tag
+ // Filter by authors: current user + people they follow
const events = await nostr.query(
[
{
kinds: [30617],
+ authors,
'#t': ['shakespeare-plugin'],
limit: 100,
},
diff --git a/src/locales/en.json b/src/locales/en.json
index 4efb1a28..4f194261 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -493,6 +493,11 @@
"installing": "Installing...",
"by": "by",
"website": "Website",
+ "loginRequired": "Login Required",
+ "loginToDiscoverPlugins": "Log in with Nostr to discover plugins from people you follow.",
+ "noPluginsFromNetwork": "No Plugins Found",
+ "noPluginsFromNetworkDescription": "No plugins found from people you follow. Follow plugin developers on Nostr to see their plugins here.",
+ "tryDifferentSearch": "Try a different search term.",
"mcpServers": "MCP Servers",
"mcpServersDescription": "Connect to Model Context Protocol servers to extend the AI's capabilities with external tools.",
"addMcpServer": "Add MCP Server",
diff --git a/src/locales/ha.json b/src/locales/ha.json
index 49073384..5db604c5 100644
--- a/src/locales/ha.json
+++ b/src/locales/ha.json
@@ -445,5 +445,10 @@
"install": "Shigar",
"installing": "Ana Shigarwa...",
"by": "ta",
- "website": "Gidan Yanar Gizo"
+ "website": "Gidan Yanar Gizo",
+ "loginRequired": "Ana Buƙatar Shiga",
+ "loginToDiscoverPlugins": "Shiga tare da Nostr don gano plugins daga mutanen da kuke bi.",
+ "noPluginsFromNetwork": "Ba a Sami Plugin ba",
+ "noPluginsFromNetworkDescription": "Ba a sami plugins daga mutanen da kuke bi ba. Bi masu haɓaka plugins akan Nostr don ganin plugins nasu a nan.",
+ "tryDifferentSearch": "Gwada kalmar bincike daban."
}
diff --git a/src/locales/ig.json b/src/locales/ig.json
index 68613793..b3a88edb 100644
--- a/src/locales/ig.json
+++ b/src/locales/ig.json
@@ -442,5 +442,10 @@
"install": "Wụnye",
"installing": "Na-ewunye...",
"by": "site na",
- "website": "Webụsaịtị"
+ "website": "Webụsaịtị",
+ "loginRequired": "Achọrọ Nbanye",
+ "loginToDiscoverPlugins": "Banye na Nostr iji chọpụta plugins sitere na ndị ị na-eso.",
+ "noPluginsFromNetwork": "Achọtaghị Plugins",
+ "noPluginsFromNetworkDescription": "Achọtaghị plugins sitere na ndị ị na-eso. Soro ndị mmepe plugin na Nostr iji hụ plugins ha ebe a.",
+ "tryDifferentSearch": "Gbalịa okwu nchọgharị dị iche."
}
diff --git a/src/locales/pt.json b/src/locales/pt.json
index 62b6bf47..b44d6db9 100644
--- a/src/locales/pt.json
+++ b/src/locales/pt.json
@@ -454,5 +454,10 @@
"install": "Instalar",
"installing": "Instalando...",
"by": "por",
- "website": "Site"
+ "website": "Site",
+ "loginRequired": "Login Necessário",
+ "loginToDiscoverPlugins": "Faça login com Nostr para descobrir plugins de pessoas que você segue.",
+ "noPluginsFromNetwork": "Nenhum Plugin Encontrado",
+ "noPluginsFromNetworkDescription": "Nenhum plugin encontrado de pessoas que você segue. Siga desenvolvedores de plugins no Nostr para ver seus plugins aqui.",
+ "tryDifferentSearch": "Tente um termo de busca diferente."
}
diff --git a/src/locales/yo.json b/src/locales/yo.json
index f1e0967d..4268077f 100644
--- a/src/locales/yo.json
+++ b/src/locales/yo.json
@@ -442,5 +442,10 @@
"install": "Fi Sori Ẹrọ",
"installing": "N Fi Sori Ẹrọ...",
"by": "nipasẹ",
- "website": "Oju opo wẹẹbu"
+ "website": "Oju opo wẹẹbu",
+ "loginRequired": "Wiwọle Nilo",
+ "loginToDiscoverPlugins": "Wọle pẹlu Nostr lati ṣawari awọn plugins lati ọdọ awọn eniyan ti o ntẹle.",
+ "noPluginsFromNetwork": "Ko Ri Plugins",
+ "noPluginsFromNetworkDescription": "Ko ri awọn plugins lati ọdọ awọn eniyan ti o ntẹle. Tẹle awọn olupilẹṣẹ plugin lori Nostr lati rii awọn plugins wọn nibi.",
+ "tryDifferentSearch": "Gbiyanju ọrọ wiwa miiran."
}
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 7025324e..6cd8419e 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -454,5 +454,10 @@
"install": "安装",
"installing": "安装中...",
"by": "作者",
- "website": "网站"
+ "website": "网站",
+ "loginRequired": "需要登录",
+ "loginToDiscoverPlugins": "使用 Nostr 登录以发现您关注的人的插件。",
+ "noPluginsFromNetwork": "未找到插件",
+ "noPluginsFromNetworkDescription": "未找到您关注的人的插件。在 Nostr 上关注插件开发者以在此处查看他们的插件。",
+ "tryDifferentSearch": "尝试不同的搜索词。"
}