(
@@ -91,10 +95,11 @@ const SlideShow = ({ tags, npub }: SlideShowProps) => {
setPosts((oldPosts) => {
if (
!isReply(event) &&
- (npub !== undefined || !hasContentWarning(event)) && // only allow content warnings on profile content
- (npub !== undefined || !hasNsfwTag(event)) && // only allow nsfw on profile content
- (npub !== undefined || !nsfwPubKeys.includes(event.pubkey.toLowerCase()) ) && // block nsfw authors
- oldPosts.findIndex((p) => p.id === event.id) === -1
+ oldPosts.findIndex((p) => p.id === event.id) === -1 &&
+ (showNsfw ||
+ (!hasContentWarning(event) && // only allow content warnings on profile content
+ !hasNsfwTag(event))) && // only allow nsfw on profile content
+ !nsfwPubKeys.includes(event.pubkey.toLowerCase()) // block nsfw authors
) {
return [...oldPosts, event];
}
@@ -119,7 +124,6 @@ const SlideShow = ({ tags, npub }: SlideShowProps) => {
};
useEffect(() => {
-
loadNdk([
"wss://relay.nostr.band",
"wss://nos.lol",
@@ -141,7 +145,10 @@ const SlideShow = ({ tags, npub }: SlideShowProps) => {
if (images.current.length > 0) {
const randomImage =
images.current[Math.floor(Math.random() * images.current.length)];
+
+ // TODO this creates potential duplicates when images are loaded from multiple relays
images.current = images.current.filter((i) => i !== randomImage);
+
setHistory((oldHistory) => [...oldHistory, randomImage]);
newActiveImages.push(randomImage);
upcommingImage.current = randomImage;
@@ -164,7 +171,9 @@ const SlideShow = ({ tags, npub }: SlideShowProps) => {
url,
author: p.author.npub,
content: prepareContent(p.content),
- tags: p.tags.filter((t: string[]) => t[0] === "t").map((t: string[]) => t[1].toLowerCase()),
+ tags: p.tags
+ .filter((t: string[]) => t[0] === "t")
+ .map((t: string[]) => t[1].toLowerCase()),
}));
});
console.log(images.current.length);
@@ -185,6 +194,9 @@ const SlideShow = ({ tags, npub }: SlideShowProps) => {
if (event.key === "p" || event.key === " " || event.key === "P") {
setPaused((p) => !p);
}
+ if (event.key === "Escape") {
+ setShowSettings((s) => !s);
+ }
};
useEffect(() => {
@@ -240,6 +252,9 @@ const SlideShow = ({ tags, npub }: SlideShowProps) => {
{title}
+
+ {showSettings && }
+
{!fullScreen && (