Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari version #49

Open
itaysk opened this issue Oct 30, 2021 · 11 comments
Open

Safari version #49

itaysk opened this issue Oct 30, 2021 · 11 comments

Comments

@itaysk
Copy link

itaysk commented Oct 30, 2021

Hello, I've been enjoying this extension for a long time, thank you! I love it so much that when I decided to move to Safari, it's unavailability made me reconsider the move. I don't know if this was on your radar already but I thought I throw in my request as well, and have an issue which people can upvote.

Apple has an tool that lets you convert chrome extensions to Safari: https://bartsolutions.github.io/2020/11/20/safari-extension/
Not sure it'll flawlessly work here, but I had success with porting the other simple extensions I needed with this tool and side-loading them.
Then there's the Apple Developer fee that you need to pay in order to submit :(

@neaumusic
Copy link
Owner

thanks man, yea I think safari is the future; hoping they get a native password manager / keychain

I know the script 'highlighter.js' was literally a copy/paste to the console in the past, but yea I never figured out the xcode process, thanks for the information

@petukhov
Copy link

Hi @neaumusic I managed to convert this to Safari Extension. Works fine so far. Would you be able to publish it officially in the Safari Extensions? If not, can I do it?

@neaumusic
Copy link
Owner

@petukhov hey sorry for the delay! yea I can definitely publish it in Safari, I think I just need to pay a fee or something

hopefully it wasn't too difficult to convert it, I've always wondered how version control should work with git, but I'll do some research

@petukhov
Copy link

petukhov commented Jul 5, 2022

@neaumusic No worries, yeah I think $100 fee is required. You did a great job with this extension! Looking forward to using it on Safari soon.

@itaysk
Copy link
Author

itaysk commented Oct 12, 2023

So I decided to migrate to Safari after all and missed this extension too much. I am no web developer and definitely not an Apple developer but I was able to port it and I'm sharing here the steps I took:

  1. clone and build this project
  2. when building, I got an error error:0308010C:digital envelope routines::unsupported which appears to be related to older webpack version and newer node. I resolved this by adding using a legacy option: NODE_OPTIONS=--openssl-legacy-provider yarn
  3. convert the extension to Safari using Apple's conversion tool. For some reason the tool was not discovered via xcrun but running it explicitly worked: /Applications/Xcode.app/Contents/Developer/usr/bin/safari-web-extension-converter ./chrome_extension --app-name selection-highlighter --bundle-identifier itaysk.selection-highlighter --macos-only --swift --no-open --copy-resources
  4. build the bundle in Xcode (just press the play button), which will install it to Safari
  5. enable experimental support for Highlight API in Safari!! (Settings -> Feature Flags)
  6. load the extension as untrusted (Settings -> Developer -> Allow unsigned).

The only problem is the the allow untrusted checkbox is cleared after Safari is quit, I guess this is "a feature" of Safari. The solution would be to sign the extension but for this, an Apple Developer Account is needed. Anyway, hope this helps someone.

@neaumusic
Copy link
Owner

neaumusic commented Jan 7, 2024

@itaysk I'm finally getting around to this again, with the help of Cursor AI 🙂 it even kinda works on iOS!! It's taken me so long that we can use the Highlight API version rather than the old DOM mutation version lol..

trim.D9E8CF27-C22E-49F4-B525-E474BFD048CD.MOV

I think I've got a pretty good build process and that I can make some fixes tomorrow and publish (probably have to remove PayPal and account for no selectionstart event). It uses an intermediary build folder and shell script to convert the build folder via the CLI to the dist folder, where dist/safari_extension has the .xcodeproj, can be opened and compiled as a target for MacOS or iOS if you enable all the developer flags, sign in and sign the extension

@itaysk
Copy link
Author

itaysk commented Jan 8, 2024

amazing! looking forward

@neaumusic
Copy link
Owner

Getting closer, primarily have to fix 'resize' triggering scrollbar redraw, but it's already come in extremely handy, can't wait to get it published

@neaumusic
Copy link
Owner

Just an update -- Safari on macOS and iOS seem to have a bug with the Highlight API -- img tags, the canvas, and sometimes entire paragraphs are highlighted, making it relatively useless in many cases. I'm familiar enough with Xcode now that if I can find a solution, I can definitely push them to the app stores. Might push to Testflight if I can figure that out. A bit disappointing, but they only started supporting the api in October/December 2023 so I'm not too frustrated

@itaysk
Copy link
Author

itaysk commented Jan 14, 2024

yes I faced the same issue in my improvised port, but don't have the skills to workaround it. happy to help test the extension in TestFlight if you need second validation

@itaysk
Copy link
Author

itaysk commented Jan 14, 2024

oh I just noticed that you included the project in the release now. I managed to install it (it complained about missing account and team, I changed "Team" to "None"), and it works fine!

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

No branches or pull requests

3 participants