View | Details | Raw Unified | Return to bug 257423 | Differences between
and this patch

Collapse All | Expand All

(-)b/net-p2p/warpinator/Makefile (+34 lines)
Added Link Here
1
PORTNAME=	warpinator
2
PORTVERSION=	1.2.4
3
CATEGORIES=	net-p2p gnome
4
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
5
DIST_SUBDIR=	gnome
6
7
MAINTAINER=	rozhuk.im@gmail.com
8
COMMENT=	Share files across the LAN
9
10
LICENSE=	GPLv3
11
LICENSE_FILE=	${WRKSRC}/COPYING
12
13
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cryptography>=0:security/py-cryptography@${PY_FLAVOR} \
14
		${PYTHON_PKGNAMEPREFIX}grpcio>=1.16.0:devel/py-grpcio@${PY_FLAVOR} \
15
		${PYTHON_PKGNAMEPREFIX}netifaces>=0:net/py-netifaces@${PY_FLAVOR} \
16
		${PYTHON_PKGNAMEPREFIX}pynacl>=0:security/py-pynacl@${PY_FLAVOR} \
17
		${PYTHON_PKGNAMEPREFIX}python-xapp>=1.6.0:x11/py-python-xapp@${PY_FLAVOR} \
18
		${PYTHON_PKGNAMEPREFIX}setproctitle>=0:devel/py-setproctitle@${PY_FLAVOR} \
19
		${PYTHON_PKGNAMEPREFIX}zeroconf>=0.27.0:net/py-zeroconf@${PY_FLAVOR} \
20
		xapp>=0:x11/xapp
21
22
USES=		gettext gnome meson python:3.6+ shebangfix
23
USE_GNOME=	glib20 gtk30 pygobject3
24
USE_GITHUB=	yes
25
GH_ACCOUNT=	linuxmint
26
MESON_ARGS=	-Dinclude-firewall-mod=false \
27
		-Dflatpak-build=false \
28
		-Dbundle-zeroconf=false
29
BINARY_ALIAS=	python3=${PYTHON_CMD}
30
SHEBANG_FILES=	generate-protobuf bin/warpinator.in testing/testrun
31
SHEBANG_GLOB=	*.py
32
GLIB_SCHEMAS=	org.x.Warpinator.gschema.xml
33
34
.include <bsd.port.mk>
(-)b/net-p2p/warpinator/distinfo (+3 lines)
Added Link Here
1
TIMESTAMP = 1627250115
2
SHA256 (gnome/linuxmint-warpinator-1.2.4_GH0.tar.gz) = c48b69b24648a895c1d0fb2eb95209e935c7d7a5a03b7979a879b709a7a8f925
3
SIZE (gnome/linuxmint-warpinator-1.2.4_GH0.tar.gz) = 400318
(-)b/net-p2p/warpinator/files/patch-src_networkmonitor.py (+251 lines)
Added Link Here
1
--- src/networkmonitor.py	2021-07-26 01:29:17.438831000 +0300
2
+++ src/networkmonitor.py	2021-07-26 02:10:01.817245000 +0300
3
@@ -6,8 +6,7 @@
4
 import ipaddress
5
 
6
 import gi
7
-gi.require_version('NM', '1.0')
8
-from gi.repository import GLib, Gio, GObject, NM
9
+from gi.repository import GLib, GObject
10
 
11
 import prefs
12
 import util
13
@@ -32,34 +31,19 @@
14
     def __init__(self):
15
         GObject.Object.__init__(self)
16
         logging.debug("Starting network monitor")
17
-        self.nm_client = None
18
         self.device = None
19
-        self.current_iface = None
20
-        self.online = False
21
+        self.online = True
22
 
23
-        self.signals_connected = False
24
         self.details_idle_id = 0
25
 
26
-        self.initing = True
27
-        self.gio_monitor = Gio.NetworkMonitor.get_default()
28
-        NM.Client.new_async(None, self.nm_client_acquired);
29
+        self.reload_state()
30
 
