Add keyword search, draft

This commit is contained in:
artur
2023-01-24 15:33:18 +03:00
committed by Kieran
parent 200dc6b352
commit 3f45a3db06
12 changed files with 38740 additions and 7004 deletions

View File

@ -13,7 +13,7 @@ export interface TimelineFeedOptions {
}
export interface TimelineSubject {
type: "pubkey" | "hashtag" | "global" | "ptag",
type: "pubkey" | "hashtag" | "global" | "ptag" | "keyword",
items: string[]
}
@ -47,6 +47,10 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel
sub.PTags = new Set(subject.items);
break;
}
case "keyword": {
sub.Keywords = new Set(subject.items);
break;
}
}
return sub;
}, [subject.type, subject.items]);
@ -72,6 +76,7 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel
latestSub.Authors = sub.Authors;
latestSub.HashTags = sub.HashTags;
latestSub.Kinds = sub.Kinds;
latestSub.Keywords = sub.Keywords;
latestSub.Limit = 1;
latestSub.Since = Math.floor(new Date().getTime() / 1000);
sub.AddSubscription(latestSub);
@ -165,4 +170,4 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel
latest.clear();
}
};
}
}