From f33fcdf8c67bc28783b6a888de1a91ba095900de Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Mon, 19 Jun 2023 10:28:13 +0000 Subject: [PATCH] [FIX] im_livechat: fix cors error on embed livechat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, starting a page with the livechat embed in another origin than Odoo would have resulted in an CORS error being shown due to the `bootstrap_translation` route being called in response to the legacy `web.session` setup. This commit restore the legacy session as it was before [1]. [1]: https://github.com/odoo/odoo/pull/122834 closes odoo/odoo#125565 Signed-off-by: Alexandre Kühn (aku) --- addons/im_livechat/__manifest__.py | 1 - .../im_livechat/static/src/embed/external/session_legacy.js | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 addons/im_livechat/static/src/embed/external/session_legacy.js diff --git a/addons/im_livechat/__manifest__.py b/addons/im_livechat/__manifest__.py index f18ae0be685..353d419e4d2 100644 --- a/addons/im_livechat/__manifest__.py +++ b/addons/im_livechat/__manifest__.py @@ -106,7 +106,6 @@ Help your customers with this chat, and analyse their feedback. ('remove', 'web/static/src/legacy/js/common_env.js'), 'web/static/src/views/fields/formatters.js', 'web/static/src/views/fields/file_handler.*', - 'web/static/src/legacy/js/services/session.js', 'bus/static/src/bus_parameters_service.js', ('remove', 'bus/static/src/services/assets_watchdog_service.js'), diff --git a/addons/im_livechat/static/src/embed/external/session_legacy.js b/addons/im_livechat/static/src/embed/external/session_legacy.js new file mode 100644 index 00000000000..38c7112bc46 --- /dev/null +++ b/addons/im_livechat/static/src/embed/external/session_legacy.js @@ -0,0 +1,6 @@ +/* @odoo-module alias=web.session */ + +import Session from "web.Session"; +import { serverUrl } from "@im_livechat/embed/livechat_data"; + +export default new Session(undefined, serverUrl, { use_cors: true });