31
-    def nm_client_acquired(self, source, res, data=None):
32
-        try:
33
-            self.nm_client = NM.Client.new_finish(res)
34
-            self.nm_client.connect("notify::connectivity", self.nm_client_connectivity_changed)
35
-            self.signals_connected = True
36
-            self.reload_state()
37
+        prefs.prefs_settings.connect("changed", self.on_prefs_changed)
38
 
39
-            prefs.prefs_settings.connect("changed", self.on_prefs_changed)
40
+        self.emit("ready")
41
 
42
-            self.initing = False
43
-            self.emit("ready")
44
-        except GLib.Error as e:
45
-            logging.critical("NetworkMonitor: Could not create NM Client: %s" % e.message)
46
-
47
     def ready(self):
48
-        return self.nm_client != None
49
+        return True
50
 
51
     def on_prefs_changed(self, settings, key, data=None):
52
         new_main_port = prefs.get_port()
53
@@ -68,7 +52,7 @@
54
 
55
         emit = False
56
 
57
-        if self.device == None or self.device.get_iface() != new_iface:
58
+        if self.device != new_iface:
59
             self.reload_state()
60
             return
61
 
62
@@ -83,100 +67,37 @@
63
             self.emit_details_changed()
64
 
65
     def reload_state(self):
66
-        if self.nm_client == None:
67
-            return
68
+        new_device = self.get_preferred_or_default_iface()
69
 
70
-        old_online = self.online
71
-        new_device = None
72
-        new_iface = self.get_preferred_or_default_iface()
73
-
74
-        if new_iface:
75
-            new_device = self.nm_client.get_device_by_iface(new_iface)
76
-
77
         need_restart = False
78
 
79
-        if new_device == None or new_iface == None:
80
-            self.device = None
81
-            self.current_iface = None
82
-            self.online = False
83
-            need_restart = True
84
-        elif new_device != self.device or new_iface != self.current_iface:
85
+        if new_device == None or new_device != self.device:
86
             self.device = new_device
87
-            self.current_iface = new_iface
88
             need_restart = True
89
 
90
-        self.online = self.check_online()
91
-
92
-        if old_online != self.online:
93
-            need_restart = True
94
-
95
         self.main_port = prefs.get_port()
96
         self.auth_port = prefs.get_auth_port()
97
 
98
-        if self.initing:
99
-            return
100
-
101
         if need_restart:
102
             self.emit_state_changed()
103
             logging.debug("Current network changed (%s), connectivity: %s" % (prefs.get_preferred_iface(), str(self.online)))
104
 
105
-    def check_online(self):
106
-        if self.device == None or self.current_iface == None:
107
-            return False
108
-
109
-        try:
110
-            reqd_states = (NM.ConnectivityState.LIMITED, NM.ConnectivityState.FULL)
111
-
112
-            return self.device.get_connectivity(GLib.SYSDEF_AF_INET) in reqd_states or \
113
-                   self.device.get_connectivity(GLib.SYSDEF_AF_INET6) in reqd_states
114
-        except AttributeError:
115
-            # libnm < 1.16
116
-            conn = self.device.get_active_connection()
117
-            if conn:
118
-                config = conn.get_ip4_config()
119
-                if config:
120
-                    gateway = config.get_gateway()
121
-                    try:
122
-                        connectable = Gio.NetworkAddress.parse(gateway, 53)
123
-                        return self.gio_monitor.can_reach(connectable, None)
124
-                    except Exception as e:
125
-                        return False
126
-
127
-    def nm_client_connectivity_changed(self, client, pspec, data=None):
128
-        logging.debug("NM client connectivity prop changed: %s" % client.props.connectivity)
129
-        self.reload_state()
130
-
131
     def stop(self):
132
         logging.debug("Stopping network monitor")
133
-        try:
134
-            self.nm_client.disconnect_by_func(self.nm_client_connectivity_changed)
135
-        except:
136
-            pass
137
 
