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

Add support for Microsoft Edge browser in Windows and Linux builds #7056

Merged
merged 4 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ if (OperatingSystem.current().isWindows()) {
tasks.jpackageImage.doLast {
copy {
from("${projectDir}/buildres/windows") {
include "jabref.json", "jabref-chrome.json", "JabRefHost.bat", "JabRefHost.ps1"
include "jabref-firefox.json", "jabref-chrome.json", "JabRefHost.bat", "JabRefHost.ps1"
}
into "$buildDir/distribution/JabRef"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"path": "/opt/jabref/lib/jabrefHost.py",
"type": "stdio",
"allowed_origins": [
"chrome-extension://bifehkofibaamoeaopjglfkddgkijdlh/"
"chrome-extension://bifehkofibaamoeaopjglfkddgkijdlh/",
"chrome-extension://pgkajmkfgbehiomipedjhoddkejohfna/"
]
}
1 change: 1 addition & 0 deletions buildres/linux/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ case "$1" in
install -D -m0755 /opt/jabref/lib/native-messaging-host/firefox/org.jabref.jabref.json /usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
install -D -m0755 /opt/jabref/lib/native-messaging-host/chromium/org.jabref.jabref.json /etc/chromium/native-messaging-hosts/org.jabref.jabref.json
install -D -m0755 /opt/jabref/lib/native-messaging-host/chromium/org.jabref.jabref.json /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
install -D -m0755 /opt/jabref/lib/native-messaging-host/chromium/org.jabref.jabref.json /etc/opt/edge/native-messaging-hosts/org.jabref.jabref.json
# Trigger an auto-install of the browser addon for chrome/chromium browsers
install -D -m0644 /opt/jabref/lib/native-messaging-host/chromium/bifehkofibaamoeaopjglfkddgkijdlh.json /opt/google/chrome/extensions/bifehkofibaamoeaopjglfkddgkijdlh.json
install -D -m0644 /opt/jabref/lib/native-messaging-host/chromium/bifehkofibaamoeaopjglfkddgkijdlh.json /usr/share/google-chrome/extensions/bifehkofibaamoeaopjglfkddgkijdlh.json
Expand Down
3 changes: 2 additions & 1 deletion buildres/linux/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ case "$1" in
# Remove the native-messaging hosts script only if relative to the deb package
for NATIVE_MESSAGING_JSON in "/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json"\
"/etc/chromium/native-messaging-hosts/org.jabref.jabref.json"\
"/etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json"; do
"/etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json"\
"/etc/opt/edge/native-messaging-hosts/org.jabref.jabref.json"; do
if [ -e $NATIVE_MESSAGING_JSON ] && grep --quiet '"path": "/opt' $NATIVE_MESSAGING_JSON; then
rm $NATIVE_MESSAGING_JSON
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"path": "/Applications/JabRef.app/Contents/Resources/jabrefHost.py",
"type": "stdio",
"allowed_origins": [
"chrome-extension://bifehkofibaamoeaopjglfkddgkijdlh/"
"chrome-extension://bifehkofibaamoeaopjglfkddgkijdlh/",
"chrome-extension://pgkajmkfgbehiomipedjhoddkejohfna/"
]
}
2 changes: 2 additions & 0 deletions buildres/mac/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ 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 -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 -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

exit 0
2 changes: 1 addition & 1 deletion buildres/windows/JabRef-post-image.wsf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
wxsFile.Close();

// Add registry values for JabRef Browser Extension
contents = contents.replace("</Product>", "<DirectoryRef Id=\"TARGETDIR\"><Component Id=\"RegistryJabRefBrowserEntries\" Guid=\"b6bc55ad-905c-4258-89b1-8b37abbe559c\" Win64=\"yes\"><RegistryKey Root=\"HKMU\" Key=\"SOFTWARE\\Mozilla\\NativeMessagingHosts\\org.jabref.jabref\" Action=\"createAndRemoveOnUninstall\" ForceCreateOnInstall=\"yes\"><RegistryValue Type=\"string\" Value=\"[INSTALLDIR]jabref.json\"/></RegistryKey><RegistryKey Root=\"HKMU\" Key=\"Software\\Google\\Chrome\\NativeMessagingHosts\\org.jabref.jabref\" Action=\"createAndRemoveOnUninstall\" ForceCreateOnInstall=\"yes\"><RegistryValue Type=\"string\" Value=\"[INSTALLDIR]jabref-chrome.json\"/></RegistryKey></Component></DirectoryRef><Feature Id=\"BrowserExtension\" Level=\"1\"><ComponentRef Id=\"RegistryJabRefBrowserEntries\" /></Feature></Product>");
contents = contents.replace("</Product>", "<DirectoryRef Id=\"TARGETDIR\"><Component Id=\"RegistryJabRefBrowserEntries\" Guid=\"b6bc55ad-905c-4258-89b1-8b37abbe559c\" Win64=\"yes\"><RegistryKey Root=\"HKMU\" Key=\"SOFTWARE\\Mozilla\\NativeMessagingHosts\\org.jabref.jabref\" Action=\"createAndRemoveOnUninstall\" ForceCreateOnInstall=\"yes\"><RegistryValue Type=\"string\" Value=\"[INSTALLDIR]jabref-firefox.json\"/></RegistryKey><RegistryKey Root=\"HKMU\" Key=\"Software\\Google\\Chrome\\NativeMessagingHosts\\org.jabref.jabref\" Action=\"createAndRemoveOnUninstall\" ForceCreateOnInstall=\"yes\"><RegistryValue Type=\"string\" Value=\"[INSTALLDIR]jabref-chrome.json\"/></RegistryKey><RegistryKey Root=\"HKMU\" Key=\"Software\\Microsoft\\Edge\\NativeMessagingHosts\\org.jabref.jabref\" Action=\"createAndRemoveOnUninstall\" ForceCreateOnInstall=\"yes\"><RegistryValue Type=\"string\" Value=\"[INSTALLDIR]jabref-chrome.json\"/></RegistryKey></Component></DirectoryRef><Feature Id=\"BrowserExtension\" Level=\"1\"><ComponentRef Id=\"RegistryJabRefBrowserEntries\" /></Feature></Product>");

// Specify banner
contents = contents.replace("</Product>", "<WixVariable Id=\"WixUIBannerBmp\" Value=\"JabRefTopBanner.bmp\" /></Product>");
Expand Down
3 changes: 2 additions & 1 deletion buildres/windows/jabref-chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"path": "JabRefHost.bat",
"type": "stdio",
"allowed_origins": [
"chrome-extension://bifehkofibaamoeaopjglfkddgkijdlh/"
"chrome-extension://bifehkofibaamoeaopjglfkddgkijdlh/",
"chrome-extension://pgkajmkfgbehiomipedjhoddkejohfna/"
]
}
9 changes: 9 additions & 0 deletions snap/hooks/connect-plug-etc-opt-edge-native-messaging-jabref
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if [ ! -d /etc/opt/edge/native-messaging-hosts ]; then
echo "Missing directory, create it manually then try again:"
echo "sudo mkdir -p /etc/opt/edge/native-messaging-hosts"
exit 1
fi

cp "$SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json" /etc/opt/edge/native-messaging-hosts/org.jabref.jabref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if [ ! -f /etc/opt/edge/native-messaging-hosts/org.jabref.jabref.json ]; then
exit 0
elif grep --quiet '"path": "/snap' /etc/opt/edge/native-messaging-hosts/org.jabref.jabref.json; then
rm /etc/opt/edge/native-messaging-hosts/org.jabref.jabref.json
fi
6 changes: 4 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ plugs:
interface: system-files
write:
- /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
etc-opt-edge-native-messaging-jabref:
interface: system-files
write:
- /etc/opt/edge/native-messaging-hosts/org.jabref.jabref.json
etc-chromium-native-messaging-jabref:
interface: system-files
write:
Expand All @@ -48,8 +52,6 @@ environment:
parts:
jabref:
plugin: dump
# source: build/distribution/JabRef-5.2-portable_linux.tar.gz
# Use this source for debug purposes:
source: https://builds.jabref.org/master/JabRef-5.2-portable_linux.tar.gz
stage-packages:
- x11-utils
Expand Down