From 70e7ff291e56d996c57836e46511ddfe0c177c61 Mon Sep 17 00:00:00 2001 From: Etoh Date: Tue, 17 Oct 2017 00:24:48 +0100 Subject: [PATCH] Don't wipe password when joining public server (but only send passwords to private servers) --- syncplay/__init__.py | 2 +- syncplay/client.py | 17 ++++++++++++++++- syncplay/ui/ConfigurationGetter.py | 6 ++++-- syncplay/ui/GuiConfiguration.py | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/syncplay/__init__.py b/syncplay/__init__.py index d06a5e0..8ed6730 100644 --- a/syncplay/__init__.py +++ b/syncplay/__init__.py @@ -1,4 +1,4 @@ version = '1.5.0' milestone = 'Yoitsu' -release_number = '40' +release_number = '41' projectURL = 'http://syncplay.pl/' diff --git a/syncplay/client.py b/syncplay/client.py index 251c323..0cbbedf 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -92,6 +92,8 @@ class SyncplayClient(object): if config['password']: config['password'] = hashlib.md5(config['password']).hexdigest() self._serverPassword = config['password'] + self._host = u"{}:{}".format(config['host'],config['port']) + self._publicServers = config["publicServers"] if not config['file']: self.__getUserlistOnLogon = True else: @@ -634,7 +636,20 @@ class SyncplayClient(object): self.userlist.showUserList() def getPassword(self): - return self._serverPassword + if self.thisIsPublicServer(): + return "" + else: + return self._serverPassword + + def thisIsPublicServer(self): + self._publicServers = [] + if self._publicServers and self._host in self._publicServers: + return True + i = 0 + for server in constants.FALLBACK_PUBLIC_SYNCPLAY_SERVERS: + if server[1] == self._host: + return True + i += 1 def setPosition(self, position): if self._lastPlayerUpdate: diff --git a/syncplay/ui/ConfigurationGetter.py b/syncplay/ui/ConfigurationGetter.py index c45c6cc..ca8d7de 100755 --- a/syncplay/ui/ConfigurationGetter.py +++ b/syncplay/ui/ConfigurationGetter.py @@ -62,7 +62,8 @@ class ConfigurationGetter(object): "showSameRoomOSD" : True, "showNonControllerOSD" : False, "showContactInfo" : True, - "showDurationNotification" : True + "showDurationNotification" : True, + "publicServers" : [] } self._defaultConfig = self._config.copy() @@ -115,6 +116,7 @@ class ConfigurationGetter(object): "perPlayerArguments", "mediaSearchDirectories", "trustedDomains", + "publicServers", ] self._numeric = [ @@ -137,7 +139,7 @@ class ConfigurationGetter(object): "autoplayInitialState", "mediaSearchDirectories", "sharedPlaylistEnabled", "loopAtEndOfPlaylist", "loopSingleFiles", - "onlySwitchToTrustedDomains", "trustedDomains"], + "onlySwitchToTrustedDomains", "trustedDomains","publicServers"], "gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD", "showDifferentRoomOSD", "showSameRoomOSD", "showNonControllerOSD", "showDurationNotification"], diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index 5c92d78..3cd2e33 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -396,6 +396,7 @@ class ConfigDialog(QtGui.QDialog): self.config['file'] = os.path.abspath(self.mediapathTextbox.text()) else: self.config['file'] = unicode(self.mediapathTextbox.text()) + self.config['publicServers'] = self.publicServerAddresses self.pressedclosebutton = False self.close() @@ -1053,7 +1054,6 @@ class ConfigDialog(QtGui.QDialog): if (self.hostCombobox.currentText() == "" and self.serverpassTextbox.text() == "") or unicode(self.hostCombobox.currentText()) in self.publicServerAddresses: self.serverpassLabel.hide() self.serverpassTextbox.hide() - self.serverpassTextbox.setText("") else: self.serverpassLabel.show() self.serverpassTextbox.show()