138
-        self.nm_client = None
139
-
140
-    def get_interface_names(self):
141
-        names = []
142
-        for device in self.nm_client.get_devices():
143
-            names.append(device.get_ip_iface())
144
-
145
-        return names
146
-
147
     def get_ips(self):
148
         return util.IPAddresses(self.get_ipv4(), self.get_ipv6())
149
 
150
     def get_ipv4(self):
151
         if self.device != None:
152
-            con = self.device.get_active_connection()
153
+            interface_addresses = netifaces.interfaces()
154
+            if not self.device in netifaces.interfaces():
155
+                return None
156
+            interface_addresses = netifaces.ifaddresses(self.device)
157
+            if not netifaces.AF_INET in interface_addresses:
158
+                return None
159
+            return interface_addresses[netifaces.AF_INET][0]['addr']
160
 
161
-            if con != None:
162
-                ip4c = con.get_ip4_config()
163
-                if ip4c != None:
164
-                    addrs = ip4c.get_addresses()
165
-
166
-                    if addrs != []:
167
-                        return addrs[0].get_address()
168
-
169
         return "0.0.0.0"
170
 
171
     def get_ipv6(self):
172
@@ -184,16 +105,14 @@
173
         return None
174
 
175
         if self.device != None:
176
-            con = self.device.get_active_connection()
177
+            interface_addresses = netifaces.interfaces()
178
+            if not self.device in netifaces.interfaces():
179
+                return None
180
+            interface_addresses = netifaces.ifaddresses(self.device)
181
+            if not netifaces.AF_INET6 in interface_addresses:
182
+                return None
183
+            return interface_addresses[netifaces.AF_INET6][0]['addr']
184
 
185
-            if con != None:
186
-                ip6c = con.get_ip6_config()
187
-                if ip6c != None:
188
-                    addrs = ip6c.get_addresses()
189
-
190
-                    if addrs != []:
191
-                        return addrs[0].get_address()
192
-
193
         return None
194
 
195
     def get_preferred_or_default_iface(self):
196
@@ -206,35 +125,34 @@
197
 
198
         if iface != "auto":
199
             for dev in self.get_devices():
200
-                if dev.get_iface() == iface:
201
+                if dev == iface:
202
                     return iface
203
 
204
         logging.warning("Preferred interface (%s) not available.")
205
         return None
206
 
207
     def get_current_iface(self):
208
-        return self.current_iface
209
+        return self.device
210
 
211
     def get_default_interface(self):
212
-        con = self.nm_client.get_primary_connection()
213
+        return self.get_devices()[0]
214
 
215
-        if con != None:
216
-            return con.get_devices()[0].get_iface()
217
-
218
-        return None
219
-
220
     def get_devices(self):
221
         devices = []
222
 
223
-        for device in self.nm_client.get_devices():
224
-            if device.get_device_type() in (NM.DeviceType.ETHERNET, NM.DeviceType.WIFI):
225
+        for device in netifaces.interfaces():
226
+            if device == "lo0":
227
+                continue
228
+            addrs = netifaces.ifaddresses(device)
229
+            if netifaces.AF_LINK not in addrs:
230
+                continue
231
+            if netifaces.AF_INET in addrs or netifaces.AF_INET6 in addrs:
232
                 devices.append(device)
233
 
234
         return devices
235
 
236
-    # TODO: Do this with libnm
237
     def same_subnet(self, other_ips):
238
-        net = netifaces.ifaddresses(self.device.get_ip_iface())
239
+        net = netifaces.ifaddresses(self.device)
240
 
241
         addresses = net[netifaces.AF_INET]
242
         for address in addresses:
243
@@ -265,7 +183,7 @@
244
     def emit_details_changed(self):
245
         def cb(data=None):
246
             if self.device != None:
247
-                iface = self.device.get_iface()
248
+                iface = self.device
249
             else:
