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 all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ to the page field for cases where the page numbers are missing. [#7019](https://
- We added a new fetcher to enable users to search jstor.org [#6627](https://github.com/JabRef/jabref/issues/6627)
- We added an error message in the New Entry dialog that is shown in case the fetcher did not find anything . [#7000](https://github.com/JabRef/jabref/issues/7000)
- We added a new formatter to output shorthand month format. [#6579](https://github.com/JabRef/jabref/issues/6579)
- We added support for the new Microsoft Edge browser in all platforms. [#7056](https://github.com/JabRef/jabref/pull/7056)
- We reintroduced emacs/bash-like keybindings. [#6017](https://github.com/JabRef/jabref/issues/6017)

### Changed
Expand Down
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