Mercurial > libervia-backend
changeset 3631:bef32f3ccc06
merge branche "@"
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Aug 2021 14:51:40 +0200 |
parents | 6559c0f847d4 (current diff) 8ee0140cc8b6 (diff) |
children | 597a535ee187 |
files | doc/configuration.rst sat/tools/common/date_utils.py sat_frontends/jp/cmd_blog.py |
diffstat | 7 files changed, 49 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/configuration.rst Fri Aug 27 08:49:45 2021 +0200 +++ b/doc/configuration.rst Fri Aug 27 14:51:40 2021 +0200 @@ -106,6 +106,8 @@ ; background luminance, used by terminal frontends ; can be "auto" (default) to autodetect, "dark" or "light" background = auto + # end-user facing URL, used by Web frontend + public_url = example.com # uncomment next line if you don't want to use local cache for pubsub items ; pubsub_cache_strategy = "no_cache"
--- a/doc/overview.rst Fri Aug 27 08:49:45 2021 +0200 +++ b/doc/overview.rst Fri Aug 27 14:51:40 2021 +0200 @@ -78,28 +78,34 @@ The Web frontend is the second main interface for most users. This frontend has the particularity to be in 2 parts: a server which serves HTTP content, and a client which -runs in the browser. So you have Libervia server which connect to Libervia backend which itself -connect to the XMPP server, and your browser will connect to Libervia server. +runs in the browser. So you have Libervia Web server which connect to Libervia backend which itself +connect to the XMPP server, and your browser will connect to Libervia Web server. -In the browser, you can access the server in two ways: either directly with what we call -**Libervia pages**, or with a JavaScript code in `single-page application`_ which is the -**Libervia client** (or **Libervia web app**) that we have mentioned above. - -The **Libervia pages** are web pages managing a single feature. They can work without -JavaScript when it's possible (it's not the case for instant messaging or similar highly -dynamic contents). They aims to be simple and straightforward to use. +.. + # NOTE: currently not relevant as there is no Web APP anymore, may come back in the + future though + In the browser, you can access the server in two ways: either directly with what we call + **Libervia pages**, or with a JavaScript code in `single-page application`_ which is the + **Libervia client** (or **Libervia web app**) that we have mentioned above. -The **Libervia client** is a highly dynamic web application, used to access more features. -It's more complete and may be well adapted if you want to let Libervia running in a browser tab -for an extended period. +The **Libervia Web Pages** are web pages managing a single feature. They can work without +JavaScript when it's possible (it's not the case for instant messaging or similar highly +dynamic contents). They aims to be simple and straightforward to use. That what you're +accessing when you're using Libervia Web. -Last but not least, Libervia is also the central part of the new **web framework** of -Libervia. Indeed, in addition of being a frontend to Libervia features (which is built with -this framework), you can create totally different websites which are integrated in Libervia -(and so XMPP) ecosystem. This framework uses Libervia template engine (based on `Jinja2`_) and -makes the creation of decentralised and federated websites simple. Thanks to this framework, -it's easy to experiment new ideas/features, or to change completely the look and feel of -the Libervia frontend. +.. + #Note: as above, not relevant anymore but may come back in the future + The **Libervia Web Client** is a highly dynamic web application, used to access more features. + It's more complete and may be well adapted if you want to let Libervia running in a browser tab + for an extended period. + +Libervia Web is also the central part of the **Web Framework**. Indeed, in addition of +being a frontend to Libervia features (which is built with this framework), you can create +totally different websites which are integrated in Libervia (and so XMPP) ecosystem. This +framework uses Libervia template engine (based on `Jinja2`_) and makes the creation of +decentralised and federated websites simple. Thanks to this framework, it's easy to +experiment new ideas/features, or to change completely the look and feel of the Libervia +frontend. The `official Libervia website`_ is made with Libervia web framework.
--- a/sat/tools/common/date_utils.py Fri Aug 27 08:49:45 2021 +0200 +++ b/sat/tools/common/date_utils.py Fri Aug 27 14:51:40 2021 +0200 @@ -25,6 +25,7 @@ from dateutil import tz, parser from dateutil.relativedelta import relativedelta from dateutil.utils import default_tzinfo +from dateutil.parser import ParserError from babel import dates import calendar import time @@ -64,9 +65,15 @@ value = str(value).strip() dayfirst = False if YEAR_FIRST_RE.match(value) else True - dt = default_tzinfo( - parser.parse(value, default=DEFAULT_DATETIME, dayfirst=dayfirst), - default_tz) + try: + dt = default_tzinfo( + parser.parse(value, default=DEFAULT_DATETIME, dayfirst=dayfirst), + default_tz) + except ParserError as e: + if value == "now": + dt = datetime.datetime.now(tz.tzutc()) + else: + raise e return calendar.timegm(dt.utctimetuple()) def date_parse_ext(value, default_tz=TZ_UTC):
--- a/sat_frontends/jp/cmd_avatar.py Fri Aug 27 08:49:45 2021 +0200 +++ b/sat_frontends/jp/cmd_avatar.py Fri Aug 27 14:51:40 2021 +0200 @@ -49,7 +49,7 @@ async def showImage(self, path): sat_conf = config.parseMainConf() - cmd = config.getConfig(sat_conf, "jp", "image_cmd") + cmd = config.getConfig(sat_conf, C.CONFIG_SECTION, "image_cmd") cmds = [cmd] + DISPLAY_CMD if cmd else DISPLAY_CMD for cmd in cmds: try:
--- a/sat_frontends/jp/cmd_blog.py Fri Aug 27 08:49:45 2021 +0200 +++ b/sat_frontends/jp/cmd_blog.py Fri Aug 27 14:51:40 2021 +0200 @@ -637,7 +637,9 @@ async def start(self): # if there are user defined extension, we use them - SYNTAX_EXT.update(config.getConfig(self.sat_conf, "jp", CONF_SYNTAX_EXT, {})) + SYNTAX_EXT.update( + config.getConfig(self.sat_conf, C.CONFIG_SECTION, CONF_SYNTAX_EXT, {}) + ) self.current_syntax = await self.get_current_syntax() ( @@ -782,11 +784,13 @@ aionotify = None sat_conf = self.sat_conf - SYNTAX_EXT.update(config.getConfig(sat_conf, "jp", CONF_SYNTAX_EXT, {})) + SYNTAX_EXT.update( + config.getConfig(sat_conf, C.CONFIG_SECTION, CONF_SYNTAX_EXT, {}) + ) try: self.open_cb_cmd = config.getConfig( - sat_conf, "jp", "blog_preview_open_cmd", Exception + sat_conf, C.CONFIG_SECTION, "blog_preview_open_cmd", Exception ) except (NoOptionError, NoSectionError): self.open_cb_cmd = None @@ -795,7 +799,7 @@ open_cb = self.openPreviewExt self.update_cb_cmd = config.getConfig( - sat_conf, "jp", "blog_preview_update_cmd", self.open_cb_cmd + sat_conf, C.CONFIG_SECTION, "blog_preview_update_cmd", self.open_cb_cmd ) if self.update_cb_cmd is None: update_cb = self.showPreview
--- a/sat_frontends/jp/common.py Fri Aug 27 08:49:45 2021 +0200 +++ b/sat_frontends/jp/common.py Fri Aug 27 14:51:40 2021 +0200 @@ -199,13 +199,13 @@ content_file_obj.close() # we prepare arguments - editor = config.getConfig(self.sat_conf, "jp", "editor") or os.getenv( + editor = config.getConfig(self.sat_conf, C.CONFIG_SECTION, "editor") or os.getenv( "EDITOR", "vi" ) try: # is there custom arguments in sat.conf ? editor_args = config.getConfig( - self.sat_conf, "jp", editor_args_opt, Exception + self.sat_conf, C.CONFIG_SECTION, editor_args_opt, Exception ) except (NoOptionError, NoSectionError): # no, we check if we know the editor and have special arguments
--- a/tests/e2e/run_e2e.py Fri Aug 27 08:49:45 2021 +0200 +++ b/tests/e2e/run_e2e.py Fri Aug 27 14:51:40 2021 +0200 @@ -176,7 +176,7 @@ if not compose_e2e_path.is_file(): raise exceptions.NotFound('"docker-compose-e2e.yml" file can\'t be found') - with tempfile.TemporaryDirectory(prefix="sat_test_e2e_") as temp_dir: + with tempfile.TemporaryDirectory(prefix="libervia_test_e2e_") as temp_dir: override_path = Path(temp_dir) / "test_override.yml" override = yaml.load( dedent(f"""\