diff options
author | dan <dan.abramov@gmail.com> | 2024-04-13 05:50:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-13 05:50:09 +0100 |
commit | a845587e1f0b74b087b0c59d1cdc8e6c5feaf98f (patch) | |
tree | 7df2d71a21c6becab94766897bed5c40f7469c22 /bskyembed | |
parent | 4c966e5d6d1cbafe7a41d58268ffcb2cee31abe8 (diff) | |
download | voidsky-a845587e1f0b74b087b0c59d1cdc8e6c5feaf98f.tar.zst |
[Embeds] Show error for users with PWI flag on landing (#3524)
Diffstat (limited to 'bskyembed')
-rw-r--r-- | bskyembed/src/screens/landing.tsx | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/bskyembed/src/screens/landing.tsx b/bskyembed/src/screens/landing.tsx index 7c8ef2810..06b455981 100644 --- a/bskyembed/src/screens/landing.tsx +++ b/bskyembed/src/screens/landing.tsx @@ -86,7 +86,14 @@ function LandingPage() { if (!AppBskyFeedDefs.isThreadViewPost(data.thread)) { throw new Error('Post not found') } - + const pwiOptOut = !!data.thread.post.author.labels?.find( + label => label.val === '!no-unauthenticated', + ) + if (pwiOptOut) { + throw new Error( + 'The author of this post has requested their posts not be displayed on external sites.', + ) + } setThread(data.thread) } catch (err) { console.error(err) @@ -113,25 +120,15 @@ function LandingPage() { className="border rounded-lg py-3 w-full max-w-[600px] px-4" placeholder={DEFAULT_POST} /> - <p className={`text-red-500 ${error ? '' : 'invisible'}`}>{error}</p> </div> <img src={arrowBottom as string} className="w-6" /> <div className="w-full max-w-[600px] gap-8 flex flex-col"> {uri && !error && thread && <Snippet thread={thread} />} - - {thread ? ( - <Post thread={thread} key={thread.post.uri} /> - ) : ( - <Container href="https://bsky.social/about"> - <Link - href="https://bsky.social/about" - className="transition-transform hover:scale-110 absolute top-4 right-4"> - <img src={logo as string} className="h-8" /> - </Link> - <div className="h-32" /> - </Container> + {!error && thread && <Post thread={thread} key={thread.post.uri} />} + {error && ( + <p className={`text-red-500 ${error ? '' : 'invisible'}`}>{error}</p> )} </div> </main> |