Skip to content

Commit dd56c73

Browse files
Fix & Improvements
- Fix to prevent showing "vTBD" on the WebGUI page for "Script Update Available" - Improved some message wording. - General code improvements.
1 parent f2d26da commit dd56c73

File tree

2 files changed

+61
-55
lines changed

2 files changed

+61
-55
lines changed

MerlinAU.asp

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<script language="JavaScript" type="text/javascript">
3030
3131
/**----------------------------**/
32-
/** Last Modified: 2025-May-10 **/
32+
/** Last Modified: 2025-May-11 **/
3333
/**----------------------------**/
3434
3535
// Separate variables for shared and AJAX settings //
@@ -988,7 +988,7 @@ function GetExternalCheckResults()
988988
if (externalCheckOK)
989989
{
990990
fwUpdateDirPath.ResetExtCheckVars();
991-
showScriptUpdateBanner();
991+
ShowScriptUpdateBanner();
992992
return true;
993993
}
994994
let fwUpdateZIPdirectory = document.getElementById('fwUpdateZIPDirectory');
@@ -2034,26 +2034,34 @@ function UpdateScriptVersion()
20342034
$('#footerTitle').text ('MerlinAU v' + localVers + ' by ExtremeFiretop & Martinski W.');
20352035
}
20362036
2037-
/**---------------------------------------**/
2038-
/** Added by ExtremeFiretop [2025-May-10] **/
2039-
/**---------------------------------------**/
2040-
function showScriptUpdateBanner () {
2041-
const localVers = GetScriptVersion('local');
2042-
if (typeof isScriptUpdateAvailable === 'undefined') return;
2043-
2044-
if (isScriptUpdateAvailable && isScriptUpdateAvailable !== localVers) {
2045-
const host = document.getElementById('ScriptUpdateNotice');
2046-
if (!host) return;
2047-
2048-
host.innerHTML =
2049-
InvREDct +
2050-
'Script&nbsp;Update&nbsp;Available&nbsp;&rarr;&nbsp;v' +
2051-
isScriptUpdateAvailable +
2052-
InvCLEAR;
2053-
2054-
host.style.cssText =
2055-
'float:right;margin-left:auto;font-weight:bold;white-space:nowrap;';
2056-
}
2037+
/**----------------------------------------**/
2038+
/** Modified by Martinski W. [2025-May-11] **/
2039+
/**----------------------------------------**/
2040+
function ShowScriptUpdateBanner()
2041+
{
2042+
const localVers = GetScriptVersion('local');
2043+
const updateNotice = document.getElementById('ScriptUpdateNotice');
2044+
2045+
if (updateNotice === null ||
2046+
typeof updateNotice === 'undefined' ||
2047+
typeof isScriptUpdateAvailable === 'undefined')
2048+
{ return; }
2049+
2050+
if (isScriptUpdateAvailable !== 'TBD' &&
2051+
isScriptUpdateAvailable !== localVers)
2052+
{
2053+
updateNotice.innerHTML =
2054+
InvREDct +
2055+
'Script Update Available &rarr; v' + isScriptUpdateAvailable +
2056+
InvCLEAR;
2057+
2058+
updateNotice.style.cssText =
2059+
'float:right;margin-left:auto;font-weight:bold;white-space:nowrap;';
2060+
2061+
showhide('ScriptUpdateNotice',true);
2062+
}
2063+
else
2064+
{ showhide('ScriptUpdateNotice',false); }
20572065
}
20582066
20592067
/**----------------------------------------**/
@@ -2284,25 +2292,26 @@ function Uninstall()
22842292
document.form.submit();
22852293
}
22862294
2287-
/**---------------------------------------**/
2288-
/** Added by ExtremeFiretop [2025-May-10] **/
2289-
/**---------------------------------------**/
2290-
function UpdateMerlinAUScript ()
2295+
/**----------------------------------------**/
2296+
/** Modified by Martinski W. [2025-May-11] **/
2297+
/**----------------------------------------**/
2298+
function UpdateMerlinAUScript()
22912299
{
22922300
console.log("Initiating MerlinAU script update…");
22932301
22942302
let actionScriptValue;
2295-
let ForceScriptUpdateCheck = document.getElementById('ForceScriptUpdateCheck');
2296-
let ok = confirm(
2297-
ForceScriptUpdateCheck.checked
2298-
? "INSTALL UPDATE: Install MerlinAU script update immediately. Even if current.\n\nContinue?"
2299-
: "VERIFY AND PROMPT: Check for a newer version of MerlinAU and prompt if found. Does NOT install! \n\nContinue?");
2300-
if (!ok) return;
2301-
2302-
if (!ForceScriptUpdateCheck.checked)
2303-
{ actionScriptValue = 'start_MerlinAUupdate'; }
2303+
let forceScriptUpdateCheck = document.getElementById('ForceScriptUpdateCheck');
2304+
2305+
let confirmOK = confirm(
2306+
forceScriptUpdateCheck.checked
2307+
? "INSTALL UPDATE:\nInstall the latest available MerlinAU script update now, even if version is current.\n\nContinue?"
2308+
: "CHECK AND PROMPT:\nCheck for a newer version of MerlinAU and prompt if found. It does NOT install update automatically!\n\nContinue?");
2309+
if (!confirmOK) { return; }
2310+
2311+
if (!forceScriptUpdateCheck.checked)
2312+
{ actionScriptValue = 'start_MerlinAUscrptupdate'; }
23042313
else
2305-
{ actionScriptValue = 'start_MerlinAUupdate_forceupdate'; }
2314+
{ actionScriptValue = 'start_MerlinAUscrptupdate_force'; }
23062315
23072316
document.form.action_script.value = actionScriptValue;
23082317
document.form.action_wait.value = 10;
@@ -2311,7 +2320,7 @@ function UpdateMerlinAUScript ()
23112320
}
23122321
23132322
/**----------------------------------------**/
2314-
/** Modified by Martinski W. [2025-Jan-22] **/
2323+
/** Modified by Martinski W. [2025-May-11] **/
23152324
/**----------------------------------------**/
23162325
function CheckFirmwareUpdate()
23172326
{
@@ -2321,13 +2330,13 @@ function CheckFirmwareUpdate()
23212330
let bypassPostponedDays = document.getElementById('BypassPostponedDays');
23222331
if (!bypassPostponedDays.checked)
23232332
{
2324-
actionScriptValue = 'start_MerlinAUcheckupdate';
2333+
actionScriptValue = 'start_MerlinAUcheckfwupdate';
23252334
if (!confirm("NOTE:\nIf you have no postponement days set or remaining, the firmware may flash NOW!\nThis means logging you out of the WebUI and rebooting the router.\nContinue to check for firmware updates now?"))
23262335
{ return; }
23272336
}
23282337
else
23292338
{
2330-
actionScriptValue = 'start_MerlinAUcheckupdate_bypassDays';
2339+
actionScriptValue = 'start_MerlinAUcheckfwupdate_bypassDays';
23312340
if (!confirm("NOTE:\nThe firmware may flash NOW!\nThis means logging you out of the WebUI and rebooting the router.\nContinue to check for firmware updates now?"))
23322341
{ return; }
23332342
}
@@ -2703,13 +2712,9 @@ function initializeCollapsibleSections()
27032712
name="button">
27042713
<br>
27052714
<label style="color:#FFCC00; margin-top: 5px; margin-bottom:8px">
2706-
<input type="checkbox"
2707-
id="ForceScriptUpdateCheck"
2708-
name="ForceScriptUpdateCheck"
2715+
<input type="checkbox" id="ForceScriptUpdateCheck" name="ForceScriptUpdateCheck"
27092716
style="padding:0; vertical-align:middle; position:relative;
2710-
margin-left:-5px; margin-top:5px; margin-bottom:8px"/>
2711-
Install script update
2712-
</label>
2717+
margin-left:-5px; margin-top:5px; margin-bottom:8px"/>Install script update</label>
27132718
</br>
27142719
</td>
27152720
<td style="text-align: left; border: none;">

MerlinAU.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7-
# Last Modified: 2025-May-10
7+
# Last Modified: 2025-May-11
88
###################################################################
99
set -u
1010

@@ -3007,6 +3007,7 @@ ${REDct}v${SCRIPT_VERSION}${NOct} --> ${GRNct}v${DLRepoVersion}${NOct}"
30073007
fi
30083008
else
30093009
scriptUpdateNotify=0
3010+
_WriteVarDefToHelperJSFile_ "isScriptUpdateAvailable" "TBD"
30103011
fi
30113012
return 0
30123013
}
@@ -10951,9 +10952,9 @@ then
1095110952
_DoExit_ 0
1095210953
fi
1095310954

