enKrypt icon indicating copy to clipboard operation
enKrypt copied to clipboard

feat: Safari support

Open kvhnuke opened this issue 3 years ago • 2 comments

Summary by CodeRabbit

  • New Features

    • Added Safari support: buildable Safari extension and a macOS app with Safari integration and UI.
    • New Safari build option for the extension (build:safari).
  • Bug Fixes

    • Hide unsupported features on Safari (DApps link, Buy/Sell, Swap) for a smoother experience.
    • Hardware wallet options now only show on supported browsers.
    • Onboarding now reliably closes the active tab after wallet creation.
  • Chores

    • Enhanced CI/CD: macOS Safari build/deploy workflow, unified build/test/release jobs, artifact uploads, caching, VirusTotal analysis and PR summary comments.
    • Expanded .gitignore to exclude additional build outputs and env files.

kvhnuke avatar Aug 17 '22 22:08 kvhnuke

Walkthrough

Adds macOS host app and Safari WebExtension support, Fastlane deployment, GitHub Actions updates (buildAll with VirusTotal, macOS deploy), numerous macOS project files/assets, and Safari-specific extension build, manifest, and UI/browser gating changes.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/build-all.yml, .../macos-deploy.yml, .../release.yml, .../test-all.yml
Add buildAll job with Docker/Yarn cache, artifact upload and VirusTotal upload + PR comment; add macOS Safari deploy workflow (build on Linux, deploy on macOS via Fastlane); rename job label in release; add job name for tests.
Ignore Rules
.gitignore, macos/Enkrypt/.gitignore
Add .env.sh and many build/cache ignore entries; add macOS/Xcode-specific ignore patterns in macOS project directory.
macOS Host App & Safari Extension (Xcode project & resources)
macos/Enkrypt/Enkrypt.xcodeproj/..., macos/Enkrypt/Enkrypt/*.swift, .../*.plist, .../*.entitlements, .../Assets.xcassets/*, .../Base.lproj/*, .../Enkrypt Extension/*, .../service-worker-loader.js
Add new Xcode project entries and targets, AppDelegate, ViewController, SafariWebExtensionHandler, Info.plists and entitlements, storyboard, HTML/CSS/JS resources, assets, scheme, and service worker loader import.
Fastlane Setup for macOS
macos/Enkrypt/Gemfile, macos/Enkrypt/fastlane/{Appfile,Fastfile,Matchfile,Pluginfile,README.md,report.xml}
Add Fastlane configuration: Appfile env mapping, lanes (prepare, release, buildandrelease), match config, plugins, docs and test report.
Extension Build / Manifest / Vite
packages/extension/package.json, packages/extension/vite.config.ts, packages/extension/src/manifest/manifest.safari.ts, packages/extension/configs/vite/transform-manifest.ts, packages/extension/.browserlistrc
Add build:safari script; wire Safari manifest into vite config; add Safari-specific manifest file; use MATCHING_PROTOCOLS and Safari browser_settings in manifest transformer; re-enable Safari in browserslist.
Background / Service Worker
packages/extension/src/scripts/chrome/background.ts, macos/Enkrypt/Enkrypt Extension/service-worker-loader.js
Expand content-script registration gating to include Safari; load built background bundle in Safari service worker loader.
Extension UI — Safari guards & behavior changes
packages/extension/src/ui/action/components/network-menu/index.vue, .../views/accounts/index.vue, .../views/import-account/index.vue, .../views/network-activity/components/network-activity-action.vue, .../onboard/create-wallet/wallet-ready.vue, .../onboard/hardware-wallet/add-hardware-wallet.vue, .../action/App.vue, .../views/asset-detail-view/components/asset-detail-action.vue, .../src/ui/action/App.vue
Add __IS_SAFARI__-based flags and conditional rendering to hide/show DApps, Buy/Sell, Swap, and hardware wallet UI on Safari; remove commented Polkadot imports; change onboarding close flow to use webextension-polyfill Browser.tabs removal; add Safari keepalive polling and popupClosed state/UI message.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant Repo as Repository
  participant Docker as Docker Build Env
  participant VT as VirusTotal
  participant PR as Pull Request

  GH->>Repo: checkout
  GH->>Docker: build container / setup node + yarn
  GH->>Docker: yarn install && build (chrome, firefox, safari artifacts)
  GH->>GH: upload-artifact (release zips)
  GH->>VT: request upload URL
  GH->>VT: upload release zip(s)
  VT-->>GH: return analysis URLs
  GH->>PR: comment with artifact links and VT URLs
sequenceDiagram
  autonumber
  participant CI as GitHub Actions
  participant Build as buildApp (Ubuntu)
  participant Art as Artifact Storage
  participant Deploy as deploy (macOS)
  participant Fastlane as Fastlane / Xcode
  participant ASC as App Store Connect

  CI->>Build: checkout, docker build, yarn install, vite build:safari
  Build->>Art: upload Safari artifacts
  CI->>Deploy: run on macOS (needs: buildApp)
  Deploy->>Art: download artifacts
  Deploy->>Fastlane: setup ruby, run fastlane buildandrelease
  Fastlane->>ASC: upload package
  Deploy->>CI: upload final artifact
sequenceDiagram
  autonumber
  participant User as User
  participant Popup as Action Popup (Vue)
  participant Browser as WebExtension API
  participant Host as macOS Host App
  rect rgba(230,240,255,0.6)
    note right of Popup: Safari-only keepalive polling (isKeyRingLocked every 5s)
    Popup->>Popup: periodic isKeyRingLocked()
  end
  User->>Popup: start onboarding
  Popup->>Popup: popupClosed = true
  Popup->>Browser: tabs.query({active:true})
  Browser-->>Popup: active tab info
  Popup->>Browser: tabs.remove(tabId)
  User->>Host: open preferences
  Host->>Safari: SFSafariApplication.showPreferencesForExtension
  Safari-->>Host: done

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • enkryptcom/enKrypt#608 — modifies the same UI components and conditional rendering for network-menu and related views.
  • enkryptcom/enKrypt#676 — touches packages/extension/src/ui/action/App.vue and popup/onboarding behavior.
  • enkryptcom/enKrypt#675 — related to asset-detail-action.vue component changes and props/emits.

Suggested reviewers

  • olgakup
  • gamalielhere

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately describes the core enhancement—adding Safari support for the extension and related build workflows—making it clear to reviewers what the main change is.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch feat/safari-support

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4961e628701991859ffee14fd6e2b18a8aa44392 and f23d5584f410f9267ceec07ef1e3929bde90e3f5.

📒 Files selected for processing (1)
  • packages/extension/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build all
  • GitHub Check: test
  • GitHub Check: test all
  • GitHub Check: safari build
🔇 Additional comments (1)
packages/extension/package.json (1)

19-19: Safari build script looks consistent.

Matches the existing browser build commands and hooks into the shared prebuild/minify flow. 👍


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 and usage tips.

coderabbitai[bot] avatar Dec 13 '24 18:12 coderabbitai[bot]

:briefcase: Build Files chrome: enkrypt-chrome-f23d5584.zip firefox: enkrypt-firefox-f23d5584.zip

:syringe: Virus total analysis chrome: f23d5584 firefox: f23d5584

github-actions[bot] avatar Dec 13 '24 18:12 github-actions[bot]