Add secure connection icon to press for cert details

This commit is contained in:
Etoh 2019-02-14 23:03:53 +00:00 committed by Alberto Sottile
parent 8d52acbd88
commit 466e8533d6
11 changed files with 71 additions and 8 deletions

View File

@ -658,6 +658,7 @@ guiIcons = [
'resources/mpv.png', 'resources/vlc.png', 'resources/house.png', 'resources/film_link.png',
'resources/eye.png', 'resources/comments.png', 'resources/cog_delete.png', 'resources/chevrons_right.png',
'resources/user_key.png', 'resources/lock.png', 'resources/key_go.png', 'resources/page_white_key.png',
'resources/green_lock.png',
'resources/tick.png', 'resources/lock_open.png', 'resources/empty_checkbox.png', 'resources/tick_checkbox.png',
'resources/world_explore.png', 'resources/application_get.png', 'resources/cog.png', 'resources/arrow_switch.png',
'resources/film_go.png', 'resources/world_go.png', 'resources/arrow_refresh.png', 'resources/bullet_right_grey.png',

BIN
resources/green_lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

View File

@ -1,5 +1,5 @@
version = '1.6.3'
revision = ' beta'
milestone = 'Yoitsu'
release_number = '72'
release_number = '73'
projectURL = 'https://syncplay.pl/'

View File

@ -398,6 +398,7 @@ class SyncplayClient(object):
self.ui.showMessage(getMessage("current-offset-notification").format(self._userOffset))
def onDisconnect(self):
self.ui.setSSLMode(False)
if self._config['pauseOnLeave']:
self.setPaused(True)
self.lastPausedOnLeaveTime = time.time()
@ -727,6 +728,7 @@ class SyncplayClient(object):
def retry(retries):
self._lastGlobalUpdate = None
self.ui.setSSLMode(False)
if retries == 0:
self.onDisconnect()
if retries > constants.RECONNECT_RETRIES:
@ -1476,6 +1478,9 @@ class UiManager(object):
self.showOSDMessage(messageString, duration=constants.OSD_DURATION)
self.__ui.showMessage(messageString)
def setSSLMode(self, sslMode, sslInformation=""):
self.__ui.setSSLMode(sslMode, sslInformation)
def showMessage(self, message, noPlayer=False, noTimestamp=False, OSDType=constants.OSD_NOTIFICATION, mood=constants.MESSAGE_NEUTRAL):
if not noPlayer:
self.showOSDMessage(message, duration=constants.OSD_DURATION, OSDType=OSDType, mood=mood)

View File

@ -71,6 +71,9 @@ de = {
"syncplay-uptodate-notification": "Syncplay ist aktuell",
"syncplay-updateavailable-notification": "Eine neuere Version von Syncplay ist verfügbar. Soll die Download-Seite geöffnet werden?",
"ssl-information-title": "SSL Certificate Details", # TODO: Translate
"ssl-information-message": "Subject: {}\nIssuer: {}\nExpiration Date: {}\nConnection Version: {}\nCipher: {}", # TODO: Translate
"mplayer-file-required-notification": "Syncplay für mplayer benötigt eine Dateiangabe beim Start",
"mplayer-file-required-notification/example": "Anwendungsbeispiel: syncplay [optionen] [url|pfad/]Dateiname",
"mplayer2-required": "Syncplay ist inkompatibel zu MPlayer 1.x, bitte nutze MPlayer2 oder mpv",
@ -410,6 +413,8 @@ de = {
"reset-tooltip": "Alle Einstellungen auf Standardwerte zurücksetzen.",
"update-server-list-tooltip": "Mit syncplay.pl verbinden um die Liste öffentlicher Server zu aktualisieren.",
"sslconnection-tooltip": "Securely connected to server. Press button for certificate details", # TODO: Translate
"joinroom-tooltip": "Den aktuellen Raum verlassen und stattdessen den angegebenen betreten.",
"seektime-msgbox-label": "Springe zur angegebenen Zeit (in Sekunden oder min:sek). Verwende +/- zum relativen Springen.",
"ready-tooltip": "Zeigt an, ob du bereit zum anschauen bist",

View File

@ -71,6 +71,9 @@ en = {
"syncplay-uptodate-notification": "Syncplay is up to date",
"syncplay-updateavailable-notification": "A new version of Syncplay is available. Do you want to visit the release page?",
"ssl-information-title": "SSL Certificate Details",
"ssl-information-message": "Subject: {}\nIssuer: {}\nExpiration Date: {}\nConnection Version: {}\nCipher: {}",
"mplayer-file-required-notification": "Syncplay using mplayer requires you to provide file when starting",
"mplayer-file-required-notification/example": "Usage example: syncplay [options] [url|path/]filename",
"mplayer2-required": "Syncplay is incompatible with MPlayer 1.x, please use mplayer2 or mpv",
@ -267,7 +270,7 @@ en = {
"run-label": "Run Syncplay",
"storeandrun-label": "Store configuration and run Syncplay",
"contact-label": "Feel free to e-mail <a href=\"mailto:dev@syncplay.pl\"><nobr>dev@syncplay.pl</nobr></a>, chat via the <a href=\"https://webchat.freenode.net/?channels=#syncplay\"><nobr>#Syncplay IRC channel</nobr></a> on irc.freenode.net, <a href=\"https://github.com/Uriziel/syncplay/issues\"><nobr>raise an issue</nobr></a> via GitHub, <a href=\"https://www.facebook.com/SyncplaySoftware\"><nobr>like us on Facebook</nobr></a>, <a href=\"https://twitter.com/Syncplay/\"><nobr>follow us on Twitter</nobr></a>, or visit <a href=\"https://syncplay.pl/\"><nobr>https://syncplay.pl/</nobr></a>. NOTE: Chat messages are not encrypted so do not use Syncplay to send sensitive information.",
"contact-label": "Feel free to e-mail <a href=\"mailto:dev@syncplay.pl\"><nobr>dev@syncplay.pl</nobr></a>, chat via the <a href=\"https://webchat.freenode.net/?channels=#syncplay\"><nobr>#Syncplay IRC channel</nobr></a> on irc.freenode.net, <a href=\"https://github.com/Uriziel/syncplay/issues\"><nobr>raise an issue</nobr></a> via GitHub, <a href=\"https://www.facebook.com/SyncplaySoftware\"><nobr>like us on Facebook</nobr></a>, <a href=\"https://twitter.com/Syncplay/\"><nobr>follow us on Twitter</nobr></a>, or visit <a href=\"https://syncplay.pl/\"><nobr>https://syncplay.pl/</nobr></a>. Do not use Syncplay to send sensitive information.",
"joinroom-label": "Join room",
"joinroom-menu-label": "Join room {}",
@ -409,6 +412,8 @@ en = {
"reset-tooltip": "Reset all settings to the default configuration.",
"update-server-list-tooltip": "Connect to syncplay.pl to update list of public servers.",
"sslconnection-tooltip": "Securely connected to server. Press button for certificate details",
"joinroom-tooltip": "Leave current room and joins specified room.",
"seektime-msgbox-label": "Jump to specified time (in seconds / min:sec). Use +/- for relative seek.",
"ready-tooltip": "Indicates whether you are ready to watch.",

View File

@ -71,6 +71,9 @@ it = {
"syncplay-uptodate-notification": "Syncplay è aggiornato",
"syncplay-updateavailable-notification": "Una nuova versione di Syncplay è disponibile. Vuoi visitare la pagina delle release?",
"ssl-information-title": "SSL Certificate Details", # TODO: Translate
"ssl-information-message": "Subject: {}\nIssuer: {}\nExpiration Date: {}\nConnection Version: {}\nCipher: {}", # TODO: Translate
"mplayer-file-required-notification": "Utilizzare Syncplay con mplayer di selezionare il file all'avvio",
"mplayer-file-required-notification/example": "Esempio di utilizzo: syncplay [opzioni] [url|percorso/]nomefile",
"mplayer2-required": "Syncplay non è compatibile con MPlayer 1.x, per favore utilizza mplayer2 or mpv",
@ -267,7 +270,7 @@ it = {
"run-label": "Avvia Syncplay",
"storeandrun-label": "Salva la configurazione e avvia Syncplay",
"contact-label": "Sentiti libero di inviare un'e-mail a <a href=\"mailto:dev@syncplay.pl\"><nobr>dev@syncplay.pl</nobr></a>, chattare tramite il <a href=\"https://webchat.freenode.net/?channels=#syncplay\"><nobr>canale IRC #Syncplay</nobr></a> su irc.freenode.net, <a href=\"https://github.com/Uriziel/syncplay/issues\"><nobr>segnalare un problema</nobr></a> su GitHub, <a href=\"https://www.facebook.com/SyncplaySoftware\"><nobr>lasciare un like sulla nostra pagina Facebook</nobr></a>, <a href=\"https://twitter.com/Syncplay/\"><nobr>seguirci su Twitter</nobr></a>, o visitare <a href=\"https://syncplay.pl/\"><nobr>https://syncplay.pl/</nobr></a>. NOTA: i messaggi di chat non sono cifrati, quindi non usare Syncplay per inviare dati sensibili.",
"contact-label": "Sentiti libero di inviare un'e-mail a <a href=\"mailto:dev@syncplay.pl\"><nobr>dev@syncplay.pl</nobr></a>, chattare tramite il <a href=\"https://webchat.freenode.net/?channels=#syncplay\"><nobr>canale IRC #Syncplay</nobr></a> su irc.freenode.net, <a href=\"https://github.com/Uriziel/syncplay/issues\"><nobr>segnalare un problema</nobr></a> su GitHub, <a href=\"https://www.facebook.com/SyncplaySoftware\"><nobr>lasciare un like sulla nostra pagina Facebook</nobr></a>, <a href=\"https://twitter.com/Syncplay/\"><nobr>seguirci su Twitter</nobr></a>, o visitare <a href=\"https://syncplay.pl/\"><nobr>https://syncplay.pl/</nobr></a>. Non usare Syncplay per inviare dati sensibili.", # TODO: Check translation
"joinroom-label": "Entra nella stanza",
"joinroom-menu-label": "Entra nella stanza {}",
@ -409,6 +412,8 @@ it = {
"reset-tooltip": "Ripristina le impostazioni iniziali di Syncplay.",
"update-server-list-tooltip": "Scarica la lista dei server pubblici da syncplay.pl.",
"sslconnection-tooltip": "Securely connected to server. Press button for certificate details", # TODO: Translate
"joinroom-tooltip": "Lascia la stanza attuale e entra in quella specificata.",
"seektime-msgbox-label": "Salta all'istante di tempo specificato (in secondi / min:sec). Usa +/- per una ricerca relativa.",
"ready-tooltip": "Indica quando sei pronto a guardare.",

View File

@ -71,6 +71,9 @@ ru = {
"syncplay-uptodate-notification": "У вас последняя версия Syncplay",
"syncplay-updateavailable-notification": "Доступна новая версия Syncplay. Хотите открыть страницу релиза?",
"ssl-information-title": "SSL Certificate Details", # TODO: Translate
"ssl-information-message": "Subject: {}\nIssuer: {}\nExpiration Date: {}\nConnection Version: {}\nCipher: {}", # TODO: Translate
"mplayer-file-required-notification": "Для использования Syncplay с mplayer необходимо передать файл в качестве параметра",
"mplayer-file-required-notification/example": "Пример использования: syncplay [options] [url|path/]filename",
"mplayer2-required": "Syncplay не совместим с MPlayer 1.x, пожалуйста, используйте mplayer2 или mpv",
@ -269,7 +272,7 @@ ru = {
"run-label": "Запустить",
"storeandrun-label": "Сохранить и запустить",
"contact-label": "Есть идея, нашли ошибку или хотите оставить отзыв? Пишите на <a href=\"mailto:dev@syncplay.pl\">dev@syncplay.pl</a>, в <a href=\"https://webchat.freenode.net/?channels=#syncplay\">IRC канал #Syncplay</a> на irc.freenode.net или <a href=\"https://github.com/Uriziel/syncplay/issues\">задавайте вопросы через GitHub</a>. Кроме того, заходите на <a href=\"https://syncplay.pl/\">www.syncplay.pl</a> за инорфмацией, помощью и обновлениями! NOTE: Chat messages are not encrypted so do not use Syncplay to send sensitive information.", # TODO: Translate last sentence
"contact-label": "Есть идея, нашли ошибку или хотите оставить отзыв? Пишите на <a href=\"mailto:dev@syncplay.pl\">dev@syncplay.pl</a>, в <a href=\"https://webchat.freenode.net/?channels=#syncplay\">IRC канал #Syncplay</a> на irc.freenode.net или <a href=\"https://github.com/Uriziel/syncplay/issues\">задавайте вопросы через GitHub</a>. Кроме того, заходите на <a href=\"https://syncplay.pl/\">www.syncplay.pl</a> за инорфмацией, помощью и обновлениями! Do not use Syncplay to send sensitive information.", # TODO: Translate last sentence
"joinroom-label": "Зайти в комнату",
"joinroom-menu-label": "Зайти в комнату {}",
@ -411,6 +414,8 @@ ru = {
"reset-tooltip": "Сбрасывает все настройки Syncplay в начальное состояние.",
"update-server-list-tooltip": "Обновить список публичных серверов от syncplay.pl.",
"sslconnection-tooltip": "Securely connected to server. Press button for certificate details", # TODO: Translate
"joinroom-tooltip": "Покинуть комнату и зайти в другую, указанную комнату.",
"seektime-msgbox-label": "Перемотать к определенному моменту времени (указывать в секундах или мин:сек). Используйте +/-, чтобы перемотать вперед/назад относительно настоящего момента.",
"ready-tooltip": "Показывает, готовы ли Вы к просмотру или нет.",

View File

@ -339,17 +339,22 @@ class SyncClientProtocol(JSONCommandProtocol):
self.sendHello()
def handshakeCompleted(self):
from datetime import datetime
self._serverCertificateTLS = self.transport.getPeerCertificate()
self._subjectTLS = self._serverCertificateTLS.get_subject().CN
self._issuerTLS = self._serverCertificateTLS.get_issuer().CN
self._expiredTLS =self._serverCertificateTLS.has_expired()
self._expireDateTLS = self._serverCertificateTLS.get_notAfter()
self._expireDateTLS = datetime.strptime(self._serverCertificateTLS.get_notAfter().decode('ascii'), '%Y%m%d%H%M%SZ')
self._encryptedConnectionTLS = self.transport.protocol._tlsConnection
self._connVersionTLS = self._encryptedConnectionTLS.get_protocol_version_name()
self._cipherNameTLS = self._encryptedConnectionTLS.get_cipher_name()
self._client.ui.showMessage(getMessage("startTLS-secure-connection-ok").format(self._connVersionTLS))
self._client.ui.setSSLMode(
True,
getMessage("ssl-information-message")
.format(self._subjectTLS,self._issuerTLS, self._expireDateTLS, self._connVersionTLS, self._cipherNameTLS))
class SyncServerProtocol(JSONCommandProtocol):

View File

@ -108,6 +108,9 @@ class ConsoleUI(threading.Thread):
def showErrorMessage(self, message, criticalerror=False):
print("ERROR:\t" + message)
def setSSLMode(self, sslMode, sslInformation):
pass
def _extractSign(self, m):
if m:
if m == "-":

View File

@ -120,6 +120,7 @@ class AboutDialog(QtWidgets.QDialog):
self.setWindowTitle(getMessage("about-dialog-title"))
if isWindows():
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
self.setWindowIcon(QtGui.QPixmap(resourcespath + 'syncplay.png'))
nameLabel = QtWidgets.QLabel("<center><strong>Syncplay</strong></center>")
nameLabel.setFont(QtGui.QFont("Helvetica", 18))
linkLabel = QtWidgets.QLabel("<center><a href=\"https://syncplay.pl\">syncplay.pl</a></center>")
@ -172,6 +173,8 @@ class MainWindow(QtWidgets.QMainWindow):
playlistState = []
updatingPlaylist = False
playlistIndex = None
sslInformation = "N/A"
sslMode = False
def setPlaylistInsertPosition(self, newPosition):
if not self.playlist.isEnabled():
@ -427,6 +430,14 @@ class MainWindow(QtWidgets.QMainWindow):
self.chatInput.setMaxLength(constants.MAX_CHAT_MESSAGE_LENGTH)
self.roomInput.setMaxLength(constants.MAX_ROOM_NAME_LENGTH)
def setSSLMode(self, sslMode, sslInformation):
self.sslMode = sslMode
self.sslInformation = sslInformation
self.sslButton.setVisible(sslMode)
def getSSLInformation(self):
return self.sslInformation
def showMessage(self, message, noTimestamp=False):
message = str(message)
username = None
@ -1201,6 +1212,7 @@ class MainWindow(QtWidgets.QMainWindow):
window.outputbox.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
window.outputlabel = QtWidgets.QLabel(getMessage("notifications-heading-label"))
window.outputlabel.setMinimumHeight(27)
window.chatInput = QtWidgets.QLineEdit()
window.chatInput.setMaxLength(constants.MAX_CHAT_MESSAGE_LENGTH)
window.chatInput.returnPressed.connect(self.sendChatMessage)
@ -1237,21 +1249,29 @@ class MainWindow(QtWidgets.QMainWindow):
self.listTreeView.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.listTreeView.customContextMenuRequested.connect(self.openRoomMenu)
window.listlabel = QtWidgets.QLabel(getMessage("userlist-heading-label"))
window.listlabel.setMinimumHeight(27)
window.sslButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'green_lock.png'),"")
window.sslButton.setVisible(False)
window.sslButton.setFixedHeight(27)
window.sslButton.setFixedWidth(27)
window.sslButton.pressed.connect(self.openSSLDetails)
window.sslButton.setToolTip(getMessage("sslconnection-tooltip"))
window.listFrame = QtWidgets.QFrame()
window.listFrame.setLineWidth(0)
window.listFrame.setMidLineWidth(0)
window.listFrame.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
window.listLayout.setContentsMargins(0, 0, 0, 0)
window.userlistLayout = QtWidgets.QVBoxLayout()
window.userlistLayout = QtWidgets.QGridLayout()
window.userlistFrame = QtWidgets.QFrame()
window.userlistFrame.setLineWidth(0)
window.userlistFrame.setMidLineWidth(0)
window.userlistFrame.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
window.userlistLayout.setContentsMargins(0, 0, 0, 0)
window.userlistFrame.setLayout(window.userlistLayout)
window.userlistLayout.addWidget(window.listlabel)
window.userlistLayout.addWidget(window.listTreeView)
window.userlistLayout.addWidget(window.listlabel, 0, 0, Qt.AlignLeft)
window.userlistLayout.addWidget(window.sslButton, 0, 2, Qt.AlignRight)
window.userlistLayout.addWidget(window.listTreeView, 1, 0, 1, 3)
window.listSplit = QtWidgets.QSplitter(Qt.Vertical, self)
window.listSplit.addWidget(window.userlistFrame)
@ -1510,6 +1530,15 @@ class MainWindow(QtWidgets.QMainWindow):
if not isMacOS():
window.mainLayout.setMenuBar(window.menuBar)
@needsClient
def openSSLDetails(self):
QtWidgets.QMessageBox.information(
self,
getMessage("ssl-information-title"),
"[{}]\n{}".format(getMessage("ssl-information-title"),self.getSSLInformation())
)
def openAbout(self):
aboutMsgBox = AboutDialog()
aboutMsgBox.exec_()