250
                 iface = "none"
251
 
(-)b/net-p2p/warpinator/files/patch-src_prefs.py (+27 lines)
Added Link Here
1
--- src/prefs.py	2021-07-26 02:34:22.041751000 +0300
2
+++ src/prefs.py	2021-07-26 02:40:33.854059000 +0300
3
@@ -214,22 +214,9 @@
4
         devices = networkmonitor.get_network_monitor().get_devices()
5
 
6
         for dev in devices:
7
-            iface = dev.get_iface()
8
-            if iface == get_preferred_iface():
9
+            if dev == get_preferred_iface():
10
                 current_selection_exists = True
11
-
12
-            desc = dev.get_product()
13
-
14
-            if (desc != None and desc != ""):
15
-                orig_label = "%s - %s" % (iface, desc)
16
-                if len(orig_label) > 50:
17
-                    label = orig_label[:47] + "..."
18
-                else:
19
-                    label = orig_label
20
-
21
-                options.append((iface, label))
22
-            else:
23
-                options.append((iface, iface))
24
+            options.append((dev, dev))
25
 
26
         if not current_selection_exists:
27
             # translation: combobox item shown when a previosuly set interface can no longer be found - 'wlan0 - not found'
(-)b/net-p2p/warpinator/pkg-descr (+8 lines)
Added Link Here
1
Warpinator is a kind of AirDrop for devices using Gnu / Linux operating
2
systems, allowing us to send files to computers that are connected to
3
the same Wi-Fi network.
4
5
Android clients also available in F-Droid and google play.
6
7
8
WWW: https://github.com/linuxmint/warpinator
(-)b/net-p2p/warpinator/pkg-plist (+91 lines)
Added Link Here
1
bin/warpinator
2
etc/xdg/autostart/warpinator-autostart.desktop
3
libexec/warpinator/auth.py
4
libexec/warpinator/config.py
5
libexec/warpinator/interceptors.py
6
libexec/warpinator/networkmonitor.py
7
libexec/warpinator/notifications.py
8
libexec/warpinator/ops.py
9
libexec/warpinator/prefs.py
10
libexec/warpinator/remote.py
11
libexec/warpinator/remote_registration.py
12
libexec/warpinator/server.py
13
libexec/warpinator/transfers.py
14
libexec/warpinator/util.py
15
libexec/warpinator/warp_pb2.py
16
libexec/warpinator/warp_pb2_grpc.py
17
libexec/warpinator/warpinator.py
18
share/applications/org.x.Warpinator.desktop
19
share/icons/hicolor/16x16/apps/org.x.Warpinator.png
20
share/icons/hicolor/16x16@2/apps/org.x.Warpinator.png
21
share/icons/hicolor/22x22/apps/org.x.Warpinator.png
22
share/icons/hicolor/22x22@2/apps/org.x.Warpinator.png
23
share/icons/hicolor/24x24/apps/org.x.Warpinator.png
24
share/icons/hicolor/24x24@2/apps/org.x.Warpinator.png
25
share/icons/hicolor/256x256/apps/org.x.Warpinator.png
26
share/icons/hicolor/256x256@2/apps/org.x.Warpinator.png
27
share/icons/hicolor/32x32/apps/org.x.Warpinator.png
28
share/icons/hicolor/32x32@2/apps/org.x.Warpinator.png
29
share/icons/hicolor/48x48/apps/org.x.Warpinator.png
30
share/icons/hicolor/48x48@2/apps/org.x.Warpinator.png
31
share/icons/hicolor/64x64/apps/org.x.Warpinator.png
32
share/icons/hicolor/64x64@2/apps/org.x.Warpinator.png
33
share/icons/hicolor/96x96/apps/org.x.Warpinator.png
34
share/icons/hicolor/96x96@2/apps/org.x.Warpinator.png
35
share/icons/hicolor/scalable/apps/org.x.Warpinator-error-symbolic.svg
36
share/icons/hicolor/scalable/apps/org.x.Warpinator-symbolic.svg
37
share/locale/am/LC_MESSAGES/warpinator.mo
38
share/locale/ar/LC_MESSAGES/warpinator.mo
39
share/locale/be/LC_MESSAGES/warpinator.mo
40
share/locale/bn/LC_MESSAGES/warpinator.mo
41
share/locale/ca/LC_MESSAGES/warpinator.mo
42
share/locale/cs/LC_MESSAGES/warpinator.mo
43
share/locale/cy/LC_MESSAGES/warpinator.mo
44
share/locale/da/LC_MESSAGES/warpinator.mo
45
share/locale/de/LC_MESSAGES/warpinator.mo
46
share/locale/el/LC_MESSAGES/warpinator.mo
47
share/locale/en_GB/LC_MESSAGES/warpinator.mo
48
share/locale/eo/LC_MESSAGES/warpinator.mo
49
share/locale/es/LC_MESSAGES/warpinator.mo
50
share/locale/et/LC_MESSAGES/warpinator.mo
51
share/locale/eu/LC_MESSAGES/warpinator.mo
52
share/locale/fi/LC_MESSAGES/warpinator.mo
53
share/locale/fr/LC_MESSAGES/warpinator.mo
54
share/locale/fr_CA/LC_MESSAGES/warpinator.mo
55
share/locale/fy/LC_MESSAGES/warpinator.mo
56
share/locale/he/LC_MESSAGES/warpinator.mo
57
share/locale/hi/LC_MESSAGES/warpinator.mo
58
share/locale/hr/LC_MESSAGES/warpinator.mo
59
share/locale/hu/LC_MESSAGES/warpinator.mo
60
share/locale/ia/LC_MESSAGES/warpinator.mo
61
share/locale/id/LC_MESSAGES/warpinator.mo
62
share/locale/ie/LC_MESSAGES/warpinator.mo
63
share/locale/is/LC_MESSAGES/warpinator.mo
64
share/locale/it/LC_MESSAGES/warpinator.mo
65
share/locale/ja/LC_MESSAGES/warpinator.mo
66
share/locale/kab/LC_MESSAGES/warpinator.mo
67
share/locale/kk/LC_MESSAGES/warpinator.mo
68
share/locale/kn/LC_MESSAGES/warpinator.mo
69
share/locale/ko/LC_MESSAGES/warpinator.mo
70
share/locale/la/LC_MESSAGES/warpinator.mo
71
share/locale/lt/LC_MESSAGES/warpinator.mo
72
share/locale/nl/LC_MESSAGES/warpinator.mo
73
share/locale/oc/LC_MESSAGES/warpinator.mo
74
share/locale/pl/LC_MESSAGES/warpinator.mo
75
share/locale/pt/LC_MESSAGES/warpinator.mo
76
share/locale/pt_BR/LC_MESSAGES/warpinator.mo
77
share/locale/ro/LC_MESSAGES/warpinator.mo
78
share/locale/ru/LC_MESSAGES/warpinator.mo
79
share/locale/sr/LC_MESSAGES/warpinator.mo
80
share/locale/sr@latin/LC_MESSAGES/warpinator.mo
81
share/locale/sv/LC_MESSAGES/warpinator.mo
82
share/locale/tr/LC_MESSAGES/warpinator.mo
83
share/locale/uk/LC_MESSAGES/warpinator.mo
84
share/locale/zgh/LC_MESSAGES/warpinator.mo
85
share/locale/zh_CN/LC_MESSAGES/warpinator.mo
86
share/locale/zh_HK/LC_MESSAGES/warpinator.mo
87
share/metainfo/org.x.Warpinator.appdata.xml
88
%%DATADIR%%/main-window.ui
89
%%DATADIR%%/op-item.ui
90
%%DATADIR%%/overview-button.ui
91
%%DATADIR%%/prefs-window.ui

Return to bug 257423