about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-09-11 21:52:26 -0500
committerEric Bailey <git@esb.lol>2024-09-11 21:52:26 -0500
commit45c8d89d9212bf7160317185f8418bdebbf3b617 (patch)
treeee5fd9dd912cc2e7de0e09b6c2b99c4ac2332ee4 /src
parent6e78ce53d74e79e2349ab357c7270e30742d33a5 (diff)
downloadvoidsky-45c8d89d9212bf7160317185f8418bdebbf3b617.tar.zst
Protect against 3p PDSs and bad responses
Diffstat (limited to 'src')
-rw-r--r--src/components/dialogs/nuxs/TenMillion/index.tsx15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/components/dialogs/nuxs/TenMillion/index.tsx b/src/components/dialogs/nuxs/TenMillion/index.tsx
index 5da295ab6..f5c8435de 100644
--- a/src/components/dialogs/nuxs/TenMillion/index.tsx
+++ b/src/components/dialogs/nuxs/TenMillion/index.tsx
@@ -90,8 +90,11 @@ export function TenMillion() {
 
   React.useEffect(() => {
     async function fetchUserNumber() {
-      // TODO check for 3p PDS
-      if (agent.session?.accessJwt) {
+      const isBlueskyHosted = agent.sessionManager.pdsUrl
+        ?.toString()
+        .includes('bsky.network')
+
+      if (isBlueskyHosted && agent.session?.accessJwt) {
         const res = await fetch(
           `https://bsky.social/xrpc/com.atproto.temp.getSignupNumber`,
           {
@@ -109,6 +112,9 @@ export function TenMillion() {
 
         if (data.number) {
           setUserNumber(data.number)
+        } else {
+          // should be rare
+          nuxDialogs.dismissActiveNux()
         }
       }
     }
@@ -117,6 +123,7 @@ export function TenMillion() {
       nuxDialogs.dismissActiveNux()
     })
   }, [
+    agent.sessionManager.pdsUrl,
     agent.session?.accessJwt,
     setUserNumber,
     nuxDialogs.dismissActiveNux,
@@ -187,9 +194,9 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
         setTimeout(() => {
           openComposer({
             text: _(
-              msg`I'm user #${i18n.number(
+              msg`Bluesky now has over 10 million users, and I was #${i18n.number(
                 userNumber,
-              )} out of 10M. What a ride 😎`,
+              )}!`,
             ), // TODO
             imageUris: [
               {