Tech-Spec: Browser Integration (Saved Passwords & Text)
Created: 2025-12-20 Status: Ready for Development
Overview
Problem Statement
Users experience friction in two main areas:
- Authentication: Browser password managers fail to auto-fill or suggest saving credentials because the login and registration forms lack semantic
autocompleteattributes.
Solution
- Form Optimization: Enhance
<input>tags with standardautocompletevalues to enable native browser credential management.
Scope (In/Out)
- In:
- Modifying
Login.jsxandRegister.jsxto support auto-fill. - Implementing Clipboard API support in
Posts.jsx. - Adding a new "Tools" page to host instructions and the draggable bookmarklet.
- Handling URL parameters for content pre-filling.
- Modifying
- Out:
- Native browser extensions (Chrome Web Store, etc.).
- Multi-browser sync of the bookmarklet itself.
Context for Development
Codebase Patterns
- Frontend: React (Vite-based) with Tailwind CSS for styling.
- Routing:
react-router-domv6 for navigation. - State: Redux Toolkit used for posts and authentication state.
- API: Backend communication via
apiClient(axios).
Files to Reference
Technical Decisions
- Bookmarklet URL: The bookmarklet will use
window.location.hrefto redirect tohttps://[your-lin-url]/posts?text=[content]. - Clipboard Permissions: Will use
navigator.clipboard.readText(), handling the potentialPermissionDeniederror with a graceful fallback (manual paste instruction).
Implementation Plan
Tasks
- Task 1: Enhance Auth Forms for Password Managers
- Add
autocomplete="username"/autocomplete="current-password"toLogin.jsx. - Add
autocomplete="email"/autocomplete="new-password"toRegister.jsx.
- Add
- Task 2: Integrate Clipboard and URL Pre-fill in Posts
- Extract
textfrom URL search parameters on component mount. - Add "Paste from Clipboard" button with icon in the
postContentarea. - Implement error handling for clipboard access.
- Extract
- Task 3: Create Tools/Bookmarklet Page
- Add a New
Tools.jsxpage. - Implement a draggable link with the bookmarklet script.
- Update
Sidebar.jsxandApp.jsxto include the new Tools route.
- Add a New
Acceptance Criteria
- AC 1: When visiting the login page, browsers with saved credentials offer to auto-fill.
- AC 2: After registration or login, the browser asks "Would you like to save this password?".
- AC 3: Clicking "Paste" in the post editor successfully populates the textarea with the clipboard content (after permission is granted).
- AC 4: Using the bookmarklet on any webpage redirects the user to Lin with the text field pre-populated.
Additional Context
Dependencies
- Standard browser Web APIs (Clipboard, URLSearchParams).
Testing Strategy
- Manual: Test in Chrome and Firefox for credential handling.
- Manual: Verify the bookmarklet from a local file or a live site.
Notes
- Ensure the bookmarklet URL is dynamically generated or configurable to match the user's current environment (dev vs prod).