Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 50 additions & 45 deletions MerlinAU.asp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<script language="JavaScript" type="text/javascript">

/**----------------------------**/
/** Last Modified: 2025-May-10 **/
/** Last Modified: 2025-May-11 **/
/**----------------------------**/

// Separate variables for shared and AJAX settings //
Expand Down Expand Up @@ -988,7 +988,7 @@ function GetExternalCheckResults()
if (externalCheckOK)
{
fwUpdateDirPath.ResetExtCheckVars();
showScriptUpdateBanner();
ShowScriptUpdateBanner();
return true;
}
let fwUpdateZIPdirectory = document.getElementById('fwUpdateZIPDirectory');
Expand Down Expand Up @@ -2034,26 +2034,34 @@ function UpdateScriptVersion()
$('#footerTitle').text ('MerlinAU v' + localVers + ' by ExtremeFiretop & Martinski W.');
}

/**---------------------------------------**/
/** Added by ExtremeFiretop [2025-May-10] **/
/**---------------------------------------**/
function showScriptUpdateBanner () {
const localVers = GetScriptVersion('local');
if (typeof isScriptUpdateAvailable === 'undefined') return;

if (isScriptUpdateAvailable && isScriptUpdateAvailable !== localVers) {
const host = document.getElementById('ScriptUpdateNotice');
if (!host) return;

host.innerHTML =
InvREDct +
'Script&nbsp;Update&nbsp;Available&nbsp;&rarr;&nbsp;v' +
isScriptUpdateAvailable +
InvCLEAR;

host.style.cssText =
'float:right;margin-left:auto;font-weight:bold;white-space:nowrap;';
}
/**----------------------------------------**/
/** Modified by Martinski W. [2025-May-11] **/
/**----------------------------------------**/
function ShowScriptUpdateBanner()
{
const localVers = GetScriptVersion('local');
const updateNotice = document.getElementById('ScriptUpdateNotice');

if (updateNotice === null ||
typeof updateNotice === 'undefined' ||
typeof isScriptUpdateAvailable === 'undefined')
{ return; }

if (isScriptUpdateAvailable !== 'TBD' &&
isScriptUpdateAvailable !== localVers)
{
updateNotice.innerHTML =
InvREDct +
'Script Update Available &rarr; v' + isScriptUpdateAvailable +
InvCLEAR;

updateNotice.style.cssText =
'float:right;margin-left:auto;font-weight:bold;white-space:nowrap;';

showhide('ScriptUpdateNotice',true);
}
else
{ showhide('ScriptUpdateNotice',false); }
}

/**----------------------------------------**/
Expand Down Expand Up @@ -2284,25 +2292,26 @@ function Uninstall()
document.form.submit();
}

/**---------------------------------------**/
/** Added by ExtremeFiretop [2025-May-10] **/
/**---------------------------------------**/
function UpdateMerlinAUScript ()
/**----------------------------------------**/
/** Modified by Martinski W. [2025-May-11] **/
/**----------------------------------------**/
function UpdateMerlinAUScript()
{
console.log("Initiating MerlinAU script update…");

let actionScriptValue;
let ForceScriptUpdateCheck = document.getElementById('ForceScriptUpdateCheck');
let ok = confirm(
ForceScriptUpdateCheck.checked
? "INSTALL UPDATE: Install MerlinAU script update immediately. Even if current.\n\nContinue?"
: "VERIFY AND PROMPT: Check for a newer version of MerlinAU and prompt if found. Does NOT install! \n\nContinue?");
if (!ok) return;

if (!ForceScriptUpdateCheck.checked)
{ actionScriptValue = 'start_MerlinAUupdate'; }
let forceScriptUpdateCheck = document.getElementById('ForceScriptUpdateCheck');

let confirmOK = confirm(
forceScriptUpdateCheck.checked
? "INSTALL UPDATE:\nInstall the latest available MerlinAU script update now, even if version is current.\n\nContinue?"
: "CHECK AND PROMPT:\nCheck for a newer version of MerlinAU and prompt if found. It does NOT install update automatically!\n\nContinue?");
if (!confirmOK) { return; }

if (!forceScriptUpdateCheck.checked)
{ actionScriptValue = 'start_MerlinAUscrptupdate'; }
else
{ actionScriptValue = 'start_MerlinAUupdate_forceupdate'; }
{ actionScriptValue = 'start_MerlinAUscrptupdate_force'; }

document.form.action_script.value = actionScriptValue;
document.form.action_wait.value = 10;
Expand All @@ -2311,7 +2320,7 @@ function UpdateMerlinAUScript ()
}

