pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

Offer ability to add permission when using `@pixiebrix/get` and other bricks

Open fregante opened this issue 3 years ago • 3 comments

The error surfaced by the @pixiebrix/get is not actionable:

Screen Shot 2

Current fix:

  1. Visit the URL (hoping you won't be redirected elsewhere)
  2. Open editor
  3. Click on the "Enable PB" button

Ideal fix:

  • Show "Enable PB on this domain" button next to the error (or in its place). Maybe via ErrorDisplay?

Side quest:

  • [ ] Make it work even if it redirects across domains. 😬 For example the url https://fregante.com redirects to https://twitter.com, so I think adding a permission for fregante.com/* is not enough or not necessary at all. I'm not sure whether this is fixable since we don't have access to the final URL that fetch requests.

fregante avatar Mar 29 '22 05:03 fregante

Current fix

This fixes it for your current browser install, but does not fix it if you were to redeploy on another computer.

Ideal fix

When the user clicks the button , the Page Editor needs to add the origin to the permissions.origins declaration on the extension: https://docs.pixiebrix.com/developer-guide/multi-page-automation#e9f10aaf9a7d4127ad0af9106b6b5297

We'll need to update the:

Other considerations:

  • We want this to work for both @pixiebrix/get and @pixiebrix/http bricks. (Or composite bricks that use those under the hood)
  • From a security perspective: in the case of a redirect, the Page Editor should prompt 2x: first time for the initial URL, and for the redirected URL.

Related Issues:

  • https://github.com/pixiebrix/pixiebrix-extension/issues/3037

twschiller avatar Mar 30 '22 13:03 twschiller

Very related issue:

  • https://github.com/pixiebrix/pixiebrix-extension/issues/2043

fregante avatar May 15 '22 05:05 fregante

Reopening because there's still no way to add a permission. It's clear (even to me) how to add a permission. Can we add this button when the error is detected?

Screen Shot

fregante avatar Aug 02 '22 09:08 fregante