X icon indicating copy to clipboard operation
X copied to clipboard

Port extension to Safari

Open feep opened this issue 1 year ago • 12 comments

Clarifying requirements for bounty

In scope

  • [x] Build Safari web extension
  • [x] readme.md explaining how to build locally
  • [ ] Same functionality as Chrome extension
  • [x] Able to run in dev mode for testing by Rows
  • [x] Minimal single screen, example: image
  • [x] About box

Out of scope

Anything not listed as in scope, for example:

  • Safari app extension
  • CI for build
  • Non-mac Safari (iOS...)
  • Signing for App store
  • Submission to App store
  • Anything involved with distribution
  • [x] Art for app icons
  • Copy (legal or otherwise) that Apple requires

feep avatar Apr 18 '24 15:04 feep

If that scope looks OK, please assign to me.

thanks, rusty

feep avatar Apr 18 '24 15:04 feep

Also, please exempt this bounty from made publicly available requirement:

features are only eligible for a bounty once they are approved by our team and made publicly available.

The submission and public distribution should be done by Rows, not by the person who completes the issue.

feep avatar Apr 18 '24 16:04 feep

Thanks for taking on the challenge @feep ! I just assigned it to you, that's the scope. Please keep code duplication to a minimum so that it is easier to maintain. TY!

cc @ricardofelgueiras

henriquemcruz avatar Apr 19 '24 08:04 henriquemcruz

Probably unsupported 😿, still working on a minimal reproduction.

Will get back to you on that, Safari’s extension debugging is... limited. And Apple’s transparency on feature support is... hazy.

Anyway,

Progress report (the good):

image

image

The bad:

  1. The service_worker script failed to load due to an error., best I can tell, there is no debug UI available for this error in Safari.

image

  1. UI loads. But does not connect, so is useless

image

The server is running

❯ curl -I http://localhost:5173
HTTP/1.1 200 OK
...

So,

Hmmph. Done banging my head on it for now. Going for for a walk.

Will report back when I have a minimal test case.

rusty

feep avatar Apr 23 '24 20:04 feep

Always try one more thing before you give up. Prod extension works, dev-mode extension does not.

Progress report

image

But does not properly forward the data to rows.com.

image

Which is going to be difficult to debug without, ahem, being able to use the dev-mode extension.

Anyway, better than before. More later.

feep avatar Apr 23 '24 20:04 feep

Where do you want the safari bits?

  1. ./safari in this repo
  2. A different directory
  3. A different repo

For dev or CI, it should work fine within the repo or out of the repo. If in a separate repo, the chrome extension would need to keep a consistent path when building (../X/dist or something).

feep avatar Apr 23 '24 20:04 feep

Where do you want the safari bits?

  1. ./safari in this repo
  2. A different directory
  3. A different repo

For dev or CI, it should work fine within the repo or out of the repo. If in a separate repo, the Chrome extension would need to keep a consistent path when building (../X/dist or something).

You can create a safari folder specifically for this. We can take care of the build afterward. Don't forget to edit the tests and ensure these tests run for the Safari extension as well.

Additionally and to give you some context, it would be better to build the extension having the Manifest V3 in mind. This will allow us to create one single extension that works for the main browsers (Safari, Chrome, and Firefox).

ricardofelgueiras avatar Apr 24 '24 09:04 ricardofelgueiras

One hint for you to check why the Open in Rows doesn't work: check the permissions. The extension should be able to add information to the clipboard.

ricardofelgueiras avatar Apr 24 '24 09:04 ricardofelgueiras

Additionally and to give you some context, it would be better to build the extension having the Manifest V3 in mind. This will allow us to create one single extension that works for the main browsers (Safari, Chrome, and Firefox).

The (production) extension builds into a Safari extension with no changes.

It will need a different UI on Safari, if you decide to deal with the clipboard issues (more in later comment).

feep avatar Apr 24 '24 10:04 feep

check the permissions. The extension should be able to add information to the clipboard.

Yup. Sigh.

Safari requires user action to read the clipboard.

I think, still, on 17.3.1. Haven’t finished research.

Anyway, if that is true, it needs some UI work.

It works =]

Kinda.

  1. Click RowsX extension menu
  2. Click copy button (which dismisses the popover)
  3. Click RowsX extension menu again
  4. Click Open in Rows
  5. Paste

I will get a draft PR up later today with the Safari webextension build in ./safari.

feep avatar Apr 24 '24 10:04 feep

Still poking around, trying to get clipboard permission.

Unhandled Promise Rejection: Error: Cannot access contents of the page. Extension manifest must request permission to access the respective host, or have "activeTab" permission with a user gesture.

I can get the permission request (a different one) to pop up on click (user gesture) on Chromium, but it won’t pop on Safari.

I will update #88 when I make visible progress.

feep avatar Apr 26 '24 11:04 feep

Unable to get proper permissions.

Not much documented in Safari, and things I tried that popped an additional permission request in Chrome did not do anything useful in Safari.

May try again later.

Unassigning. If anyone picks this up, you are welcome to use #88 as a starting point.

Basically, this is where it stands.

As far as I am concerned, this bounty is open again.

feep avatar May 28 '24 08:05 feep