From a0cc4ca4b7a0e30e7990a23e5d31e50b9b69b013 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 29 Oct 2022 22:57:59 +0000 Subject: [PATCH] up2k-cli: enable mt if chrome 107 or later --- copyparty/web/up2k.js | 2 +- copyparty/web/util.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 5f20c3f2..50c2bfec 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -865,7 +865,7 @@ function up2k_init(subtle) { bcfg_bind(uc, 'turbo', 'u2turbo', turbolvl > 1, draw_turbo); bcfg_bind(uc, 'datechk', 'u2tdate', turbolvl < 3, null); bcfg_bind(uc, 'az', 'u2sort', u2sort.indexOf('n') + 1, set_u2sort); - bcfg_bind(uc, 'hashw', 'hashw', !!window.WebAssembly && (!subtle || !CHROME || MOBILE), set_hashw); + bcfg_bind(uc, 'hashw', 'hashw', !!window.WebAssembly && (!subtle || !CHROME || MOBILE || VCHROME >= 107), set_hashw); bcfg_bind(uc, 'upnag', 'upnag', false, set_upnag); bcfg_bind(uc, 'upsfx', 'upsfx', false); diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 26d78767..3cdd79ce 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -14,6 +14,7 @@ var wah = '', TOUCH = 'ontouchstart' in window, MOBILE = TOUCH, CHROME = !!window.chrome, + VCHROME = CHROME ? 1 : 0, FIREFOX = ('netscape' in window) && / rv:/.test(navigator.userAgent), IPHONE = TOUCH && /iPhone|iPad|iPod/i.test(navigator.userAgent), WINDOWS = navigator.platform ? navigator.platform == 'Win32' : /Windows/.test(navigator.userAgent); @@ -36,8 +37,13 @@ try { if (navigator.userAgentData.platform == 'Windows') WINDOWS = true; - if (navigator.userAgentData.brands.some(function (d) { return d.brand == 'Chromium' })) - CHROME = true; + CHROME = navigator.userAgentData.brands.find(function (d) { return d.brand == 'Chromium' }); + if (CHROME) + VCHROME = CHROME.version; + else + VCHROME = 0; + + CHROME = !!CHROME; } catch (ex) { }