From f54bd796c23c2ef5643d5df764e25763e3a2dfad Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Wed, 24 Jun 2026 07:01:44 -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 +- ntpdstats_www.asp | 8 ++++---- ntpdstats_www.js | 32 ++++++++++++++++++++++++++++++++ ntpmerlin.sh | 4 ++-- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fb14039..57bce2c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ntpMerlin ## v3.4.16 -### Updated on 2026-Apr-15 +### Updated on 2026-Jun-24 ## About ntpMerlin implements an NTP time server for AsusWRT Merlin with charts for daily, weekly and monthly summaries of performance. A choice between ntpd and chrony is available. diff --git a/ntpdstats_www.asp b/ntpdstats_www.asp index 8c58011..0026d0f 100644 --- a/ntpdstats_www.asp +++ b/ntpdstats_www.asp @@ -30,9 +30,9 @@ p{font-weight:bolder}thead.collapsible-jquery{color:#fff;padding:0;width:100%;bo diff --git a/ntpdstats_www.js b/ntpdstats_www.js index 5cd8278..0f4c97e 100644 --- a/ntpdstats_www.js +++ b/ntpdstats_www.js @@ -1,3 +1,6 @@ +/**----------------------------**/ +/** Last Modified: 2026-Jun-24 **/ +/**----------------------------**/ var arraysortlistlines = []; var sortname = 'Time'; @@ -443,6 +446,35 @@ function getTimeFormat(value,format) return timeformat; } +/**----------------------------------------------------------------** + ** 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){ var s; if((s = cookie.get('ntp_'+cookiename)) != null){ diff --git a/ntpmerlin.sh b/ntpmerlin.sh index ccccb4a..b4dc06f 100644 --- a/ntpmerlin.sh +++ b/ntpmerlin.sh @@ -14,7 +14,7 @@ ## Forked from https://github.com/jackyaz/ntpMerlin ## ## ## ############################################################## -# Last Modified: 2026-Apr-15 +# Last Modified: 2026-Jun-24 #------------------------------------------------------------- ############### Shellcheck directives ############# @@ -37,7 +37,7 @@ readonly SCRIPT_NAME="ntpMerlin" readonly SCRIPT_NAME_LOWER="$(echo "$SCRIPT_NAME" | tr 'A-Z' 'a-z' | sed 's/d//')" readonly SCRIPT_VERSION="v3.4.16" -readonly SCRIPT_VERSTAG="26041500" +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"