diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index 563feda4..b5edcc26 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -198,12 +198,8 @@ port=22447 socketpath=/tmp/ # allow settings to overwrite enableSettingsRemote=True -# permitted settings -allowSettings=barrier#enabled # allow commands to be executed enableCommandRemote=True -# permitted commands -allowCommands=say,interrupt,window,resetwindow [barrier] enabled=True diff --git a/config/settings/settings.conf b/config/settings/settings.conf index c6213de0..10d171af 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -208,12 +208,8 @@ port=22447 socketpath=/tmp/ # allow settings to overwrite enableSettingsRemote=True -# permitted settings -allowSettings=barrier#enabled # allow commands to be executed enableCommandRemote=True -# permitted commands -allowCommands=say,interrupt,window,resetwindow [barrier] enabled=True diff --git a/config/settings/settings.conf.example b/config/settings/settings.conf.example index fe8a4f99..80039a81 100644 --- a/config/settings/settings.conf.example +++ b/config/settings/settings.conf.example @@ -209,12 +209,8 @@ port=22447 socketpath=/tmp/ # allow settings to overwrite enableSettingsRemote=True -# permitted settings -allowSettings=barrier#enabled # allow commands to be executed enableCommandRemote=True -# permitted commands -allowCommands=say,interrupt,window,resetwindow [barrier] enabled=True diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 758d12e2..65f58552 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -154,12 +154,8 @@ port=22447 socketpath=/tmp/ # allow settings to overwrite enableSettingsRemote=True -# permitted settings -allowSettings=barrier#enabled # allow commands to be executed enableCommandRemote=True -# permitted commands -allowCommands=say,interrupt,window,resetwindow [barrier] enabled=True diff --git a/config/settings/speech-dispatcher.settings.conf b/config/settings/speech-dispatcher.settings.conf index ba3178a3..2467a9b3 100644 --- a/config/settings/speech-dispatcher.settings.conf +++ b/config/settings/speech-dispatcher.settings.conf @@ -208,12 +208,8 @@ port=22447 socketpath=/tmp/ # allow settings to overwrite enableSettingsRemote=True -# permitted settings -allowSettings=barrier#enabled # allow commands to be executed enableCommandRemote=True -# permitted commands -allowCommands=say,interrupt,window,resetwindow [barrier] enabled=True diff --git a/src/fenrirscreenreader/core/remoteManager.py b/src/fenrirscreenreader/core/remoteManager.py index 0fa4947e..9be43ea0 100644 --- a/src/fenrirscreenreader/core/remoteManager.py +++ b/src/fenrirscreenreader/core/remoteManager.py @@ -126,7 +126,7 @@ class remoteManager(): def handleSettingsChange(self, settingsText): if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableSettingsRemote'): return - + upperSettingsText = settingsText.upper() # set setting if upperSettingsText.startswith(self.setSettingConst): @@ -138,14 +138,9 @@ class remoteManager(): def handleCommandExecution(self, commandText): if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableCommandRemote'): return - allowCommands = self.env['runtime']['settingsManager'].getSetting('remote', 'allowCommands').upper().split(',') + upperCommandText = commandText.upper() - allowed = False - for a in allowCommands: - if upperCommandText.startswith(a): - allowed = True - if not allowed: - return + # say if upperCommandText.startswith(self.sayConst): parameterText = commandText[len(self.sayConst):] @@ -184,9 +179,7 @@ class remoteManager(): def resetSettings(self): self.env['runtime']['settingsManager'].resetSettingArgDict() def setSettings(self, settingsArgs): - allowSettings = self.env['runtime']['settingsManager'].getSetting('remote', 'allowSettings').upper().split(',') - - self.env['runtime']['settingsManager'].parseSettingArgs(settingsArgs, allowSettings) + self.env['runtime']['settingsManager'].parseSettingArgs(settingsArgs) def handleRemoteIncomming(self, eventData): if not eventData: return diff --git a/src/fenrirscreenreader/core/settingsData.py b/src/fenrirscreenreader/core/settingsData.py index 021d1267..e7ee9c66 100644 --- a/src/fenrirscreenreader/core/settingsData.py +++ b/src/fenrirscreenreader/core/settingsData.py @@ -86,9 +86,7 @@ settingsData = { 'port': 22447, 'socketpath':'/tmp/', 'enableSettingsRemote': True, - 'allowSettings': 'barrier#enabled', 'enableCommandRemote': True, - 'allowCommands': 'say,interrupt,window,resetwindow', }, 'barrier':{ 'enabled': True, diff --git a/src/fenrirscreenreader/core/settingsManager.py b/src/fenrirscreenreader/core/settingsManager.py index a4b8d52e..8df06a54 100644 --- a/src/fenrirscreenreader/core/settingsManager.py +++ b/src/fenrirscreenreader/core/settingsManager.py @@ -87,10 +87,10 @@ class settingsManager(): value = '' try: value = self.settingArgDict[section.lower()][setting.lower()] - return value + return value except: pass - try: + try: value = self.env['settings'].get(section, setting) except: value = str(self.settings[section][setting]) @@ -100,7 +100,7 @@ class settingsManager(): value = 0 try: value = int(self.settingArgDict[section.lower()][setting.lower()]) - return value + return value except Exception as e: pass try: @@ -113,9 +113,9 @@ class settingsManager(): value = 0.0 try: value = float(self.settingArgDict[section.lower()][setting.lower()]) - return value + return value except Exception as e: - pass + pass try: value = self.env['settings'].getfloat(section, setting) except: @@ -160,7 +160,7 @@ class settingsManager(): try: self.env['runtime'][driverType].shutdown() except Exception as e: - pass + pass del self.env['runtime'][driverType] def setFenrirKeys(self, keys): @@ -185,21 +185,14 @@ class settingsManager(): except KeyError: self.settingArgDict[section] = {} self.settingArgDict[section][option] = str(value) - - def parseSettingArgs(self, settingArgs, allowSettings = None): + + def parseSettingArgs(self, settingArgs): for optionElem in settingArgs.split(';'): if len(optionElem.split('#',1)) != 2: continue if len(optionElem.split('#',1)[1].split('=',1)) != 2: continue - allowed = False - if allowSettings: - for a in allowSettings: - if a in optionElem: - allowed = True - if not allowed: - continue - + section = str(optionElem.split('#',1)[0]).lower() option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower() value = optionElem.split('#',1)[1].split('=',1)[1] @@ -288,13 +281,13 @@ class settingsManager(): environment['runtime']['memoryManager'].initialize(environment) environment['runtime']['attributeManager'] = attributeManager.attributeManager() - environment['runtime']['attributeManager'].initialize(environment) + environment['runtime']['attributeManager'].initialize(environment) environment['runtime']['eventManager'] = eventManager.eventManager() - environment['runtime']['eventManager'].initialize(environment) + environment['runtime']['eventManager'].initialize(environment) environment['runtime']['processManager'] = processManager.processManager() - environment['runtime']['processManager'].initialize(environment) + environment['runtime']['processManager'].initialize(environment) environment['runtime']['outputManager'] = outputManager.outputManager() environment['runtime']['outputManager'].initialize(environment)