10954-
##------------------------------------------##
10955-
## Modified by ExtremeFiretop [2025-May-10] ##
10956-
##------------------------------------------##
10955+
##----------------------------------------##
10956+
## Modified by Martinski W. [2025-May-11] ##
10957+
##----------------------------------------##
1095710958
if [ $# -gt 0 ]
1095810959
then
1095910960
if ! _AcquireLock_ cliOptsLock
@@ -11050,23 +11051,23 @@ then
1105011051
Update_Custom_Settings "FW_New_Update_Changelog_Approval" "APPROVED"
1105111052
fi
1105211053
;;
11053-
"${SCRIPT_NAME}checkupdate" | \
11054-
"${SCRIPT_NAME}checkupdate_bypassDays")
11054+
"${SCRIPT_NAME}checkfwupdate" | \
11055+
"${SCRIPT_NAME}checkfwupdate_bypassDays")
1105511056
if _AcquireLock_ cliFileLock
1105611057
then
11057-
if [ "$3" = "${SCRIPT_NAME}checkupdate_bypassDays" ]
11058+
if [ "$3" = "${SCRIPT_NAME}checkfwupdate_bypassDays" ]
1105811059
then bypassPostponedDays=true
1105911060
else bypassPostponedDays=false
1106011061
fi
1106111062
_RunFirmwareUpdateNow_
1106211063
_ReleaseLock_ cliFileLock
1106311064
fi
1106411065
;;
11065-
"${SCRIPT_NAME}update" | \
11066-
"${SCRIPT_NAME}update_forceupdate")
11066+
"${SCRIPT_NAME}scrptupdate" | \
11067+
"${SCRIPT_NAME}scrptupdate_force")
1106711068
if _AcquireLock_ cliFileLock
1106811069
then
11069-
if [ "$3" = "${SCRIPT_NAME}update_forceupdate" ]
11070+
if [ "$3" = "${SCRIPT_NAME}scrptupdate_force" ]
1107011071
then _SCRIPT_UPDATE_ force
1107111072
else _CheckForNewScriptUpdates_
1107211073
fi

0 commit comments

Comments
 (0)