From 96f426d231b19bf6bd73d698fedb5ff912fd61cd Mon Sep 17 00:00:00 2001 From: Wiktor Jezioro Date: Sun, 23 Jul 2017 11:26:53 +0200 Subject: [PATCH 1/5] Update login.py --- UI/login.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/UI/login.py b/UI/login.py index 7a3cf6e..c080ce8 100644 --- a/UI/login.py +++ b/UI/login.py @@ -9,6 +9,7 @@ from .mainUI import MainUI from .qt_interfaces.login_ui_new import Ui_Login from .utilities.account_manager import AccountManager +from resources.constants import DEFAULT_BRIDGE_API_URL # Login section @@ -16,7 +17,7 @@ class LoginUI(QtGui.QMainWindow): __logger = logging.getLogger('%s.LoginUI' % __name__) - def __init__(self, parent=None): + def __init__(self, parent=None, init_window=None): QtGui.QWidget.__init__(self, parent) # Login UI @@ -26,6 +27,8 @@ def __init__(self, parent=None): # Account manager self.login_ui.password.setEchoMode(QtGui.QLineEdit.Password) + self.login_ui.bridge_url.setText(DEFAULT_BRIDGE_API_URL) + QtCore.QObject.connect(self.login_ui.login_bt, QtCore.SIGNAL('clicked()'), self.login) # Take login action @@ -34,6 +37,10 @@ def login(self): # Take login action self.email = str(self.login_ui.email.text()).strip() self.password = str(self.login_ui.password.text()).strip() + self.bridge_api_url = str(self.login_ui.bridge_url.text()).strip() # get bridge api url + + if self.bridge_api_url == "": + self.bridge_api_url = DEFAULT_BRIDGE_API_URL self.storj_client = storj.Client(email=self.email, password=self.password) From f6fe438ad7369d6d607f008a3fa6fad4bcca743a Mon Sep 17 00:00:00 2001 From: Wiktor Jezioro Date: Sun, 23 Jul 2017 11:29:37 +0200 Subject: [PATCH 2/5] Add ongoin bridge connections label to UI --- UI/qt_interfaces/file_upload_new.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/UI/qt_interfaces/file_upload_new.py b/UI/qt_interfaces/file_upload_new.py index da16f42..db024e5 100644 --- a/UI/qt_interfaces/file_upload_new.py +++ b/UI/qt_interfaces/file_upload_new.py @@ -202,7 +202,7 @@ def setupUi(self, SingleFileUpload): self.tmp_path.setGeometry(QtCore.QRect(130, 100, 801, 31)) self.tmp_path.setObjectName(_fromUtf8("tmp_path")) self.encrypt_files_checkbox = QtGui.QCheckBox(SingleFileUpload) - self.encrypt_files_checkbox.setGeometry(QtCore.QRect(20, 140, 171, 41)) + self.encrypt_files_checkbox.setGeometry(QtCore.QRect(390, 140, 141, 41)) font = QtGui.QFont() font.setFamily(_fromUtf8("Lato")) font.setPointSize(11) @@ -436,6 +436,28 @@ def setupUi(self, SingleFileUpload): self.shard_size_unit.addItem(_fromUtf8("")) self.shard_size_unit.addItem(_fromUtf8("")) self.shard_size_unit.addItem(_fromUtf8("")) + self.label_19 = QtGui.QLabel(SingleFileUpload) + self.label_19.setGeometry(QtCore.QRect(20, 150, 261, 20)) + font = QtGui.QFont() + font.setFamily(_fromUtf8("Lato")) + font.setPointSize(11) + font.setBold(True) + font.setWeight(75) + self.label_19.setFont(font) + self.label_19.setObjectName(_fromUtf8("label_19")) + self.ongoing_bridge_requests = QtGui.QLabel(SingleFileUpload) + self.ongoing_bridge_requests.setGeometry(QtCore.QRect(280, 150, 101, 16)) + font = QtGui.QFont() + font.setFamily(_fromUtf8("Lato")) + font.setPointSize(11) + font.setBold(True) + font.setWeight(75) + self.ongoing_bridge_requests.setFont(font) + self.ongoing_bridge_requests.setStyleSheet(_fromUtf8("QLabel{\n" +"color: #2683ff;\n" +"}\n" +"")) + self.ongoing_bridge_requests.setObjectName(_fromUtf8("ongoing_bridge_requests")) self.retranslateUi(SingleFileUpload) self.shard_size_unit.setCurrentIndex(0) @@ -483,5 +505,7 @@ def retranslateUi(self, SingleFileUpload): self.shard_size_unit.setItemText(2, _translate("SingleFileUpload", "GB", None)) self.shard_size_unit.setItemText(3, _translate("SingleFileUpload", "TB", None)) self.shard_size_unit.setItemText(4, _translate("SingleFileUpload", "PB", None)) + self.label_19.setText(_translate("SingleFileUpload", "

