aboutsummaryrefslogtreecommitdiff
path: root/rwa
diff options
context:
space:
mode:
authorDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2021-06-30 04:14:52 +0200
committerDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2021-06-30 04:14:52 +0200
commit05de5991fa0518c284aea267564128c64f193a7c (patch)
tree32811fc08073aa8c5797e52e286c09c2f87a86b2 /rwa
parent09f0b0b89cfa7741df78e05586f615f37f5897c8 (diff)
downloadRWA.Support.SessionService-05de5991fa0518c284aea267564128c64f193a7c.tar.gz
RWA.Support.SessionService-05de5991fa0518c284aea267564128c64f193a7c.tar.bz2
RWA.Support.SessionService-05de5991fa0518c284aea267564128c64f193a7c.zip
Add url validator for incomming strings
Diffstat (limited to 'rwa')
-rwxr-xr-xrwa/support/sessionservice/service.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/rwa/support/sessionservice/service.py b/rwa/support/sessionservice/service.py
index eb588ae..bdd8fbe 100755
--- a/rwa/support/sessionservice/service.py
+++ b/rwa/support/sessionservice/service.py
@@ -36,6 +36,7 @@ import dbus
import dbus.mainloop.glib
import dbus.service
from gi.repository import GLib
+import validators
from .config import user_settings
from .lock import is_locked, lock, unlock
@@ -77,6 +78,16 @@ class RWASupportSessionService(dbus.service.Object):
logging.info("D-Bus service has been started.")
+ def _is_url(self, url: str) -> bool:
+ """Test if the given string contains an url.
+
+ :param url: The string which should be an URL.
+ :return: Bool (True=is url) or (False=no url)
+ """
+ valid = validators.url(url)
+ logging.debug('is url?: "%s": %s', url, valid)
+ return valid
+
def _get_web_app_hosts(self) -> str:
"""Get all registered RWA.Support.WebApp hosts.