diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/core/module-loader.js | 2 | ||||
| -rw-r--r-- | modules/ext/webdav.js | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/modules/core/module-loader.js b/modules/core/module-loader.js index 2cb5003..ffa691e 100644 --- a/modules/core/module-loader.js +++ b/modules/core/module-loader.js @@ -4,7 +4,7 @@ // Core module bundle loaded synchronously in main.html. // This loader only handles version cache-busting, splash, terminal init, and optional ext modules. - const LATEST_VER = 'v4.6.144'; + const LATEST_VER = 'v4.6.145'; const CACHE = '?v=' + LATEST_VER; // Exposed so ext modules can register their own URL with the same cache-busting version // instead of an unversioned path the browser may already have cached (shell.js did). diff --git a/modules/ext/webdav.js b/modules/ext/webdav.js index c7efbf9..a97a8bc 100644 --- a/modules/ext/webdav.js +++ b/modules/ext/webdav.js @@ -975,6 +975,13 @@ class WebDAVModule { } }; const mount = document.getElementById('wdav-tg-mount'); + // A Telegram widget cannot log anyone in inside an Android WebView or an in-app + // browser: it needs a popup that can postMessage back to the opener, and those hosts + // hand the link to the system browser, which has no opener. Measured 2026-11-02 (the + // operator's phone UA ends "...; wv)"): every attempt landed in Chrome and died there. + // In that case skip the widget entirely and start the code flow, which needs no popup. + const _tgWV = /;\s*wv\)/.test(navigator.userAgent || '') || + /\bTelegram\b/i.test(navigator.userAgent || ''); const tw = document.createElement('script'); tw.src = 'https://telegram.org/js/telegram-widget.js?22'; tw.setAttribute('data-telegram-login', 'roducbot'); @@ -982,7 +989,16 @@ class WebDAVModule { tw.setAttribute('data-onauth', 'webx11TgLogin(user)'); tw.setAttribute('data-request-access', 'write'); tw.async = true; - mount.appendChild(tw); + if (_tgWV) { + // The code button's handler is already bound above; just hide the widget and use it. + if (mount) mount.style.display = 'none'; + const _st = document.getElementById('wdav-tg-status'); + if (_st) _st.textContent = 'This app window cannot run the Telegram button — using a code instead.'; + const _cb = document.getElementById('wdav-code-btn'); + if (_cb) setTimeout(function () { _cb.click(); }, 0); + } else { + mount.appendChild(tw); + } document.getElementById('wdav-login-btn').onclick = async function () { const u = (document.getElementById('wdav-user').value || '').trim().toLowerCase(); const pw = document.getElementById('wdav-pass').value || ''; |