ONGOING BRIDGE REQUESTS:

", None)) + self.ongoing_bridge_requests.setText(_translate("SingleFileUpload", "

0

", None)) import resources_rc From fd993a24dd79d084c5fa27b2f2109c5abca1e61c Mon Sep 17 00:00:00 2001 From: Wiktor Jezioro Date: Thu, 27 Jul 2017 16:38:37 +0200 Subject: [PATCH 3/5] Create footer.html --- UI/flask_ownstorj/ownstorj/templates/footer.html | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 UI/flask_ownstorj/ownstorj/templates/footer.html diff --git a/UI/flask_ownstorj/ownstorj/templates/footer.html b/UI/flask_ownstorj/ownstorj/templates/footer.html new file mode 100644 index 0000000..8dd4d49 --- /dev/null +++ b/UI/flask_ownstorj/ownstorj/templates/footer.html @@ -0,0 +1,9 @@ + From 8fd4a9de09cdcd510bab0debc9c6b3708e967953 Mon Sep 17 00:00:00 2001 From: Wiktor Jezioro Date: Thu, 27 Jul 2017 16:39:19 +0200 Subject: [PATCH 4/5] Create buckets_list_manager.html --- .../templates/buckets_list_manager.html | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 UI/flask_ownstorj/ownstorj/templates/buckets_list_manager.html diff --git a/UI/flask_ownstorj/ownstorj/templates/buckets_list_manager.html b/UI/flask_ownstorj/ownstorj/templates/buckets_list_manager.html new file mode 100644 index 0000000..ce108b6 --- /dev/null +++ b/UI/flask_ownstorj/ownstorj/templates/buckets_list_manager.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} +{% block title %}Buckets{% endblock %} +{% set active_page = "dashboard" %} + + +{% block content %} + + + +
+
+
+
+ +
+
+ + + +{% endblock %} From 1be35a4801e56a7c4ac33c5245f6750da99e180f Mon Sep 17 00:00:00 2001 From: Wiktor Jezioro Date: Thu, 27 Jul 2017 19:22:51 +0200 Subject: [PATCH 5/5] Add UPnP NAT port mapping function --- UI/utilities/tools.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/UI/utilities/tools.py b/UI/utilities/tools.py index 3bf9de7..241bd99 100644 --- a/UI/utilities/tools.py +++ b/UI/utilities/tools.py @@ -7,6 +7,7 @@ import errno import hashlib import requests +import miniupnpc SYNC_SERVER_URL = "http://localhost:8234" class Tools: @@ -148,3 +149,16 @@ def generate_max_shard_size(self, max_shard_size_input, shard_size_unit): return max_shard_size + # NETWORK + + def map_port_UPnP(self, port, description): + upnp = miniupnpc.UPnP() + + upnp.discoverdelay = 10 + upnp.discover() + + upnp.selectigd() + + upnp.addportmapping(port, 'TCP', upnp.lanaddr, port, description, '') + +