Skip to content

Commit f2d26da

Browse files
Merge pull request #468 from ExtremeFiretop/ExtremeFiretop-WebUIChanges
Include Update Button for Script in WebUI
2 parents 8ab3c5a + 35fc5e3 commit f2d26da

File tree

4 files changed

+98
-15
lines changed

4 files changed

+98
-15
lines changed

MerlinAU.asp

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
<script language="JavaScript" type="text/javascript">
3030
3131
/**----------------------------**/
32-
/** Last Modified: 2025-Apr-09 **/
33-
/** Intended for 1.4.x Release **/
32+
/** Last Modified: 2025-May-10 **/
3433
/**----------------------------**/
3534
3635
// Separate variables for shared and AJAX settings //
@@ -70,6 +69,7 @@ var defaultFWUpdateZIPdirPath = '/home/root';
7069
var isEMailConfigEnabledInAMTM = false;
7170
var scriptAutoUpdateCronSchedHR = 'TBD';
7271
var fwAutoUpdateCheckCronSchedHR = 'TBD';
72+
var isScriptUpdateAvailable = 'TBD';
7373
7474
const validationErrorMsg = 'Validation failed. Please correct invalid value and try again.';
7575
@@ -988,6 +988,7 @@ function GetExternalCheckResults()
988988
if (externalCheckOK)
989989
{
990990
fwUpdateDirPath.ResetExtCheckVars();
991+
showScriptUpdateBanner();
991992
return true;
992993
}
993994
let fwUpdateZIPdirectory = document.getElementById('fwUpdateZIPDirectory');
@@ -1569,6 +1570,7 @@ function InitializeFields()
15691570
// fallback to 'DISABLED' if custom_settings.FW_Update_Check is missing //
15701571
15711572
$('#KeepConfigFile').prop('checked',false);
1573+
$('#ForceScriptUpdateCheck').prop('checked',false);
15721574
$('#BypassPostponedDays').prop('checked',false);
15731575
$('#RunLoginTestOnSave').prop('checked',false);
15741576
@@ -2032,6 +2034,28 @@ function UpdateScriptVersion()
20322034
$('#footerTitle').text ('MerlinAU v' + localVers + ' by ExtremeFiretop & Martinski W.');
20332035
}
20342036
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+
}
2057+
}
2058+
20352059
/**----------------------------------------**/
20362060
/** Modified by Martinski W. [2025-Jan-20] **/
20372061
/**----------------------------------------**/
@@ -2260,6 +2284,32 @@ function Uninstall()
22602284
document.form.submit();
22612285
}
22622286
2287+
/**---------------------------------------**/
2288+
/** Added by ExtremeFiretop [2025-May-10] **/
2289+
/**---------------------------------------**/
2290+
function UpdateMerlinAUScript ()
2291+
{
2292+
console.log("Initiating MerlinAU script update…");
2293+
2294+
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'; }
2304+
else
2305+
{ actionScriptValue = 'start_MerlinAUupdate_forceupdate'; }
2306+
2307+
document.form.action_script.value = actionScriptValue;
2308+
document.form.action_wait.value = 10;
2309+
showLoading();
2310+
document.form.submit();
2311+
}
2312+
22632313
/**----------------------------------------**/
22642314
/** Modified by Martinski W. [2025-Jan-22] **/
22652315
/**----------------------------------------**/
@@ -2509,6 +2559,7 @@ function initializeCollapsibleSections()
25092559
href="https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/wiki"
25102560
title="Go to MerlinAU Wiki page" target="_blank">Wiki</a> ]
25112561
</span>
2562+
<span id="ScriptUpdateNotice"></span>
25122563
</div>
25132564
<div style="line-height:10px;">&nbsp;</div>
25142565
@@ -2618,9 +2669,10 @@ function initializeCollapsibleSections()
26182669
<div style="text-align: center; margin-top: 3px;">
26192670
<table width="100%" border="0" cellpadding="10" cellspacing="0" style="table-layout: fixed; border-collapse: collapse; background-color: transparent;">
26202671
<colgroup>
2621-
<col style="width: 33%;" />
2622-
<col style="width: 33%;" />
2623-
<col style="width: 33%;" />
2672+
<col style="width: 25%;" />
2673+
<col style="width: 25%;" />
2674+
<col style="width: 25%;" />
2675+
<col style="width: 25%;" />
26242676
</colgroup>
26252677
<tr>
26262678
<td style="text-align: right; border: none;">
@@ -2638,9 +2690,28 @@ function initializeCollapsibleSections()
26382690
<br>
26392691
<label style="color:#FFCC00; margin-top: 5px; margin-bottom:8x">
26402692
<input type="checkbox" id="approveChangelogCheck" name="approveChangelogCheck" onclick="ToggleChangelogApproval(this);"
2641-
style="padding:0; vertical-align:middle; position:relative; margin-left:-5px; margin-top:5px; margin-bottom:8px"/>Approve Changelog</label>
2693+
style="padding:0; vertical-align:middle; position:relative; margin-left:-5px; margin-top:5px; margin-bottom:8px"/>Approve changelog</label>
26422694
</br>
26432695
</td>
2696+
<td style="text-align: center; border: none;" id="scriptUpdateCell">
2697+
<input type="submit"
2698+
id="ScriptUpdateButton"
2699+
onclick="UpdateMerlinAUScript(); return false;"
2700+
value="Script Update Check"
2701+
class="button_gen savebutton"
2702+
title="Check for latest MerlinAU script updates"
2703+
name="button">
2704+
<br>
2705+
<label style="color:#FFCC00; margin-top: 5px; margin-bottom:8px">
2706+
<input type="checkbox"
2707+
id="ForceScriptUpdateCheck"
2708+
name="ForceScriptUpdateCheck"
2709+
style="padding:0; vertical-align:middle; position:relative;
2710+
margin-left:-5px; margin-top:5px; margin-bottom:8px"/>
2711+
Install script update
2712+
</label>
2713+
</br>
2714+
</td>
26442715
<td style="text-align: left; border: none;">
26452716
<input type="submit" id="UninstallButton" onclick="Uninstall(); return false;"
26462717
value="Uninstall" class="button_gen savebutton" name="button">

