mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
ui, cli: added proto/grpc versions to cli tool
Display what versions is using the GUI. It'll help to debug issues. For next releases we may need to check incompatibilities between grpc and protobuf (#790).
This commit is contained in:
parent
690cea7774
commit
ba5208ef02
2 changed files with 20 additions and 5 deletions
|
@ -22,9 +22,7 @@ if dist_path not in sys.path:
|
|||
|
||||
from opensnitch.service import UIService
|
||||
from opensnitch.config import Config
|
||||
from opensnitch.utils import Themes
|
||||
from opensnitch.utils import Utils
|
||||
import opensnitch.version
|
||||
from opensnitch.utils import Themes, Utils, Versions
|
||||
import opensnitch.ui_pb2
|
||||
from opensnitch.ui_pb2_grpc import add_UIServicer_to_server
|
||||
|
||||
|
@ -47,6 +45,11 @@ def load_translations():
|
|||
return translator
|
||||
|
||||
if __name__ == '__main__':
|
||||
gui_version, grpcversion, protoversion = Versions.get()
|
||||
print("\t ~ OpenSnitch GUI -", gui_version, "~")
|
||||
print("\tprotobuf:", protoversion, "-", "grpc:", grpcversion)
|
||||
print("-" * 50, "\n")
|
||||
|
||||
parser = argparse.ArgumentParser(description='OpenSnitch UI service.', formatter_class=argparse.RawTextHelpFormatter)
|
||||
parser.add_argument("--socket", dest="socket", help='''
|
||||
Path of the unix socket for the gRPC service (https://github.com/grpc/grpc/blob/master/doc/naming.md).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||
from opensnitch.version import version
|
||||
from opensnitch.version import version as gui_version
|
||||
from opensnitch.database import Database
|
||||
from opensnitch.config import Config
|
||||
from threading import Thread, Event
|
||||
|
@ -250,7 +250,7 @@ class QuickHelp():
|
|||
class Utils():
|
||||
@staticmethod
|
||||
def check_versions(daemon_version):
|
||||
lMayor, lMinor, lPatch = version.split(".")
|
||||
lMayor, lMinor, lPatch = gui_version.split(".")
|
||||
rMayor, rMinor, rPatch = daemon_version.split(".")
|
||||
return lMayor != rMayor or (lMayor == rMayor and lMinor != rMinor)
|
||||
|
||||
|
@ -455,3 +455,15 @@ class Icons():
|
|||
pass
|
||||
|
||||
return icon
|
||||
|
||||
class Versions():
|
||||
@staticmethod
|
||||
def get():
|
||||
try:
|
||||
from google.protobuf import __version__ as proto_version
|
||||
from grpc import __version__ as grpc_version
|
||||
|
||||
return gui_version, grpc_version, proto_version
|
||||
|
||||
except:
|
||||
return "none", "none", "none"
|
||||
|
|
Loading…
Add table
Reference in a new issue