Skip to content

Commit 21c6e5e

Browse files
authored
snap: fix for native-messaging-host permissions (#6062)
* snap: fix for native-messaging-host permissions add hook for chrome/chromium * snap: fix no newline * Add snap browser integration to changelog
1 parent 8111707 commit 21c6e5e

8 files changed

+60
-26
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
1313

1414
### Changed
1515

16+
- Added browser integration to the snap package for firefox/chromium browsers. [#6062](https://github.com/JabRef/jabref/pull/6062)
1617
- We reintroduced the possibility to extract references from plain text (using [GROBID](https://grobid.readthedocs.io/en/latest/)). [#5614](https://github.com/JabRef/jabref/pull/5614)
1718
- We changed the open office panel to show buttons in rows of three instead of going straight down to save space as the button expanded out to take up unnecessary horizontal space. [#5479](https://github.com/JabRef/jabref/issues/5479)
1819
- We cleaned up the group add/edit dialog. [#5826](https://github.com/JabRef/jabref/pull/5826)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
if [ ! -d /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts ]; then
4+
echo "Missing directory, create it manually then try again:"
5+
echo "sudo mkdir -p /etc/chromium/native-messaging-hosts"
6+
exit 1
7+
fi
8+
9+
cp "$SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json" /etc/chromium/native-messaging-hosts/org.jabref.jabref.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
if [ ! -d /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts ]; then
4+
echo "Missing directory, create it manually then try again:"
5+
echo "sudo mkdir -p /etc/opt/chrome/native-messaging-hosts"
6+
exit 1
7+
fi
8+
9+
cp "$SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json" /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json

snap/hooks/connect-plug-browser-extension snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ if [ ! -d /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts ]; then
66
exit 1
77
fi
88

9-
cp $SNAP/lib/org.jabref.jabref.json /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
9+
cp "$SNAP/lib/native-messaging-host/firefox/org.jabref.jabref.json" /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
if [ ! -f /etc/chromium/native-messaging-hosts/org.jabref.jabref.json ]; then
4+
exit 0
5+
elif grep --quiet '"path": "/snap' /etc/chromium/native-messaging-hosts/org.jabref.jabref.json; then
6+
rm /etc/chromium/native-messaging-hosts/org.jabref.jabref.json
7+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
if [ ! -f /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json ]; then
4+
exit 0
5+
elif grep --quiet '"path": "/snap' /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json; then
6+
rm /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
7+
fi

snap/hooks/disconnect-plug-browser-extension snap/hooks/disconnect-plug-hostfs-mozilla-native-messaging-jabref

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ if [ ! -f /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabre
44
exit 0
55
elif grep --quiet '"path": "/snap' /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json; then
66
rm /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
7-
fi
7+
fi

snap/snapcraft.yaml

+25-24
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ license: MIT
1212
architectures:
1313
- build-on: amd64
1414

15+
plugs:
16+
desktop:
17+
desktop-legacy:
18+
wayland:
19+
unity7:
20+
home:
21+
opengl:
22+
network-bind:
23+
removable-media:
24+
hostfs-mozilla-native-messaging-jabref:
25+
interface: system-files
26+
write:
27+
- /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
28+
etc-opt-chrome-native-messaging-jabref:
29+
interface: system-files
30+
write:
31+
- /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
32+
etc-chromium-native-messaging-jabref:
33+
interface: system-files
34+
write:
35+
- /etc/chromium/native-messaging-hosts/org.jabref.jabref.json
36+
1537
apps:
1638
jabref:
1739
command: bin/JabRef
@@ -22,34 +44,13 @@ apps:
2244

2345
environment:
2446
_JAVA_OPTIONS: "-Duser.home=$SNAP_USER_DATA"
25-
plugs:
26-
desktop:
27-
desktop-legacy:
28-
wayland:
29-
unity7:
30-
home:
31-
opengl:
32-
network-bind:
33-
removable-media:
34-
plugs:
35-
hostfs-mozilla-native-messaging-jabref:
36-
interface: system-files
37-
write:
38-
- /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
39-
hostfs-chrome-native-messaging-jabref:
40-
interface: system-files
41-
write:
42-
- /var/lib/snapd/hostfs/etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
43-
hostfs-chromium-native-messaging-jabref:
44-
interface: system-files
45-
write:
46-
- /var/lib/snapd/hostfs/etc/chromium/native-messaging-hosts/org.jabref.jabref.json
47+
4748
parts:
4849
jabref:
4950
plugin: dump
50-
source: build/distribution/JabRef-portable_linux.tar.gz
51+
# source: build/distribution/JabRef-5.0-portable_linux.tar.gz
5152
# Use this source for debug purposes:
52-
# source: https://builds.jabref.org/master/JabRef-portable_linux.tar.gz
53+
source: https://builds.jabref.org/master/JabRef-5.0-portable_linux.tar.gz
5354
stage-packages:
5455
- x11-utils
5556
override-build: |

0 commit comments

Comments
 (0)