// (c) Copyright Ascensio System SIA 2009-2024 // // This program is a free software product. // You can redistribute it and/or modify it under the terms // of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software // Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended // to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of // any third-party rights. // // This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see // the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html // // You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. // // The interactive user interfaces in modified source and object code versions of the Program must // display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. // // Pursuant to Section 7(b) of the License you must retain the original Product logo when // distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under // trademark law for use of our trademarks. // // All the Product's GUI elements, including illustrations and icon sets, as well as technical writing // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode (function () { class BrowserDetector { constructor() { this.browser = {}; this.unsupportedBrowsers = { Chrome: 109, Firefox: 109, IE: 11, Edge: 109, Opera: 90, Safari: 16, SafariMobile: 16, AscDesktopEditor: 6, SamsungBrowser: 4, UCBrowser: 12, }; this.detectBrowser(); } detectBrowser() { this.browser = (function () { const agent = navigator.userAgent; let temp = []; let match = agent.match( /(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i, ) || []; if (/trident/i.test(match[1])) { temp = /\brv[ :]+(\d+)/g.exec(ua) || []; return { name: "IE", version: temp[1] || "" }; } if (match[1] === "Chrome") { temp = agent.match( /\b(OPR|Edge|AscDesktopEditor|SamsungBrowser|UCBrowser)\/(\d+.\d)/, ); const userOS = agent.search("Linux") !== -1 && agent.search("X11") !== -1 ? "Linux" : ""; if (temp != null) { return { name: temp[1].replace("OPR", "Opera"), version: temp[2], chromeVersion: match[2] || 70, userOS, }; } } match = match[2] ? [match[1], match[2]] : [navigator.appName, navigator.appVersion, "-?"]; if ((temp = agent.match(/version\/(\d+)/i)) != null) { match.splice(1, 1, temp[1]); } if ((temp = agent.match(/mobile\/(\d+)/i)) != null) { match[0] += "Mobile"; } if ((temp = agent.match(/mobile/i)) != null) { if ((temp = agent.match(/chrome\/?\s*(\d+)/i)) != null) { match[1] = temp[1]; } } return { name: match[0], version: match[1], chromeVersion: match[1] || 70, }; })(); } isSupported() { if (this.unsupportedBrowsers.hasOwnProperty(this.browser.name)) { if ( this.browser.name === "AscDesktopEditor" && this.browser.userOS === "Linux" && +this.browser.chromeVersion <= 75 ) return false; if ( +this.browser.version < this.unsupportedBrowsers[this.browser.name] && +this.browser.chromeVersion < this.unsupportedBrowsers.Chrome ) { return false; } } return true; } getBrowserInfo() { return { name: this.browser.name, version: this.browser.version, }; } } const browserInfo = new BrowserDetector().getBrowserInfo(); const isDesktop = browserInfo.name === "AscDesktopEditor"; const isSupported = new BrowserDetector().isSupported(); if (isDesktop && !isSupported) { const styles = ``; const title = `You are using an old version of the app. Please update ONLYOFFICE Desktop Editors to the latest version to connect to DocSpace.`; const header = `Can’t connect to ${window.location.host}`; const body = `

${header}

${title}

`; document.head.innerHTML += styles; document.title = `You are using an old version of the app. Please update ONLYOFFICE Desktop Editors to the latest version to connect to DocSpace.`; document.body.innerHTML = body; return; } if (!isSupported) { const styles = ``; const body = `

Browser needs to be updated

You are using an outdated browser version

`; document.head.innerHTML += styles; document.title = "You are using an outdated browser version"; document.body.innerHTML = body; } })();