fix(dashboard): fix config copy failing silently in Safari (iOS & macOS)#298
fix(dashboard): fix config copy failing silently in Safari (iOS & macOS)#298MatinDehghanian wants to merge 29 commits intoPasarGuard:devfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ization (PasarGuard#299) * feat(telegram): implement NATS-backed memory storage for FSM synchronization * refactor: Updated to the aiogram-style implementation
…line button layout for enhanced usability
… persist preference in local storage
…s and remove related props from advance search modal
…fy AlertDialogFooter structure
…nd enhance admin action controls in the UI
…ions and state management
…egy based on data limit presence
…responsiveness on different screen sizes
…figs list to enhance visual alignment
…splay to enhance visual clarity and responsiveness
…preferences across the dashboard
…on styles for improved UX
… and enhance error handling for improved reliability
…and adjust icon alignment in actions menu
…releasing the lock
…splay for better readability and responsiveness
…nsure base username with affixes is outside the 3 to 128 character range
…y to improve readability
…ile and enhance validation logic
|
reset to first commit and open another pr for fix(dashboard): use ClipboardItem to fix config copy in Safari commit |
Problem
Copying subscription configs (links, xray, outline, etc.) from the user action buttons appeared to succeed (toast showed "Copied") but nothing was actually written to the clipboard on Safari — both iOS and macOS.
Root cause: Safari requires
clipboard.write()/clipboard.writeText()to be called synchronously within a user gesture handler. The previous implementation awaitedfetchContent(link)before callingcopy(), which yielded the JS event loop and broke Safari's user-gesture requirement, causing the clipboard write to silently fail.Fix
Use
navigator.clipboard.write()with aClipboardItemthat wraps the fetch in aPromise. This initiates the clipboard write synchronously (satisfying Safari's security check) while the content resolves asynchronously. Falls back to the previouswriteTextapproach for browsers withoutClipboardItemsupport (e.g. older Firefox).Affected file
dashboard/src/components/users/action-buttons.tsx—handleLinksCopy