# HG changeset patch # User Goffi # Date 1423597359 -3600 # Node ID deddd1cd8aa595622710f7677deb728a49c2b086 # Parent 5983d6be4f07dfeca8cf4db43b30c2a1f8d8d474 browser side: added a base_location property to get location of current Libervia instance diff -r 5983d6be4f07 -r deddd1cd8aa5 src/browser/libervia_main.py --- a/src/browser/libervia_main.py Tue Feb 10 19:38:28 2015 +0100 +++ b/src/browser/libervia_main.py Tue Feb 10 20:42:39 2015 +0100 @@ -112,6 +112,16 @@ def contact_list(self): return self.contact_lists[C.PROF_KEY_NONE] + @property + def base_location(self): + """Return absolute base url of this Libervia instance""" + url = Window.getLocation().getHref() + if url.endswith(C.LIBERVIA_MAIN_PAGE): + url = url[:-len(C.LIBERVIA_MAIN_PAGE)] + if url.endswith("/"): + url = url[:-1] + return url + def registerSignal(self, functionName, handler=None, iface="core", with_profile=True): if handler is None: callback = getattr(self, "{}{}".format(functionName, "Handler")) diff -r 5983d6be4f07 -r deddd1cd8aa5 src/common/constants.py --- a/src/common/constants.py Tue Feb 10 19:38:28 2015 +0100 +++ b/src/common/constants.py Tue Feb 10 20:42:39 2015 +0100 @@ -24,6 +24,8 @@ class Const(constants.Const): + LIBERVIA_MAIN_PAGE = "libervia.html" + # Frontend parameters COMPOSITION_KEY = D_("Composition") ENABLE_UNIBOX_PARAM = D_("Enable unibox") diff -r 5983d6be4f07 -r deddd1cd8aa5 src/server/server.py --- a/src/server/server.py Tue Feb 10 19:38:28 2015 +0100 +++ b/src/server/server.py Tue Feb 10 20:42:39 2015 +0100 @@ -1107,7 +1107,7 @@ """Add a child to the root resource""" root.putChild(path, EncodingResourceWrapper(resource, [server.GzipEncoderFactory()])) - putChild('', Redirect('libervia.html')) + putChild('', Redirect(C.LIBERVIA_MAIN_PAGE)) putChild('test', Redirect('libervia_test.html')) putChild('json_signal_api', self.signal_handler) putChild('json_api', MethodHandler(self))