MerlinAU.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
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-05
7+
# Last Modified: 2025-May-10
88
###################################################################
99
set -u
1010

1111
## Set version for each Production Release ##
12-
readonly SCRIPT_VERSION=1.4.4
12+
readonly SCRIPT_VERSION=1.4.5
1313
readonly SCRIPT_NAME="MerlinAU"
1414
## Set to "master" for Production Releases ##
1515
SCRIPT_BRANCH="dev"
@@ -2947,7 +2947,7 @@ _SCRIPT_UPDATE_()
29472947
}
29482948

29492949
##------------------------------------------##
2950-
## Modified by ExtremeFiretop [2025-Apr-14] ##
2950+
## Modified by ExtremeFiretop [2025-May-10] ##
29512951
##------------------------------------------##
29522952
_CheckForNewScriptUpdates_()
29532953
{
@@ -2996,6 +2996,7 @@ _CheckForNewScriptUpdates_()
29962996
then
29972997
scriptUpdateNotify="New script update available.
29982998
${REDct}v${SCRIPT_VERSION}${NOct} --> ${GRNct}v${DLRepoVersion}${NOct}"
2999+
_WriteVarDefToHelperJSFile_ "isScriptUpdateAvailable" "$DLRepoVersion"
29993000
if [ $# -gt 0 ] && [ "$1" = "-quietcheck" ]
30003001
then return 0
30013002
fi
@@ -10950,9 +10951,9 @@ then
1095010951
_DoExit_ 0
1095110952
fi
1095210953

10953-
##----------------------------------------##
10954-
## Modified by Martinski W. [2025-Feb-15] ##
10955-
##----------------------------------------##
10954+
##------------------------------------------##
10955+
## Modified by ExtremeFiretop [2025-May-10] ##
10956+
##------------------------------------------##
1095610957
if [ $# -gt 0 ]
1095710958
then
1095810959
if ! _AcquireLock_ cliOptsLock
@@ -11061,6 +11062,17 @@ then
1106111062
_ReleaseLock_ cliFileLock
1106211063
fi
1106311064
;;
11065+
"${SCRIPT_NAME}update" | \
11066+
"${SCRIPT_NAME}update_forceupdate")
11067+
if _AcquireLock_ cliFileLock
11068+
then
11069+
if [ "$3" = "${SCRIPT_NAME}update_forceupdate" ]
11070+
then _SCRIPT_UPDATE_ force
11071+
else _CheckForNewScriptUpdates_
11072+
fi
11073+
_ReleaseLock_ cliFileLock
11074+
fi
11075+
;;
1106411076
"${SCRIPT_NAME}config" | \
1106511077
"${SCRIPT_NAME}config_runLoginTest")
1106611078
if _AcquireLock_ cliFileLock

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
2-
## v1.4.4
3-
## 2025-May-08
2+
## v1.4.5
3+
## 2025-May-?
44

55
## WebUI:
66
![image](https://github.com/user-attachments/assets/a2197262-ca35-451a-8645-311896e1495e)

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.4
1+
1.4.5

0 commit comments

Comments
 (0)