/**----------------------------------------**/
/** Modified by Martinski W. [2025-Jan-22] **/
/** Modified by Martinski W. [2025-May-11] **/
/**----------------------------------------**/
function CheckFirmwareUpdate()
{
Expand All @@ -2321,13 +2330,13 @@ function CheckFirmwareUpdate()
let bypassPostponedDays = document.getElementById('BypassPostponedDays');
if (!bypassPostponedDays.checked)
{
actionScriptValue = 'start_MerlinAUcheckupdate';
actionScriptValue = 'start_MerlinAUcheckfwupdate';
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?"))
{ return; }
}
else
{
actionScriptValue = 'start_MerlinAUcheckupdate_bypassDays';
actionScriptValue = 'start_MerlinAUcheckfwupdate_bypassDays';
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?"))
{ return; }
}
Expand Down Expand Up @@ -2703,13 +2712,9 @@ function initializeCollapsibleSections()
name="button">
<br>
<label style="color:#FFCC00; margin-top: 5px; margin-bottom:8px">
<input type="checkbox"
id="ForceScriptUpdateCheck"
name="ForceScriptUpdateCheck"
<input type="checkbox" id="ForceScriptUpdateCheck" name="ForceScriptUpdateCheck"
style="padding:0; vertical-align:middle; position:relative;
margin-left:-5px; margin-top:5px; margin-bottom:8px"/>
Install script update
</label>
margin-left:-5px; margin-top:5px; margin-bottom:8px"/>Install script update</label>
</br>
</td>
<td style="text-align: left; border: none;">
Expand Down
21 changes: 11 additions & 10 deletions MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
# Last Modified: 2025-May-10
# Last Modified: 2025-May-11
###################################################################
set -u

Expand Down Expand Up @@ -3007,6 +3007,7 @@ ${REDct}v${SCRIPT_VERSION}${NOct} --> ${GRNct}v${DLRepoVersion}${NOct}"
fi
else
scriptUpdateNotify=0
_WriteVarDefToHelperJSFile_ "isScriptUpdateAvailable" "TBD"
fi
return 0
}
Expand Down Expand Up @@ -10951,9 +10952,9 @@ then
_DoExit_ 0
fi

##------------------------------------------##
## Modified by ExtremeFiretop [2025-May-10] ##
##------------------------------------------##
##----------------------------------------##
## Modified by Martinski W. [2025-May-11] ##
##----------------------------------------##
if [ $# -gt 0 ]
then
if ! _AcquireLock_ cliOptsLock
Expand Down Expand Up @@ -11050,23 +11051,23 @@ then
Update_Custom_Settings "FW_New_Update_Changelog_Approval" "APPROVED"
fi
;;
"${SCRIPT_NAME}checkupdate" | \
"${SCRIPT_NAME}checkupdate_bypassDays")
"${SCRIPT_NAME}checkfwupdate" | \
"${SCRIPT_NAME}checkfwupdate_bypassDays")
if _AcquireLock_ cliFileLock
then
if [ "$3" = "${SCRIPT_NAME}checkupdate_bypassDays" ]
if [ "$3" = "${SCRIPT_NAME}checkfwupdate_bypassDays" ]
then bypassPostponedDays=true
else bypassPostponedDays=false
fi
_RunFirmwareUpdateNow_
_ReleaseLock_ cliFileLock
fi
;;
"${SCRIPT_NAME}update" | \
"${SCRIPT_NAME}update_forceupdate")
"${SCRIPT_NAME}scrptupdate" | \
"${SCRIPT_NAME}scrptupdate_force")
if _AcquireLock_ cliFileLock
then
if [ "$3" = "${SCRIPT_NAME}update_forceupdate" ]
if [ "$3" = "${SCRIPT_NAME}scrptupdate_force" ]
then _SCRIPT_UPDATE_ force
else _CheckForNewScriptUpdates_
fi
Expand Down