mirror of
https://github.com/Syncplay/syncplay
synced 2025-02-18 20:16:50 +00:00
Only auto-switch to trusted domains by default
This commit is contained in:
parent
176b2f65dc
commit
1de40303bd
@ -453,14 +453,18 @@ class SyncplayClient(object):
|
||||
self.playlist.changeToPlaylistIndexFromFilename(filename)
|
||||
|
||||
def isURITrusted(self, URIToTest):
|
||||
if self._config['onlySwitchToTrustedURIs']:
|
||||
if self._config['trustedURIs']:
|
||||
for URI in self._config['trustedURIs']:
|
||||
if URIToTest.startswith(URI):
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
for trustedProtocol in constants.TRUSTABLE_WEB_PROTOCOLS:
|
||||
if URIToTest.startswith(trustedProtocol):
|
||||
if self._config['onlySwitchToTrustedDomains']:
|
||||
if self._config['trustedDomains']:
|
||||
for trustedDomain in self._config['trustedDomains']:
|
||||
trustableURI = ''.join([trustedProtocol,trustedDomain,u"/"])
|
||||
if URIToTest.startswith(trustableURI):
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
return False
|
||||
|
||||
def openFile(self, filePath, resetPosition=False):
|
||||
self._player.openFile(filePath, resetPosition)
|
||||
|
@ -187,4 +187,7 @@ SYNCPLAY_UPDATE_URL = u"http://syncplay.pl/checkforupdate?{}" # Params
|
||||
SYNCPLAY_DOWNLOAD_URL = "http://syncplay.pl/download/"
|
||||
SYNCPLAY_PUBLIC_SERVER_LIST_URL = u"http://syncplay.pl/listpublicservers?{}" # Params
|
||||
|
||||
DEFAULT_TRUSTED_DOMAINS = [u"youtube.com",u"youtu.be",u"vimeo.com"]
|
||||
TRUSTABLE_WEB_PROTOCOLS = [u"http://www.",u"https://www.",u"http://",u"https://"]
|
||||
|
||||
PRIVATE_FILE_FIELDS = ["path"]
|
@ -220,6 +220,7 @@ de = {
|
||||
"unpause-ifothersready-option" : u"Wiedergeben wenn bereits als Bereit gesetzt oder alle anderen bereit sind (Standard)",
|
||||
"unpause-ifminusersready-option" : u"Wiedergeben wenn bereits als Bereit gesetzt oder die minimale Anzahl anderer Nutzer bereit ist",
|
||||
"unpause-always" : u"Immer wiedergeben",
|
||||
"syncplay-trusteddomains-title": u"Trusted domains (for streaming services and hosted content)", # TODO: Translate into German
|
||||
|
||||
"help-label" : u"Hilfe",
|
||||
"reset-label" : u"Standardwerte zurücksetzen",
|
||||
@ -323,6 +324,7 @@ de = {
|
||||
"unpause-ifalreadyready-tooltip" : u"Wenn du nicht bereit bist und Play drückst wirst du als bereit gesetzt - zum Starten der Wiedergabe nochmal drücken.",
|
||||
"unpause-ifothersready-tooltip" : u"Wenn du Play drückst und nicht bereit bist, wird nur gestartet, wenn alle anderen bereit sind.",
|
||||
"unpause-ifminusersready-tooltip" : u"Wenn du Play drückst und nicht bereit bist, wird nur gestartet, wenn die minimale Anzahl anderer Benutzer bereit ist.",
|
||||
"trusteddomains-arguments-tooltip" : u"Domains that it is okay for Syncplay to automatically switch to when shared playlists is enabled.", # TODO: Translate into German
|
||||
|
||||
"help-tooltip" : u"Öffnet Hilfe auf syncplay.pl [Englisch]",
|
||||
"reset-tooltip" : u"Alle Einstellungen auf Standardwerte zurücksetzen.",
|
||||
|
@ -222,6 +222,7 @@ en = {
|
||||
"unpause-ifothersready-option" : u"Unpause if already ready or others in room are ready (default)",
|
||||
"unpause-ifminusersready-option" : u"Unpause if already ready or if all others ready and min users ready",
|
||||
"unpause-always" : u"Always unpause",
|
||||
"syncplay-trusteddomains-title": u"Trusted domains (for streaming services and hosted content)",
|
||||
|
||||
"help-label" : "Help",
|
||||
"reset-label" : "Restore defaults",
|
||||
@ -323,6 +324,7 @@ en = {
|
||||
"unpause-ifalreadyready-tooltip" : u"If you press unpause when not ready it will set you as ready - press unpause again to unpause.",
|
||||
"unpause-ifothersready-tooltip" : u"If you press unpause when not ready, it will only upause if others are ready.",
|
||||
"unpause-ifminusersready-tooltip" : u"If you press unpause when not ready, it will only upause if others are ready and minimum users threshold is met.",
|
||||
"trusteddomains-arguments-tooltip" : u"Domains that it is okay for Syncplay to automatically switch to when shared playlists is enabled.",
|
||||
|
||||
"help-tooltip" : "Opens the Syncplay.pl user guide.",
|
||||
"reset-tooltip" : "Reset all settings to the default configuration.",
|
||||
|
@ -222,6 +222,7 @@ ru = {
|
||||
"unpause-ifothersready-option" : u"Unpause if already ready or others in room are ready (default)", # TODO: Translate into Russian
|
||||
"unpause-ifminusersready-option" : u"Unpause if already ready or if all others ready and min users ready", # TODO: Translate into Russian
|
||||
"unpause-always" : u"Always unpause", # TODO: Translate into Russian
|
||||
"syncplay-trusteddomains-title": u"Trusted domains (for streaming services and hosted content)", # TODO: Translate into Russian
|
||||
|
||||
"help-label" : u"Помощь",
|
||||
"reset-label" : u"Сброс настроек",
|
||||
@ -323,6 +324,7 @@ ru = {
|
||||
"unpause-ifalreadyready-tooltip" : u"If you press unpause when not ready it will set you as ready - press unpause again to unpause.", # TODO: Translate into Russian
|
||||
"unpause-ifothersready-tooltip" : u"If you press unpause when not ready, it will only upause if others are ready.", # TODO: Translate into Russian
|
||||
"unpause-ifminusersready-tooltip" : u"If you press unpause when not ready, it will only upause if others are ready and minimum users threshold is met.", # TODO: Translate into Russian
|
||||
"trusteddomains-arguments-tooltip" : u"Domains that it is okay for Syncplay to automatically switch to when shared playlists is enabled.", # TODO: Translate into Russian
|
||||
|
||||
"help-tooltip" : u"Открыть Руководство Пользователя на Syncplay.pl.",
|
||||
"reset-tooltip" : u"Сбрасывает все настройки Syncplay в начальное состояние.",
|
||||
|
@ -37,8 +37,8 @@ class ConfigurationGetter(object):
|
||||
"sharedPlaylistEnabled": True,
|
||||
"loopAtEndOfPlaylist": False,
|
||||
"loopSingleFiles" : False,
|
||||
"onlySwitchToTrustedURIs": False,
|
||||
"trustedURIs": None,
|
||||
"onlySwitchToTrustedDomains": True,
|
||||
"trustedDomains": constants.DEFAULT_TRUSTED_DOMAINS,
|
||||
"file": None,
|
||||
"playerArgs": [],
|
||||
"playerClass": None,
|
||||
@ -111,7 +111,7 @@ class ConfigurationGetter(object):
|
||||
"sharedPlaylistEnabled",
|
||||
"loopAtEndOfPlaylist",
|
||||
"loopSingleFiles",
|
||||
"onlySwitchToTrustedURIs"
|
||||
"onlySwitchToTrustedDomains"
|
||||
]
|
||||
self._tristate = [
|
||||
"checkForUpdatesAutomatically",
|
||||
@ -121,7 +121,7 @@ class ConfigurationGetter(object):
|
||||
self._serialised = [
|
||||
"perPlayerArguments",
|
||||
"mediaSearchDirectories",
|
||||
"trustedURIs",
|
||||
"trustedDomains",
|
||||
]
|
||||
|
||||
self._numeric = [
|
||||
@ -144,7 +144,7 @@ class ConfigurationGetter(object):
|
||||
"autoplayInitialState", "mediaSearchDirectories",
|
||||
"sharedPlaylistEnabled", "loopAtEndOfPlaylist",
|
||||
"loopSingleFiles",
|
||||
"onlySwitchToTrustedURIs", "trustedURIs"],
|
||||
"onlySwitchToTrustedDomains", "trustedDomains"],
|
||||
"gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD",
|
||||
"showDifferentRoomOSD", "showSameRoomOSD",
|
||||
"showNonControllerOSD", "showDurationNotification"],
|
||||
|
@ -370,6 +370,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
|
||||
self.config["perPlayerArguments"] = self.perPlayerArgs
|
||||
self.config["mediaSearchDirectories"] = utils.convertMultilineStringToList(self.mediasearchTextEdit.toPlainText())
|
||||
self.config["trustedDomains"] = utils.convertMultilineStringToList(self.trusteddomainsTextEdit.toPlainText())
|
||||
|
||||
self.processWidget(self, lambda w: self.saveValues(w))
|
||||
if self.hostCombobox.currentText():
|
||||
@ -504,6 +505,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
|
||||
self.perPlayerArgs = self.config["perPlayerArguments"]
|
||||
self.mediaSearchDirectories = self.config["mediaSearchDirectories"]
|
||||
self.trustedDomains = self.config["trustedDomains"]
|
||||
|
||||
self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("connection-group-title"))
|
||||
self.loadSavedPublicServerList()
|
||||
@ -794,10 +796,24 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.othersyncSettingsLayout.setAlignment(Qt.AlignLeft)
|
||||
self.othersyncSettingsLayout.addWidget(self.fastforwardCheckbox, 3, 0,1,2, Qt.AlignLeft)
|
||||
|
||||
|
||||
## Trusted domains
|
||||
|
||||
self.trusteddomainsSettingsGroup = QtGui.QGroupBox(getMessage("syncplay-trusteddomains-title"))
|
||||
self.trusteddomainsSettingsLayout = QtGui.QVBoxLayout()
|
||||
self.trusteddomainsSettingsGroup.setLayout(self.trusteddomainsSettingsLayout)
|
||||
|
||||
self.trusteddomainsTextEdit = QPlainTextEdit(utils.getListAsMultilineString(self.trustedDomains))
|
||||
self.trusteddomainsTextEdit.setObjectName(constants.LOAD_SAVE_MANUALLY_MARKER + "trusteddomains-arguments")
|
||||
self.trusteddomainsTextEdit.setLineWrapMode(QtGui.QPlainTextEdit.NoWrap)
|
||||
self.trusteddomainsSettingsLayout.addWidget(self.trusteddomainsTextEdit)
|
||||
self.trusteddomainsSettingsGroup.setMaximumHeight(self.trusteddomainsSettingsGroup.minimumSizeHint().height())
|
||||
|
||||
self.othersyncSettingsGroup.setLayout(self.othersyncSettingsLayout)
|
||||
self.othersyncSettingsGroup.setMaximumHeight(self.othersyncSettingsGroup.minimumSizeHint().height())
|
||||
self.syncSettingsLayout.addWidget(self.othersyncSettingsGroup)
|
||||
self.syncSettingsLayout.addWidget(self.desyncSettingsGroup)
|
||||
self.syncSettingsLayout.addWidget(self.trusteddomainsSettingsGroup)
|
||||
self.syncSettingsFrame.setLayout(self.syncSettingsLayout)
|
||||
self.desyncSettingsGroup.setMaximumHeight(self.desyncSettingsGroup.minimumSizeHint().height())
|
||||
self.syncSettingsLayout.setAlignment(Qt.AlignTop)
|
||||
|
Loading…
Reference in New Issue
Block a user