From 811e5d92890757d53d6bffe795ec40a06c5f32d4 Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Fri, 11 Apr 2025 05:23:50 +0800 Subject: [PATCH] misc: drop MMRL permission request on new version of MMRL - drop support for MMRL version < 33412 --- module/webui/index.html | 10 ++-------- module/webui/scripts/main.js | 27 ++++++++++++--------------- module/webui/styles/global.css | 8 -------- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/module/webui/index.html b/module/webui/index.html index 6a9309d..2ada216 100644 --- a/module/webui/index.html +++ b/module/webui/index.html @@ -246,15 +246,9 @@
-

Please allow JavaScript API in MMRL settings

+

Please update MMRL to continue

-
    -
  1. Settings
  2. -
  3. Security
  4. -
  5. Allow JavaScript API
  6. -
  7. Tricky Store
  8. -
  9. Enable "Allow Advanced KernelSU API"
  10. -
+

Minimun MMRL version: v33412

diff --git a/module/webui/scripts/main.js b/module/webui/scripts/main.js index 25460dc..30be321 100644 --- a/module/webui/scripts/main.js +++ b/module/webui/scripts/main.js @@ -24,7 +24,6 @@ const ADDITIONAL_APPS = [ "android", "com.google.android.gms", "io.github.vvb206 // Variables let e = 0; let isRefreshing = false; -let MMRL_API = true; // Function to set basePath async function getBasePath() { @@ -214,21 +213,20 @@ async function checkMMRL() { console.error("Error setting status bars theme:", error) } - // Request API permission, supported version: 33045+ + // Check MMRL version try { - $tricky_store.requestAdvancedKernelSUAPI(); + const mmrlJson = $tricky_store.getMmrl(); + const mmrlData = JSON.parse(mmrlJson); + if (mmrlData.versionCode < 33412) { + throw new Error('MMRL version is less than 33412'); + } } catch (error) { - console.error("Error requesting API:", error); - } - - // Check permissions - try { - await execCommand('ls /data/adb/modules'); - MMRL_API = true; - } catch (error) { - console.error('Permission check failed:', error); + console.error('MMRL version check failed:', error); + $tricky_store.requestAdvancedKernelSUAPI(); // Just to ensure linkRedirect work permissionPopup.style.display = 'flex'; - MMRL_API = false; + setTimeout(() => { + linkRedirect('https://github.com/MMRLApp/MMRL/releases/latest'); + }, 3000) } } } @@ -326,9 +324,8 @@ window.addEventListener('scroll', () => { // Initial load document.addEventListener('DOMContentLoaded', async () => { await loadTranslations(); - await checkMMRL(); - if (!MMRL_API) return; await getBasePath(); + checkMMRL(); hideFloatingBtn(); getModuleVersion(); setupMenuToggle(); diff --git a/module/webui/styles/global.css b/module/webui/styles/global.css index af64640..12c1311 100644 --- a/module/webui/styles/global.css +++ b/module/webui/styles/global.css @@ -262,14 +262,6 @@ body { text-align: left; } -.permission-steps ol { - padding: 0 25px; -} - -.permission-steps li { - margin-top: 10px; -} - .ripple-element { position: relative; overflow: hidden;