Skip to content

fix(dashboard): copy configs on insecure contexts - #805

Open
dr-hoseyn wants to merge 1 commit into
PasarGuard:devfrom
dr-hoseyn:codex/fix-config-copy-clipboard
Open

fix(dashboard): copy configs on insecure contexts#805
dr-hoseyn wants to merge 1 commit into
PasarGuard:devfrom
dr-hoseyn:codex/fix-config-copy-clipboard

Conversation

@dr-hoseyn

@dr-hoseyn dr-hoseyn commented Aug 21, 2026

Copy link
Copy Markdown

Summary

  • Route subscription configuration copies through the shared clipboard helper.
  • Fall back to the legacy copy path when the Clipboard API is unavailable on insecure HTTP origins.
  • Only show the copied state and success toast after the clipboard operation actually succeeds.

Fixes #704

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor / cleanup
  • Documentation
  • Tests / CI

Checklist

  • I tested the change locally or explained why it cannot be tested.
  • I added or updated tests for behavior changes.
  • I updated documentation, translations, or examples if needed.
  • I checked database migrations when models or schema changed.
  • I did not include secrets, tokens, private keys, or unrelated changes.

Testing

node node_modules/typescript/bin/tsc --noEmit
Passed

node node_modules/prettier/bin/prettier.cjs --check src/features/subscriptions/dialogs/subscription-modal.tsx
Passed

node node_modules/vite/bin/vite.js build
Passed (600 PWA precache entries generated)

git diff --check
Passed

ESLint could not start in this checkout because eslint.config.js imports @eslint/js, which is not present in the installed dependencies. TypeScript and the full production build both passed.

Screenshots

Not applicable; this changes clipboard behavior without altering the UI.

Notes for reviewers

The subscription modal bypassed the existing useClipboard helper and called navigator.clipboard.writeText directly. Browsers restrict that API to secure contexts, so locally hosted panels opened over plain HTTP could generate valid configurations and QR codes while leaving the clipboard empty. Both single-config and Copy All actions now use the existing helper, including its execCommand fallback.

Summary by CodeRabbit

  • Bug Fixes
    • Improved copying subscription configurations, including clearer handling when a copy operation fails.
    • Preserved success and error notifications and copied-state feedback.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 693e8011-8db5-4a7d-9316-c6251072565f

📥 Commits

Reviewing files that changed from the base of the PR and between 5c553a0 and 052aee3.

📒 Files selected for processing (1)
  • dashboard/src/features/subscriptions/dialogs/subscription-modal.tsx

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


Walkthrough

SubscriptionModal now uses the shared useClipboard hook for individual and bulk configuration copying. Failed copy results become errors while existing success, error, and copied-state handling remains.

Changes

Subscription configuration copying

Layer / File(s) Summary
Clipboard hook integration
dashboard/src/features/subscriptions/dialogs/subscription-modal.tsx
Initializes useClipboard with a 1500 ms timeout. Uses its copy function for individual and bulk configuration copying. Handles unsuccessful copy results as errors and updates callback dependencies.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 052ae

This localized fix routes configuration copying through the shared clipboard fallback and only reports success after the operation succeeds. No actionable merge-blocking risk remains beyond normal checks and review.

Poem

A rabbit taps the copy button twice,
Links hop safely into place.
One config, then all configs fly,
The clipboard holds each trace.
Errors thump; success toasts cheer,
Shared hooks make the path clear.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the dashboard fix for copying configurations in insecure contexts.
Linked Issues check ✅ Passed The changes route individual and all configuration copies through the shared clipboard helper, addressing issue #704.
Out of Scope Changes check ✅ Passed The changes are limited to clipboard handling and copied-state behavior required by issue #704.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dr-hoseyn dr-hoseyn mentioned this pull request Aug 21, 2026
2 tasks
@dr-hoseyn

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant