Skip to content

feat(security): Add activation warning modal #21

@mathe00

Description

@mathe00

Implement a modal dialog that warns the user about potential risks when enabling a Python script for the first time or re-enabling it. This forces a deliberate confirmation step.

  • Create a new ActivationWarningModal.ts component extending Modal.
  • Modal should display a clear, translated warning message (using t()) about execution risks (file access, network, etc.) and link to the security section in the README.
  • Modal should have a prominent "Activate Anyway" button (text via t()) and a way to cancel (e.g., close button, Esc).
  • Modify PythonBridgeSettingTab.ts:
    • In the onChange handler for the "Script Enabled" toggle:
      • If toggling from false to true, prevent immediate state change.
      • Instantiate and open ActivationWarningModal.
      • Pass a callback function to the modal.
      • The callback (executed only on "Activate Anyway" click) should set activationStatus[relativePath] = true, save settings, and refresh the UI (this.display()).
      • If the modal is cancelled, ensure the toggle visually remains/returns to false.
    • If toggling from true to false, update the setting directly as before.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions