Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/im/public/src/ |
Upload File : |
import { Extension, Reflection } from 'main.core'; class Desktop { constructor() { const settings = Extension.getSettings('im.public'); this.v2enabled = settings.get('v2enabled', false); } async openPage(url: string, options: { skipNativeBrowser?: boolean } = {}): Promise { if (!this.v2enabled) { return Promise.resolve(false); } const DesktopManager = Reflection.getClass('BX.Messenger.v2.Lib.DesktopManager'); if (DesktopManager.isDesktop()) { return Promise.resolve(true); } const targetUrl = new URL(url); if (targetUrl.host !== location.host) { return Promise.resolve(false); } const skipNativeBrowser = Boolean(options.skipNativeBrowser); const isRedirectAllowed = await DesktopManager?.getInstance().checkForOpenBrowserPage(); if (isRedirectAllowed) { return DesktopManager?.getInstance().openPage(targetUrl.href, { skipNativeBrowser }); } if (skipNativeBrowser === true) { return Promise.resolve(false); } window.open(targetUrl.href, '_blank'); return Promise.resolve(true); } } export const desktop = new Desktop();