Skip to content

Commit cece920

Browse files
Merge pull request #475 from ExtremeFiretop/Patch-WebUI
Patch WebUI
2 parents 470c596 + 81a080b commit cece920

File tree

4 files changed

+124
-61
lines changed

4 files changed

+124
-61
lines changed

MerlinAU.asp

Lines changed: 111 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -857,64 +857,93 @@ function FetchChangelog(startTime)
857857
});
858858
}
859859
860+
/**------------------------------------------**/
861+
/** Modified by ExtremeFiretop [2025-May-18] **/
862+
/**------------------------------------------**/
860863
function ShowLatestChangelog(e)
861864
{
862865
if (e) e.preventDefault();
863866
864-
let loadingMessage = '<p>Please wait and allow up to 10 seconds for the changelog to load.<br>' +
865-
'Click on "Cancel" button to stop and exit this dialog.</p>';
867+
const loadingMessage =
868+
'<p>Please wait and allow up to 10 seconds for the changelog to load.<br>' +
869+
'Click on "Cancel" button to stop and exit this dialog.</p>';
866870
867-
if ($('#changelogModal').length)
868-
{
869-
$('#changelogData').html(loadingMessage);
870-
$('#closeChangelogModal').text("Cancel");
871-
}
872-
else
873-
{ // Create modal overlay if it doesn't exist //
871+
/* ----- build the modal once ----- */
872+
if (!$('#changelogModal').length) {
874873
$('body').append(
875-
'<div id="changelogModal" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; ' +
876-
'background:rgba(0,0,0,0.8); z-index:10000;">' +
877-
'<div id="changelogContent" style="position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); ' +
878-
'background:#fff; color:#000; padding:20px; max-height:90%; overflow:auto; width:80%; max-width:800px;">' +
879-
'<h2 style="margin-top:0; color:#000;">Latest Changelog</h2>' +
880-
'<button id="closeChangelogModal" style="float:right; font-size:14px; cursor:pointer;">Cancel</button>' +
881-
'<div id="changelogData" style="font-family:monospace; white-space:pre-wrap; margin-top:10px; color:#000;">' +
874+
'<div id="changelogModal" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;' +
875+
'background:rgba(0,0,0,0.8);z-index:10000;">' +
876+
'<div id="changelogContent" style="position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);' +
877+
'background:#fff;color:#000;padding:20px;max-height:90%;overflow:auto;width:80%;max-width:800px;">' +
878+
'<h2 style="margin-top:0;color:#000;">Latest Changelog</h2>' +
879+
'<button id="closeChangelogModal" style="float:right;font-size:14px;cursor:pointer;">Cancel</button>' +
880+
'<div id="changelogData" style="font-family:monospace;white-space:pre-wrap;margin-top:10px;color:#000;">' +
882881
loadingMessage +
883882
'</div>' +
884883
'</div>' +
885884
'</div>'
886885
);
887-
$('#closeChangelogModal').on('click', function(){
886+
887+
/* close button */
888+
$('#closeChangelogModal').on('click', function () {
888889
$('#changelogModal').hide();
889890
});
891+
892+
/* ---------- NEW: arrow‑key scroll handler (bind once) ---------- */
893+
$(document).on('keydown', function (ev) {
894+
if (!$('#changelogModal').is(':visible')) return; // ignore if dialog not open
895+
const box = $('#changelogContent')[0]; // the scrollable div
896+
switch (ev.key) {
897+
case 'ArrowDown':
898+
box.scrollTop += 40;
899+
ev.preventDefault();
900+
break;
901+
case 'ArrowUp':
902+
box.scrollTop -= 40;
903+
ev.preventDefault();
904+
break;
905+
case 'ArrowRight':
906+
box.scrollTop += 40;
907+
ev.preventDefault();
908+
break;
909+
case 'ArrowLeft':
910+
box.scrollTop -= 40;
911+
ev.preventDefault();
912+
break;
913+
default:
914+
break;
915+
}
916+
});
917+
/* -------------------------------------------------------------- */
918+
} else {
919+
$('#changelogData').html(loadingMessage);
920+
$('#closeChangelogModal').text("Cancel");
890921
}
891922
892923
$('#changelogModal').show();
893924
894-
// Trigger the backend shell script via form submission //
895-
var formData = $('form[name="form"]').serializeArray();
925+
/* ---------- NEW: focusable + give it focus ---------- */
926+
$('#changelogContent').attr('tabindex', 0).focus();
927+
/* ---------------------------------------------------- */
928+
929+
/* kick the backend */
930+
const formData = $('form[name="form"]').serializeArray();
896931
formData.push({ name: "action_script", value: "start_MerlinAUdownloadchangelog" });
897-
formData.push({ name: "action_wait", value: "10" });
898-
899-
$.post('start_apply.htm', formData)
900-
.done(function(response) {
901-
console.log("Changelog trigger submitted successfully.");
902-
})
903-
.fail(function() {
904-
console.error("Failed to submit changelog trigger.");
905-
});
906-
907-
// Record the start time and wait 8 seconds before attempting to fetch the changelog //
908-
var startTime = new Date().getTime();
909-
setTimeout(function() {
910-
FetchChangelog(startTime);
911-
// Once the changelog has loaded, update the button text to "Close"
912-
$('#closeChangelogModal').text("Close");
932+
formData.push({ name: "action_wait", value: "10" });
933+
934+
$.post('start_apply.htm', formData);
935+
936+
/* wait 8 s, then fetch the changelog */
937+
const startTime = Date.now();
938+
setTimeout(function () {
939+
FetchChangelog(startTime);
940+
$('#closeChangelogModal').text("Close");
913941
}, 8000);
914942
915943
return false;
916944
}
917945
946+
918947
// **Control "Approve/Block Changelog" Checkbox State** //
919948
function ToggleChangelogApproval (checkboxElem)
920949
{
@@ -1544,9 +1573,9 @@ function BlockChangelog()
15441573
document.form.submit();
15451574
}
15461575
1547-
/**----------------------------------------**/
1548-
/** Modified by Martinski W. [2025-Mar-07] **/
1549-
/**----------------------------------------**/
1576+
/**------------------------------------------**/
1577+
/** Modified by ExtremeFiretop [2025-May-18] **/
1578+
/**------------------------------------------**/
15501579
function InitializeFields()
15511580
{
15521581
console.log("Initializing fields...");
@@ -1642,7 +1671,9 @@ function InitializeFields()
16421671
{ tailscaleVPNEnabled.checked = (custom_settings.Allow_Updates_OverVPN === 'ENABLED'); }
16431672
16441673
if (script_AutoUpdate_Check)
1645-
{ script_AutoUpdate_Check.checked = (custom_settings.Allow_Script_Auto_Update === 'ENABLED'); }
1674+
{ script_AutoUpdate_Check.checked = (custom_settings.Allow_Script_Auto_Update === 'ENABLED');
1675+
UpdateForceScriptCheckboxState(script_AutoUpdate_Check?.checked);
1676+
}
16461677
16471678
if (betaToReleaseUpdatesEnabled)
16481679
{ betaToReleaseUpdatesEnabled.checked = (custom_settings.FW_Allow_Beta_Production_Up === 'ENABLED'); }
@@ -2292,29 +2323,55 @@ function Uninstall()
22922323
document.form.submit();
22932324
}
22942325
2295-
/**----------------------------------------**/
2296-
/** Modified by Martinski W. [2025-May-11] **/
2297-
/**----------------------------------------**/
2326+
/**---------------------------------------**/
2327+
/** Added by ExtremeFiretop [2025-May-18] **/
2328+
/**---------------------------------------**/
2329+
function UpdateForceScriptCheckboxState(autoUpdatesEnabled) {
2330+
const forceCB = document.getElementById('ForceScriptUpdateCheck');
2331+
if (!forceCB) return; // safety
2332+
forceCB.disabled = autoUpdatesEnabled; // gray‑out logic
2333+
forceCB.style.opacity = autoUpdatesEnabled ? '0.5' : '1';
2334+
if (autoUpdatesEnabled) forceCB.checked = false; // clear if now disabled
2335+
}
2336+
2337+
/**------------------------------------------**/
2338+
/** Modified by ExtremeFiretop [2025-May-18] **/
2339+
/**------------------------------------------**/
22982340
function UpdateMerlinAUScript()
22992341
{
23002342
console.log("Initiating MerlinAU script update…");
23012343
23022344
let actionScriptValue;
2303-
let forceScriptUpdateCheck = document.getElementById('ForceScriptUpdateCheck');
2345+
const forceScriptUpdateCheck = document.getElementById('ForceScriptUpdateCheck');
2346+
const autoUpdatesEnabled = document.getElementById('Script_AutoUpdate_Check')?.checked;
2347+
2348+
/* ----- build the appropriate confirmation text ----- */
2349+
let confirmText;
2350+
if (forceScriptUpdateCheck.checked) {
2351+
/* user explicitly wants to install right now */
2352+
confirmText = "INSTALL UPDATE:\n" +
2353+
"Install the latest available MerlinAU script update now, " +
2354+
"even if the version is already current.\n\nContinue?";
2355+
} else {
2356+
/* normal check – message depends on auto‑update setting */
2357+
confirmText = "CHECK AND PROMPT:\n" +
2358+
"Check for a newer version of MerlinAU and prompt if found. " +
2359+
(autoUpdatesEnabled
2360+
? "It DOES install automatically!" // <‑‑ NEW text
2361+
: "It does NOT install update automatically!") +
2362+
"\n\nContinue?";
2363+
}
23042364
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; }
2365+
if (!confirm(confirmText)) return; /* user cancelled */
23102366
2311-
if (!forceScriptUpdateCheck.checked)
2312-
{ actionScriptValue = 'start_MerlinAUscrptupdate'; }
2313-
else
2314-
{ actionScriptValue = 'start_MerlinAUscrptupdate_force'; }
2367+
/* choose action script */
2368+
actionScriptValue = forceScriptUpdateCheck.checked
2369+
? 'start_MerlinAUscrptupdate_force'
2370+
: 'start_MerlinAUscrptupdate';
23152371
2372+
/* submit the form */
23162373
document.form.action_script.value = actionScriptValue;
2317-
document.form.action_wait.value = 10;
2374+
document.form.action_wait.value = 10;
23182375
showLoading();
23192376
document.form.submit();
23202377
}
@@ -2944,7 +3001,7 @@ function initializeCollapsibleSections()
29443001
</label>
29453002
</td>
29463003
<td>
2947-
<input type="checkbox" id="Script_AutoUpdate_Check" name="Script_AutoUpdate_Check"/>
3004+
<input type="checkbox" id="Script_AutoUpdate_Check" name="Script_AutoUpdate_Check" onchange="UpdateForceScriptCheckboxState(this.checked)"/>
29483005
<span id="Script_AutoUpdate_SchedText" name="Script_AutoUpdate_SchedText"
29493006
style="vertical-align:bottom; margin-left:15px; display:none; font-size: 12px; font-weight: bolder;"></span>
29503007
</td>

MerlinAU.sh

Lines changed: 9 additions & 3 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-17
7+
# Last Modified: 2025-May-18
88
###################################################################
99
set -u
1010

1111
## Set version for each Production Release ##
12-
readonly SCRIPT_VERSION=1.4.6
12+
readonly SCRIPT_VERSION=1.4.7
1313
readonly SCRIPT_NAME="MerlinAU"
1414
## Set to "master" for Production Releases ##
1515
SCRIPT_BRANCH="dev"
@@ -7419,7 +7419,7 @@ _ChangelogVerificationCheck_()
74197419
}
74207420

74217421
##------------------------------------------##
7422-
## Modified by ExtremeFiretop [2025-Apr-11] ##
7422+
## Modified by ExtremeFiretop [2025-May-18] ##
74237423
##------------------------------------------##
74247424
_ManageChangelogMerlin_()
74257425
{
@@ -7464,6 +7464,12 @@ _ManageChangelogMerlin_()
74647464
fi
74657465
fi
74667466

7467+
# force 3006 changelog if tag is NG but $2 says 3006
7468+
if [ "$changeLogTag" = "NG" ] && [ $# -gt 1 ] && echo "$2" | grep -qE '^3006[.]' ; then
7469+
changeLogTag="3006"
7470+
MerlinChangeLogURL="${CL_URL_3006}"
7471+
fi
7472+
74677473
wgetLogFile="${FW_BIN_DIR}/${ScriptFNameTag}.WGET.LOG"
74687474
changeLogFile="${FW_BIN_DIR}/Changelog-${changeLogTag}.txt"
74697475

README.md

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

55
## WebUI:
66
![image](https://github.com/user-attachments/assets/a2197262-ca35-451a-8645-311896e1495e)
@@ -136,7 +136,7 @@ Use your preferred SSH client to connect to the router.
136136
*Manual Installation*
137137
1. To Download the script to your router, Copy and paste:
138138
```bash
139-
curl --retry 3 "https://raw.githubusercontent.com/ExtremeFiretop/MerlinAutoUpdate-Router/master/MerlinAU.sh" -o "/jffs/scripts/MerlinAU.sh" && chmod +x "/jffs/scripts/MerlinAU.sh"
139+
curl --retry 3 "https://raw.githubusercontent.com/ExtremeFiretop/MerlinAutoUpdate-Router/master/MerlinAU.sh" -o "/jffs/scripts/MerlinAU.sh" && chmod +x "/jffs/scripts/MerlinAU.sh && sh /jffs/scripts/MerlinAU.sh install"
140140
```
141141
- The script is now ready for use!
142142

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.6
1+
1.4.7

0 commit comments

Comments
 (0)