A social knowledge tool for researchers built on ATProto

fix: resolve React javascript URL security block for bookmarklet

Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat>

Changed files
+8 -18
src
webapp
app
bookmarklet
+8 -18
src/webapp/app/bookmarklet/page.tsx
··· 10 Alert, 11 Box, 12 Group, 13 - Anchor, 14 } from '@mantine/core'; 15 import { useState } from 'react'; 16 import { BiInfoCircle } from 'react-icons/bi'; 17 - import { RiDragDropLine } from 'react-icons/ri'; 18 19 export default function BookmarkletPage() { 20 const [copied, setCopied] = useState(false); ··· 35 } catch (err) { 36 console.error('Failed to copy bookmarklet:', err); 37 } 38 }; 39 40 return ( ··· 70 Drag this button directly to your browser's bookmarks bar: 71 </Text> 72 <Group> 73 - <Anchor 74 - href={bookmarkletCode} 75 - style={{ 76 - textDecoration: 'none', 77 - padding: '8px 16px', 78 - backgroundColor: 'var(--mantine-color-blue-6)', 79 - color: 'white', 80 - borderRadius: '4px', 81 - display: 'inline-flex', 82 - alignItems: 'center', 83 - gap: '8px', 84 - }} 85 - > 86 - <RiDragDropLine size={16} /> 87 - Open in Semble 88 - </Anchor> 89 </Group> 90 </Stack> 91
··· 10 Alert, 11 Box, 12 Group, 13 } from '@mantine/core'; 14 import { useState } from 'react'; 15 import { BiInfoCircle } from 'react-icons/bi'; 16 17 export default function BookmarkletPage() { 18 const [copied, setCopied] = useState(false); ··· 33 } catch (err) { 34 console.error('Failed to copy bookmarklet:', err); 35 } 36 + }; 37 + 38 + // Create the bookmarklet link using dangerouslySetInnerHTML to bypass React's security check 39 + const createBookmarkletLink = () => { 40 + return { 41 + __html: `<a href="${bookmarkletCode}" style="text-decoration: none; padding: 8px 16px; background-color: var(--mantine-color-blue-6); color: white; border-radius: 4px; display: inline-flex; align-items: center; gap: 8px;"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M19 7h-3V6a4 4 0 0 0-8 0v1H5a1 1 0 0 0-1 1v11a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V8a1 1 0 0 0-1-1zM10 6a2 2 0 0 1 4 0v1h-4V6zm8 13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V9h2v1a1 1 0 0 0 2 0V9h4v1a1 1 0 0 0 2 0V9h2v10z"/></svg>Open in Semble</a>` 42 + }; 43 }; 44 45 return ( ··· 75 Drag this button directly to your browser's bookmarks bar: 76 </Text> 77 <Group> 78 + <Box dangerouslySetInnerHTML={createBookmarkletLink()} /> 79 </Group> 80 </Stack> 81