From e12a13c6ba1cfc0313da41bb8b4287eaa930db5a Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Wed, 24 Jun 2026 07:00:27 -0700 Subject: [PATCH] Fix for Missing "cookie" Helper Functions Fix for compatibility issue with latest AsusWRT6 routers, such as the GT-BE19000AI, running 3006.102.8 F/W version, where the webpage generates errors due to missing "cookie" helper functions previously defined in the 'state.js' file (Ported from Unbound Stats WebUI ASP fix supplied by @ExtremeFiretop). --- README.md | 2 +- scmerlin.sh | 4 ++-- scmerlin_www.asp | 4 ++-- scmerlin_www.js | 31 ++++++++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bdee527..f12c19b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # scMerlin ## v2.5.50 -### Updated on 2026-Apr-26 +### Updated on 2026-Jun-24 ## About scMerlin allows you to easily control the most common services/scripts on your router. scMerlin also augments your router's WebUI with a Sitemap and dynamic submenus for the main left menu of Asuswrt-Merlin. diff --git a/scmerlin.sh b/scmerlin.sh index c66e0d8..a973f3a 100644 --- a/scmerlin.sh +++ b/scmerlin.sh @@ -12,7 +12,7 @@ ## Forked from: https://github.com/jackyaz/scMerlin ## ## ## ###################################################### -# Last Modified: 2026-Apr-26 +# Last Modified: 2026-Jun-24 #----------------------------------------------------- ########## Shellcheck directives ########### @@ -34,7 +34,7 @@ readonly SCRIPT_NAME="scMerlin" readonly SCRIPT_NAME_LOWER="$(echo "$SCRIPT_NAME" | tr 'A-Z' 'a-z' | sed 's/d//')" readonly SCM_VERSION="v2.5.50" readonly SCRIPT_VERSION="v2.5.50" -readonly SCRIPT_VERSTAG="26042609" +readonly SCRIPT_VERSTAG="26062400" SCRIPT_BRANCH="develop" SCRIPT_REPO="https://raw.githubusercontent.com/AMTM-OSR/$SCRIPT_NAME/$SCRIPT_BRANCH" readonly SCRIPT_DIR="/jffs/addons/$SCRIPT_NAME_LOWER.d" diff --git a/scmerlin_www.asp b/scmerlin_www.asp index 1a85271..d428056 100644 --- a/scmerlin_www.asp +++ b/scmerlin_www.asp @@ -28,7 +28,7 @@ p{font-weight:bolder}thead.collapsible-jquery{color:#fff;padding:0;width:100%;bo diff --git a/scmerlin_www.js b/scmerlin_www.js index 0c0a989..4ed396a 100644 --- a/scmerlin_www.js +++ b/scmerlin_www.js @@ -1,5 +1,5 @@ /**----------------------------**/ -/** Last Modified: 2026-Mar-15 **/ +/** Last Modified: 2026-Jun-24 **/ /**----------------------------**/ var arrayproclistlines = []; @@ -847,6 +847,35 @@ function ParseProcList(data){ SortTable('sortTableProcesses','arrayproclistlines',sortnameproc+' '+sortdirproc.replace('desc','↑').replace('asc','↓').trim(),'sortnameproc','sortdirproc'); } +/**----------------------------------------------------------------** + ** Compatibility layer for the latest AsusWRT6 routers, such as + ** the GT-BE19000AI, where the previous global 'cookie' helper + ** functions defined in the 'state.js' file are now removed in + ** favour of using the "window.localStorage" property. + **----------------------------------------------------------------**/ +if (typeof window.cookie === "undefined" || + typeof window.cookie.get !== "function" || + typeof window.cookie.set !== "function") +{ + window.cookie = { + get: function (key) { + return window.localStorage.getItem(key); + }, + + /** In the previous 'cookie' function a 3rd argument was given for 'days' **/ + /** Here, we ignore the value because there is no expiration date anymore **/ + set: function (key, value, days) { + window.localStorage.setItem(key, String(value)); + }, + + unset: function (key) { + window.localStorage.removeItem(key); + } + }; + + console.log("Installed localStorage compatibility for cookie API."); +} + function GetCookie(cookiename,returntype){ if(cookie.get('scm_'+cookiename) != null){ return cookie.get('scm_'+cookiename);