From ed543e92cddd650212f20c71007029d96bef8f95 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 10 Sep 2023 17:26:54 +0200 Subject: [PATCH] Copy browser extension files for mac (#10340) * Copy browser extension files for mac Fixes https://github.com/JabRef/jabref/issues/10308 * fix path for jabref detection * add changelog entry * specify pgk --- .github/workflows/deployment-arm64.yml | 4 ++++ .github/workflows/deployment.yml | 4 ++++ CHANGELOG.md | 3 ++- buildres/mac/jabrefHost.py | 4 ++++ .../chromium/org.jabref.jabref.json | 2 +- .../firefox/org.jabref.jabref.json | 7 ++----- buildres/mac/postinstall | 10 +++++----- 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deployment-arm64.yml b/.github/workflows/deployment-arm64.yml index 9105597c42f..53463dd71f3 100644 --- a/.github/workflows/deployment-arm64.yml +++ b/.github/workflows/deployment-arm64.yml @@ -109,6 +109,8 @@ jobs: --module-path ${{env.JDK21}}/Contents/Home/jmods/:build/jlinkbase/jlinkjars \ --add-modules org.jabref,org.jabref.merged.module \ --dest build/distribution \ + --app-content buildres/mac/jabrefHost.py \ + --app-content buildres/mac/native-messaging-host \ --name JabRef \ --app-version ${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }} \ --verbose \ @@ -131,6 +133,8 @@ jobs: --module-path ${{env.JDK21}}/Contents/Home/jmods/:build/jlinkbase/jlinkjars \ --add-modules org.jabref,org.jabref.merged.module \ --dest build/distribution \ + --app-content buildres/mac/jabrefHost.py \ + --app-content buildres/mac/native-messaging-host \ --name JabRef \ --app-version ${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }} \ --verbose \ diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 9f0e27108b4..31246a1c034 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -168,6 +168,8 @@ jobs: --module-path ${{env.JDK21}}/Contents/Home/jmods/:build/jlinkbase/jlinkjars \ --add-modules org.jabref,org.jabref.merged.module \ --dest build/distribution \ + --app-content buildres/mac/jabrefHost.py \ + --app-content buildres/mac/native-messaging-host \ --name JabRef \ --app-version ${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }} \ --verbose \ @@ -191,6 +193,8 @@ jobs: --module-path ${{env.JDK21}}/Contents/Home/jmods/:build/jlinkbase/jlinkjars \ --add-modules org.jabref,org.jabref.merged.module \ --dest build/distribution \ + --app-content buildres/mac/jabrefHost.py \ + --app-content buildres/mac/native-messaging-host \ --name JabRef \ --app-version ${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }} \ --verbose \ diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e6690bba86..c547305feec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - It is possible again to use "current table sort order" for the order of entries when saving. [#9869](https://github.com/JabRef/jabref/issues/9869) - Passwords can be stored in GNOME key ring. [#10274](https://github.com/JabRef/jabref/issues/10274) -- We fixed an issue were groups based on an aux file could not be created due to an exception [#10350](https://github.com/JabRef/jabref/issues/10352) +- We fixed an issue where groups based on an aux file could not be created due to an exception [#10350](https://github.com/JabRef/jabref/issues/10350) +- We fixed an issue where the JabRef browser extension could not communicate with JabRef under macOS due to missing files. You should use the `.pkg` for the first installation as it updates all necessary files for the extension [#10308](https://github.com/JabRef/jabref/issues/10308) ### Removed diff --git a/buildres/mac/jabrefHost.py b/buildres/mac/jabrefHost.py index 85e62f8a791..b9d53de1344 100755 --- a/buildres/mac/jabrefHost.py +++ b/buildres/mac/jabrefHost.py @@ -14,6 +14,10 @@ # Note that the package structure is different when installed as a .app bundle on MacOs, so the path must be altered. script_dir = Path(__file__).resolve().parent.parent JABREF_PATH = script_dir / "bin/JabRef" + +# on mac we must only go one folder upwards +if sys.platform.startswith('darwin'): + script_dir = Path(__file__).resolve().parent if not JABREF_PATH.exists(): JABREF_PATH = script_dir / "MacOS/JabRef" diff --git a/buildres/mac/native-messaging-host/chromium/org.jabref.jabref.json b/buildres/mac/native-messaging-host/chromium/org.jabref.jabref.json index e07d6237487..a075a368409 100644 --- a/buildres/mac/native-messaging-host/chromium/org.jabref.jabref.json +++ b/buildres/mac/native-messaging-host/chromium/org.jabref.jabref.json @@ -1,7 +1,7 @@ { "name": "org.jabref.jabref", "description": "JabRef", - "path": "/Applications/JabRef.app/Contents/Resources/jabrefHost.py", + "path": "/Applications/JabRef.app/Contents/jabrefHost.py", "type": "stdio", "allowed_origins": [ "chrome-extension://bifehkofibaamoeaopjglfkddgkijdlh/", diff --git a/buildres/mac/native-messaging-host/firefox/org.jabref.jabref.json b/buildres/mac/native-messaging-host/firefox/org.jabref.jabref.json index df296d37c84..d6c6541f3d3 100644 --- a/buildres/mac/native-messaging-host/firefox/org.jabref.jabref.json +++ b/buildres/mac/native-messaging-host/firefox/org.jabref.jabref.json @@ -1,10 +1,7 @@ { "name": "org.jabref.jabref", "description": "JabRef", - "path": "/Applications/JabRef.app/Contents/Resources/jabrefHost.py", + "path": "/Applications/JabRef.app/Contents/jabrefHost.py", "type": "stdio", - "allowed_extensions": [ - "browserextension@jabref.org", - "@jabfox" - ] + "allowed_extensions": ["browserextension@jabref.org", "@jabfox"] } diff --git a/buildres/mac/postinstall b/buildres/mac/postinstall index 7fd28171458..9c646441516 100755 --- a/buildres/mac/postinstall +++ b/buildres/mac/postinstall @@ -6,15 +6,15 @@ chmod +r "APP_LOCATION/"*.jar # Trigger an auto-install of the browser addon for chrome/chromium browsers # First create the necessary path, then copy the autoinstall file. install -d /Library/Application\ Support/Google/Chrome/External\ Extensions/ -install -m0644 /Applications/JabRef.app/Contents/Resources/native-messaging-host/chromium/bifehkofibaamoeaopjglfkddgkijdlh.json /Library/Application\ Support/Google/Chrome/External\ Extensions/bifehkofibaamoeaopjglfkddgkijdlh.json +install -m0644 /Applications/JabRef.app/Contents/native-messaging-host/chromium/bifehkofibaamoeaopjglfkddgkijdlh.json /Library/Application\ Support/Google/Chrome/External\ Extensions/bifehkofibaamoeaopjglfkddgkijdlh.json # Install the native-messaging host script for firefox/chrome/chromium install -d /Library/Application\ Support/Mozilla/NativeMessagingHosts/ -install -m0755 /Applications/JabRef.app/Contents/Resources/native-messaging-host/firefox/org.jabref.jabref.json /Library/Application\ Support/Mozilla/NativeMessagingHosts/org.jabref.jabref.json +install -m0755 /Applications/JabRef.app/Contents/native-messaging-host/firefox/org.jabref.jabref.json /Library/Application\ Support/Mozilla/NativeMessagingHosts/org.jabref.jabref.json install -d /Library/Application\ Support/Chromium/NativeMessagingHosts/ -install -m0755 /Applications/JabRef.app/Contents/Resources/native-messaging-host/chromium/org.jabref.jabref.json /Library/Application\ Support/Chromium/NativeMessagingHosts/org.jabref.jabref.json +install -m0755 /Applications/JabRef.app/Contents/native-messaging-host/chromium/org.jabref.jabref.json /Library/Application\ Support/Chromium/NativeMessagingHosts/org.jabref.jabref.json install -d /Library/Google/Chrome/NativeMessagingHosts/ -install -m0755 /Applications/JabRef.app/Contents/Resources/native-messaging-host/chromium/org.jabref.jabref.json /Library/Google/Chrome/NativeMessagingHosts/org.jabref.jabref.json +install -m0755 /Applications/JabRef.app/Contents/native-messaging-host/chromium/org.jabref.jabref.json /Library/Google/Chrome/NativeMessagingHosts/org.jabref.jabref.json install -d /Library/Microsoft/Edge/NativeMessagingHosts/ -install -m0755 /Applications/JabRef.app/Contents/Resources/native-messaging-host/chromium/org.jabref.jabref.json /Library/Microsoft/Edge/NativeMessagingHosts/org.jabref.jabref.json +install -m0755 /Applications/JabRef.app/Contents/native-messaging-host/chromium/org.jabref.jabref.json /Library/Microsoft/Edge/NativeMessagingHosts/org.jabref.jabref.json exit 0