aboutsummaryrefslogtreecommitdiff
path: root/rwa/support/sessionservice
diff options
context:
space:
mode:
Diffstat (limited to 'rwa/support/sessionservice')
-rwxr-xr-xrwa/support/sessionservice/service.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/rwa/support/sessionservice/service.py b/rwa/support/sessionservice/service.py
index bb9a1e1..471d599 100755
--- a/rwa/support/sessionservice/service.py
+++ b/rwa/support/sessionservice/service.py
@@ -194,8 +194,9 @@ class RWASupportSessionService(dbus.service.Object):
* ``permission_denied``
* ``unsupported_server``
* ``invalid_url``
+ * ``duplicate``
"""
- host = str(host)
+ host = str(host).rstrip("/")
logging.info('D-Bus method call: %s("%s")', "add_web_app_host", host)
@@ -204,8 +205,14 @@ class RWASupportSessionService(dbus.service.Object):
logging.debug('Did not add "%s" to "web_app_hosts" in user_settings', host)
return json.dumps({"status": "error", "type": "invalid_url"})
+ if host in self.settings.web_app_hosts:
+ logging.warning("Given URL is already present!")
+ logging.debug('Did not add "%s" to "web_app_hosts" in user_settings', host)
+ return json.dumps({"status": "error", "type": "duplicate"})
+
res = self._do_api_handshake(host)
if res["status"] == "error":
+ logging.debug('Did not add "%s" to "web_app_hosts" in user_settings', host)
return json.dumps(res)
self.settings.web_app_hosts.append(host)