Mirror — see github.com/blacksky-algorithms/blacksky.community
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Track participation JWT for consistent embed vote identity

+11 -2
+11 -2
src/components/Post/Embed/ExternalEmbed/AssemblyEmbed.tsx
··· 75 75 const [error, setError] = useState<string | null>(null) 76 76 const [allVoted, setAllVoted] = useState(false) 77 77 const [notFound, setNotFound] = useState(false) 78 + const [participationToken, setParticipationToken] = useState<string | null>( 79 + null, 80 + ) 78 81 79 82 const isAuthenticated = !!currentAccount?.did 80 83 ··· 121 124 (await initResp.json()) as ParticipationInitResponse 122 125 123 126 if (initData.auth?.token) { 124 - // JWT available but not needed — votes are verified via repo records 127 + setParticipationToken(initData.auth.token) 125 128 } 126 129 127 130 // Use personalized next comment (excludes already-voted) ··· 173 176 // Submit to assembly's verified vote endpoint. 174 177 // If authenticated: server fetches the record from user's PDS to verify. 175 178 // If anonymous: server accepts the vote directly (conversation allows it). 179 + const voteHeaders: Record<string, string> = { 180 + 'Content-Type': 'application/json', 181 + } 182 + if (participationToken) { 183 + voteHeaders.Authorization = `Bearer ${participationToken}` 184 + } 176 185 const voteResp = await fetch(`${ASSEMBLY_API}/embed/vote`, { 177 186 method: 'POST', 178 - headers: {'Content-Type': 'application/json'}, 187 + headers: voteHeaders, 179 188 body: JSON.stringify({ 180 189 conversation_id: conversationId, 181 190 tid: statement.tid,