Add "add X as trusted domain" playlist menu option
This commit is contained in:
parent
65f6f4b4b9
commit
7465c85d8e
@ -658,6 +658,7 @@ guiIcons = ['resources/accept.png', 'resources/arrow_undo.png', 'resources/clock
|
|||||||
'resources/film_folder_edit.png',
|
'resources/film_folder_edit.png',
|
||||||
'resources/film_edit.png',
|
'resources/film_edit.png',
|
||||||
'resources/shield_edit.png',
|
'resources/shield_edit.png',
|
||||||
|
'resources/shield_add.png',
|
||||||
'resources/world_add.png', 'resources/film_add.png', 'resources/delete.png', 'resources/spinner.mng'
|
'resources/world_add.png', 'resources/film_add.png', 'resources/delete.png', 'resources/spinner.mng'
|
||||||
]
|
]
|
||||||
resources = ["resources/icon.ico", "resources/syncplay.png"]
|
resources = ["resources/icon.ico", "resources/syncplay.png"]
|
||||||
|
|||||||
BIN
resources/shield_add.png
Normal file
BIN
resources/shield_add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 758 B |
@ -462,10 +462,22 @@ class SyncplayClient(object):
|
|||||||
def setTrustedDomains(self, newTrustedDomains):
|
def setTrustedDomains(self, newTrustedDomains):
|
||||||
from syncplay.ui.ConfigurationGetter import ConfigurationGetter
|
from syncplay.ui.ConfigurationGetter import ConfigurationGetter
|
||||||
ConfigurationGetter().setConfigOption("trustedDomains", newTrustedDomains)
|
ConfigurationGetter().setConfigOption("trustedDomains", newTrustedDomains)
|
||||||
self._config['trustedDomains'] = newTrustedDomains
|
oldTrustedDomains = self._config['trustedDomains']
|
||||||
self.fileSwitchFoundFiles()
|
if oldTrustedDomains <> newTrustedDomains:
|
||||||
|
self._config['trustedDomains'] = newTrustedDomains
|
||||||
|
self.fileSwitchFoundFiles()
|
||||||
|
self.ui.showMessage("Trusted domains updated")
|
||||||
|
# TODO: Properly add message for setting trusted domains!
|
||||||
|
|
||||||
|
def isUntrustedTrustableURI(self, URIToTest):
|
||||||
|
if utils.isURL(URIToTest):
|
||||||
|
for trustedProtocol in constants.TRUSTABLE_WEB_PROTOCOLS:
|
||||||
|
if URIToTest.startswith(trustedProtocol) and not self.isURITrusted(URIToTest):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def isURITrusted(self, URIToTest):
|
def isURITrusted(self, URIToTest):
|
||||||
|
URIToTest = URIToTest+u"/"
|
||||||
for trustedProtocol in constants.TRUSTABLE_WEB_PROTOCOLS:
|
for trustedProtocol in constants.TRUSTABLE_WEB_PROTOCOLS:
|
||||||
if URIToTest.startswith(trustedProtocol):
|
if URIToTest.startswith(trustedProtocol):
|
||||||
if self._config['onlySwitchToTrustedDomains']:
|
if self._config['onlySwitchToTrustedDomains']:
|
||||||
|
|||||||
@ -269,6 +269,7 @@ de = {
|
|||||||
"createcontrolledroom-menu-label" : u"&Zentral gesteuerten Raum erstellen",
|
"createcontrolledroom-menu-label" : u"&Zentral gesteuerten Raum erstellen",
|
||||||
"identifyascontroller-menu-label" : u"Als Raumleiter &identifizieren",
|
"identifyascontroller-menu-label" : u"Als Raumleiter &identifizieren",
|
||||||
"settrusteddomains-menu-label" : u"Set &trusted domains", # TODO: Translate
|
"settrusteddomains-menu-label" : u"Set &trusted domains", # TODO: Translate
|
||||||
|
"addtrusteddomain-menu-label" : u"Add {} as trusted domain", # Domain # TODO: Translate
|
||||||
|
|
||||||
"playback-menu-label" : u"&Wiedergabe",
|
"playback-menu-label" : u"&Wiedergabe",
|
||||||
|
|
||||||
|
|||||||
@ -271,6 +271,7 @@ en = {
|
|||||||
"createcontrolledroom-menu-label" : "&Create managed room",
|
"createcontrolledroom-menu-label" : "&Create managed room",
|
||||||
"identifyascontroller-menu-label" : "&Identify as room operator",
|
"identifyascontroller-menu-label" : "&Identify as room operator",
|
||||||
"settrusteddomains-menu-label" : u"Set &trusted domains",
|
"settrusteddomains-menu-label" : u"Set &trusted domains",
|
||||||
|
"addtrusteddomain-menu-label" : u"Add {} as trusted domain", # Domain
|
||||||
|
|
||||||
"playback-menu-label" : u"&Playback",
|
"playback-menu-label" : u"&Playback",
|
||||||
|
|
||||||
|
|||||||
@ -230,6 +230,7 @@ ru = {
|
|||||||
"unpause-ifminusersready-option" : u"Unpause if already ready or if all others ready and min users ready", # 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
|
"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
|
"syncplay-trusteddomains-title": u"Trusted domains (for streaming services and hosted content)", # TODO: Translate into Russian
|
||||||
|
"addtrusteddomain-menu-label" : u"Add {} as trusted domain", # Domain # TODO: Translate
|
||||||
|
|
||||||
"help-label" : u"Помощь",
|
"help-label" : u"Помощь",
|
||||||
"reset-label" : u"Сброс настроек",
|
"reset-label" : u"Сброс настроек",
|
||||||
|
|||||||
@ -498,6 +498,9 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
pathFound = self._syncplayClient.fileSwitch.findFilepath(firstFile)
|
pathFound = self._syncplayClient.fileSwitch.findFilepath(firstFile)
|
||||||
if pathFound:
|
if pathFound:
|
||||||
menu.addAction(QtGui.QPixmap(resourcespath + u"film_go.png"), getMessage("openmedia-menu-label"), lambda: self.openFile(pathFound))
|
menu.addAction(QtGui.QPixmap(resourcespath + u"film_go.png"), getMessage("openmedia-menu-label"), lambda: self.openFile(pathFound))
|
||||||
|
if self._syncplayClient.isUntrustedTrustableURI(firstFile):
|
||||||
|
domain = utils.getDomainFromURL(firstFile)
|
||||||
|
menu.addAction(QtGui.QPixmap(resourcespath + u"shield_add.png"),getMessage("addtrusteddomain-menu-label").format(domain), lambda: self.addTrustedDomain(domain))
|
||||||
menu.addAction(QtGui.QPixmap(resourcespath + u"delete.png"), getMessage("removefromplaylist-menu-label"), lambda: self.deleteSelectedPlaylistItems())
|
menu.addAction(QtGui.QPixmap(resourcespath + u"delete.png"), getMessage("removefromplaylist-menu-label"), lambda: self.deleteSelectedPlaylistItems())
|
||||||
menu.addSeparator()
|
menu.addSeparator()
|
||||||
menu.addAction(QtGui.QPixmap(resourcespath + u"arrow_switch.png"), getMessage("shuffleplaylist-menuu-label"), lambda: self.shufflePlaylist())
|
menu.addAction(QtGui.QPixmap(resourcespath + u"arrow_switch.png"), getMessage("shuffleplaylist-menuu-label"), lambda: self.shufflePlaylist())
|
||||||
@ -897,7 +900,12 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
if result == QtGui.QDialog.Accepted:
|
if result == QtGui.QDialog.Accepted:
|
||||||
newTrustedDomains = utils.convertMultilineStringToList(TrustedDomainsTextbox.toPlainText())
|
newTrustedDomains = utils.convertMultilineStringToList(TrustedDomainsTextbox.toPlainText())
|
||||||
self._syncplayClient.setTrustedDomains(newTrustedDomains)
|
self._syncplayClient.setTrustedDomains(newTrustedDomains)
|
||||||
|
@needsClient
|
||||||
|
def addTrustedDomain(self, newDomain):
|
||||||
|
trustedDomains = self.config["trustedDomains"][:]
|
||||||
|
if newDomain:
|
||||||
|
trustedDomains.append(newDomain)
|
||||||
|
self._syncplayClient.setTrustedDomains(trustedDomains)
|
||||||
|
|
||||||
@needsClient
|
@needsClient
|
||||||
def openAddMediaDirectoryDialog(self, MediaDirectoriesTextbox, MediaDirectoriesDialog):
|
def openAddMediaDirectoryDialog(self, MediaDirectoriesTextbox, MediaDirectoriesDialog):
|
||||||
|
|||||||
@ -250,6 +250,12 @@ def getListAsMultilineString(pathArray):
|
|||||||
def convertMultilineStringToList(multilineString):
|
def convertMultilineStringToList(multilineString):
|
||||||
return unicode.split(multilineString,u"\n") if multilineString else ""
|
return unicode.split(multilineString,u"\n") if multilineString else ""
|
||||||
|
|
||||||
|
def getDomainFromURL(URL):
|
||||||
|
try:
|
||||||
|
return URL.split("//")[-1].split("/")[0]
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
def getListOfPublicServers():
|
def getListOfPublicServers():
|
||||||
try:
|
try:
|
||||||
import urllib, syncplay, sys, messages, json
|
import urllib, syncplay, sys, messages, json
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user