Mercurial > libervia-web
changeset 1595:7941444c1671
pages: set `own_local_jid` to avoid confusion with `own_jid`:
- `own_jid` is the real JID of the user.
- `own_local_jid` is the JID used in chat, which can be real JID, or a room JID.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 13 Dec 2023 22:05:48 +0100 |
parents | 93abef9a3548 |
children | 52098b5bab8d |
files | libervia/web/pages/chat/_browser/__init__.py libervia/web/pages/chat/page_meta.py libervia/web/pages/login/logged/page_meta.py libervia/web/pages/login/page_meta.py libervia/web/server/constants.py libervia/web/server/pages.py libervia/web/server/restricted_bridge.py libervia/web/server/session_iface.py |
diffstat | 8 files changed, 17 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/web/pages/chat/_browser/__init__.py Wed Dec 13 22:03:49 2023 +0100 +++ b/libervia/web/pages/chat/_browser/__init__.py Wed Dec 13 22:05:48 2023 +0100 @@ -15,7 +15,8 @@ log.warning = log.warn profile = window.profile or "" -own_jid = jid.JID(window.own_jid) +# JID used in the local chat (real JID for one2one, room JID otherwise) +own_local_jid = jid.JID(window.own_local_jid) target_jid = jid.JID(window.target_jid) chat_type = window.chat_type bridge = Bridge() @@ -253,7 +254,8 @@ from_jid = from_jid.bare return { - "own_jid": own_jid, + "own_local_jid": str(own_local_jid), + "chat_type": chat_type, "msg": { "id": uid, "timestamp": extra.get("updated", timestamp),
--- a/libervia/web/pages/chat/page_meta.py Wed Dec 13 22:03:49 2023 +0100 +++ b/libervia/web/pages/chat/page_meta.py Wed Dec 13 22:05:48 2023 +0100 @@ -67,14 +67,14 @@ __) = join_ret template_data["subject"] = room_subject template_data["room_statuses"] = room_statuses - own_jid = jid.JID(room_jid_s) - own_jid = own_jid.change_resource(user_nick) + own_local_jid = jid.JID(room_jid_s) + own_local_jid = own_local_jid.change_resource(user_nick) else: room_subject = None chat_type = C.CHAT_ONE2ONE - own_jid = profile_jid + own_local_jid = profile_jid rdata["chat_type"] = chat_type - template_data["own_jid"] = own_jid + template_data["own_local_jid"] = own_local_jid history = await self.host.bridge_call( "history_get", @@ -100,7 +100,7 @@ self.expose_to_scripts( request, room_subject=room_subject, - own_jid=str(own_jid), + own_local_jid=str(own_local_jid), target_jid=target_jid, chat_type=chat_type, )
--- a/libervia/web/pages/login/logged/page_meta.py Wed Dec 13 22:03:49 2023 +0100 +++ b/libervia/web/pages/login/logged/page_meta.py Wed Dec 13 22:05:48 2023 +0100 @@ -6,7 +6,7 @@ log = getLogger(__name__) -"""SàT log-in page, with link to create an account""" +"""Libervia Web log-in page, with link to create an account""" template = "login/logged.html"
--- a/libervia/web/pages/login/page_meta.py Wed Dec 13 22:03:49 2023 +0100 +++ b/libervia/web/pages/login/page_meta.py Wed Dec 13 22:05:48 2023 +0100 @@ -10,7 +10,7 @@ log = getLogger(__name__) -"""SàT log-in page, with link to create an account""" +"""Libervia Web log-in page, with link to create an account""" name = "login" access = C.PAGES_ACCESS_PUBLIC
--- a/libervia/web/server/constants.py Wed Dec 13 22:03:49 2023 +0100 +++ b/libervia/web/server/constants.py Wed Dec 13 22:05:48 2023 +0100 @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -# Libervia: a SàT frontend -# Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) +# Libervia web frontend +# Copyright (C) 2009-2023 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by
--- a/libervia/web/server/pages.py Wed Dec 13 22:03:49 2023 +0100 +++ b/libervia/web/server/pages.py Wed Dec 13 22:05:48 2023 +0100 @@ -1415,6 +1415,8 @@ profile=session_data.profile, tz_name=template_data["tz_name"] ) + if session_data.jid is not None: + self.expose_to_scripts(request, own_jid=session_data.jid) uri = request.uri.decode() try:
--- a/libervia/web/server/restricted_bridge.py Wed Dec 13 22:03:49 2023 +0100 +++ b/libervia/web/server/restricted_bridge.py Wed Dec 13 22:05:48 2023 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Libervia: a SàT frontend +# Libervia Web Frontend # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify
--- a/libervia/web/server/session_iface.py Wed Dec 13 22:03:49 2023 +0100 +++ b/libervia/web/server/session_iface.py Wed Dec 13 22:05:48 2023 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Libervia: a SàT frontend +# Libervia Web Frontend # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify