Open AntonioDEM opened 4 years ago
Theoretically, this should be possible with Safari 14. Only the distribution seems to a bit more complicated https://developer.apple.com/documentation/safariservices/safari_web_extensions
@LyzardKing Maybe has an idea if this would be possible
It should be possible... I'm not sure how the implementation of native-messaging is in safari, but according to this page it shouldn't be too bad: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension
I think this would be a nice addition, indeed! @Siedlerchr @LyzardKing could you try to create the xcode project as described in https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_web_extension_for_safari. I don't have a Mac, so this is hard for me to do.
It looks like that's all that is required on the extension side, and as @LyzardKing says it shouldn't be too hard to add the required native messaging infrastructure during the installation.
I don't have a mac either.. I might be able to test something in a vm, but that's all the mac access I have
I do have a Mac, so I can prepare this stuff. Will look into it. Just need to know where the extension has to be placed into afterwards
There might be compatibility issues with the current version of native-messaging on macos: https://github.com/keepassxreboot/keepassxc-browser/issues/294
EDIT: this command might give a first idea on the feasibility of the extension: https://github.com/keepassxreboot/keepassxc-browser/issues/294#issuecomment-696301376
@Siedlerchr that seems to be helpful: https://developer.apple.com/documentation/safariservices/safari_app_extensions/building_a_safari_app_extension#2957926
I built it using the converter and could run it in Safari. Also started JabRef but seems not to work yet. https://github.com/JabRef/JabRef-Browser-Extension/tree/safariExt/safari
Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari:
run_at
description
version
nativeMessaging
content_security_policy
js
matches
commands
options_ui
<all_urls>
tabs
page_action
activeTab
scripts
storage
developer
webNavigation
manifest_version
name
icons
Cool! Can you try to update safari and/or xcode. These keys should be supported in more recent versions according to https://github.com/keepassxreboot/keepassxc-browser/issues/294#issuecomment-696318072
Tried again witjh Safari 14.01 (latest technology preview) and I already use xcode 12. Version 12.0.1 (12A7300) in the js console I see:
[Error] Unhandled Promise Rejection: TypeError: Zotero.i18n.init is not a function. (In 'Zotero.i18n.init()', 'Zotero.i18n.init' is undefined)
(anonyme Funktion) (zotero.js:228)
asyncFunctionResume
(anonyme Funktion) (zotero.js:224)
doInject (inject.js:582)
Globaler Code (inject.js:631)
[Error] ReferenceError: Can't find variable: safari
(anonyme Funktion) (inject.js:73)
(anonyme Funktion) (inject.js:616)
Yeah, it's expected that there are gone be some problems as the the Zotero plugin contains some extra checks for their old-style Safari extension, like https://github.com/JabRef/JabRef-Browser-Extension/blob/master/Zotero/inject.js#L73
Maybe setting Zotero.isSafari
to false somewhere early (e.g. in the background script) might already suffices. Otherwise the Zotero code needs to be changed as well.
I will take a look at it in the next days.
@Siedlerchr did you made any progress towards this?
@Siedlerchr ping ;-)
Any progress @Siedlerchr? I've read that the webextension api support of Safari has been improved in the meantime, so this might now be easier.
I will give it a look again
Hi! Is there any progress on this end? I would be very interested in using Jabref on Safari :)
I'd also be very interested in this extension! Is there any progress? :)
is there any way to insert an extension for safari?