JabRef / JabRef-Browser-Extension

Browser extension for JabRef to allow importing of new items directly from the browser.
https://www.jabref.org/
GNU Affero General Public License v3.0
84 stars 22 forks source link

JabRef BrowserExtension for Safari #227

Open AntonioDEM opened 4 years ago

AntonioDEM commented 4 years ago

is there any way to insert an extension for safari?

Siedlerchr commented 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

https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_web_extension_for_safari

@LyzardKing Maybe has an idea if this would be possible

LyzardKing commented 4 years ago

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

tobiasdiez commented 4 years ago

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.

LyzardKing commented 4 years ago

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

Siedlerchr commented 4 years ago

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

LyzardKing commented 4 years ago

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

tobiasdiez commented 4 years ago

@Siedlerchr that seems to be helpful: https://developer.apple.com/documentation/safariservices/safari_app_extensions/building_a_safari_app_extension#2957926

Siedlerchr commented 4 years ago

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

Bildschirmfoto 2020-10-08 um 15 37 35
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

https://developer.apple.com/documentation/safariservices/safari_web_extensions/assessing_your_safari_web_extension_s_browser_compatibility

tobiasdiez commented 4 years ago

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

Siedlerchr commented 4 years ago

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)
tobiasdiez commented 4 years ago

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.

Siedlerchr commented 4 years ago

I will take a look at it in the next days.

tobiasdiez commented 3 years ago

@Siedlerchr did you made any progress towards this?

tobiasdiez commented 3 years ago

@Siedlerchr ping ;-)

tobiasdiez commented 2 years ago

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.

Siedlerchr commented 2 years ago

I will give it a look again

EmilianoG-byte commented 2 months ago

Hi! Is there any progress on this end? I would be very interested in using Jabref on Safari :)

Jhofenbitzer commented 1 week ago

I'd also be very interested in this extension! Is there any progress? :)