Skip to content

Commit d3ca507

Browse files
Merge pull request #422 from Martinski4GitHub/dev
Minor Cleanup
2 parents 4431038 + 6445da5 commit d3ca507

File tree

3 files changed

+54
-50
lines changed

3 files changed

+54
-50
lines changed

MerlinAU.asp

Lines changed: 41 additions & 37 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-Mar-07 **/
32+
/** Last Modified: 2025-Mar-10 **/
3333
/** Intended for 1.4.x Release **/
3434
/**----------------------------**/
3535
@@ -796,14 +796,16 @@ const fwUpdateDirPath =
796796
}
797797
};
798798
799-
function ShowLatestChangelog() {
799+
function ShowLatestChangelog()
800+
{
800801
document.form.action_script.value = 'start_MerlinAUdownloadchangelog';
801802
document.form.action_wait.value = 10;
802803
803-
// Open popup **before** form submission to avoid browser popup blocking
804+
// Open popup **before** form submission to avoid browser popup blocking //
804805
var changelogWindow = window.open("", "ChangelogPopup", "width=800,height=600,scrollbars=1,resizable=1");
805806
806-
if (!changelogWindow) {
807+
if (!changelogWindow)
808+
{
807809
alert("Popup blocked! Please allow popups for this site to view the changelog.");
808810
return;
809811
}
@@ -815,19 +817,21 @@ function ShowLatestChangelog() {
815817
changelogWindow.document.write("</body></html>");
816818
changelogWindow.document.close();
817819
818-
// Now submit the form (which might trigger a page refresh)
820+
// Now submit the form (which might trigger a page refresh) //
819821
showLoading();
820822
document.form.submit();
821823
822-
// Delay the AJAX request slightly (but make sure it runs before page refresh)
824+
// Delay the AJAX request slightly (but make sure it runs before page refresh) //
823825
setTimeout(function() {
824826
$.ajax({
825827
url: '/ext/MerlinAU/changelog.htm',
826828
dataType: 'text',
827829
timeout: 9000,
828-
success: function(data) {
829-
// Ensure the popup is still open before modifying it
830-
if (changelogWindow && !changelogWindow.closed) {
830+
success: function(data)
831+
{
832+
// Ensure the popup is still open before modifying it //
833+
if (changelogWindow && !changelogWindow.closed)
834+
{
831835
changelogWindow.document.open();
832836
changelogWindow.document.write("<html><head><title>Latest Changelog</title></head>");
833837
changelogWindow.document.write("<body style='font-family:monospace; white-space:pre-wrap;'>");
@@ -836,8 +840,10 @@ function ShowLatestChangelog() {
836840
changelogWindow.document.close();
837841
}
838842
},
839-
error: function() {
840-
if (changelogWindow && !changelogWindow.closed) {
843+
error: function()
844+
{
845+
if (changelogWindow && !changelogWindow.closed)
846+
{
841847
changelogWindow.document.open();
842848
changelogWindow.document.write("<html><head><title>Changelog Error</title></head>");
843849
changelogWindow.document.write("<body style='font-family:monospace; white-space:pre-wrap;'>");
@@ -847,24 +853,25 @@ function ShowLatestChangelog() {
847853
}
848854
}
849855
});
850-
}, 8000); // Delay slightly to allow form processing, but not too much
856+
}, 8000); // Delay slightly to allow form processing, but not too much //
851857
}
852858
853859
// **Control "Approve/Block Changelog" Checkbox State** //
854-
function ToggleChangelogApproval(checkboxElem) {
855-
if (checkboxElem.checked) {
856-
// They are approving
857-
if (!confirm(approveChangelogMsge)) {
858-
// If user cancels at the confirm prompt, revert checkbox
860+
function ToggleChangelogApproval (checkboxElem)
861+
{
862+
if (checkboxElem.checked)
863+
{ // Approving //
864+
if (!confirm(approveChangelogMsge))
865+
{
859866
checkboxElem.checked = false;
860867
return;
861868
}
862869
ApproveChangelog();
863870
}
864-
else {
865-
// They are blocking
866-
if (!confirm(blockChangelogMsge)) {
867-
// If user cancels at the confirm prompt, revert checkbox
871+
else
872+
{ // Blocking //
873+
if (!confirm(blockChangelogMsge))
874+
{
868875
checkboxElem.checked = true;
869876
return;
870877
}
@@ -1650,8 +1657,7 @@ function InitializeFields()
16501657
{ fwUpdateEstimatedRunDateElement.innerHTML = InvYLWct + "TBD" + InvCLEAR; }
16511658
}
16521659
1653-
// **Handle Changelog Approval Display** //
1654-
// Now we handle the new Approve Changelog checkbox
1660+
// Handle Changelog Approval //
16551661
var changelogApprovalElement = document.getElementById('changelogApproval');
16561662
if (changelogApprovalElement)
16571663
{ // Default to "Disabled" if missing //
@@ -1660,26 +1666,24 @@ function InitializeFields()
16601666
}
16611667
16621668
var approveChangelogCheck = document.getElementById('approveChangelogCheck');
1663-
if (approveChangelogCheck) {
1669+
if (approveChangelogCheck)
1670+
{ // "APPROVED" or "BLOCKED" //
16641671
var isChangelogCheckEnabled = (custom_settings.CheckChangeLog === 'ENABLED');
1665-
var approvalValue = custom_settings.FW_New_Update_Changelog_Approval; // e.g. "APPROVED" or "BLOCKED"
1672+
var approvalValue = custom_settings.FW_New_Update_Changelog_Approval;
16661673
1667-
// If Changelog Check is disabled, also disable our checkbox
1668-
if (!isChangelogCheckEnabled || !approvalValue || approvalValue === 'TBD') {
1674+
// If Changelog Check is disabled, also disable checkbox //
1675+
if (!isChangelogCheckEnabled || !approvalValue || approvalValue === 'TBD')
1676+
{
16691677
approveChangelogCheck.disabled = true;
16701678
approveChangelogCheck.checked = false;
16711679
}
1672-
else {
1680+
else
1681+
{
16731682
approveChangelogCheck.disabled = false;
1674-
1675-
// If the stored approval is "APPROVED", default to checked
1676-
if (approvalValue === 'APPROVED') {
1677-
approveChangelogCheck.checked = true;
1678-
}
1679-
// Otherwise, set as unchecked for "BLOCKED," "Disabled," etc.
1680-
else {
1681-
approveChangelogCheck.checked = false;
1682-
}
1683+
if (approvalValue === 'APPROVED')
1684+
{ approveChangelogCheck.checked = true; }
1685+
else
1686+
{ approveChangelogCheck.checked = false; }
16831687
}
16841688
}
16851689

MerlinAU.sh

Lines changed: 12 additions & 12 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-Mar-07
7+
# Last Modified: 2025-Mar-10
88
###################################################################
99
set -u
1010

@@ -2545,7 +2545,7 @@ _UpdateConfigFromWebUISettings_()
25452545
{ sleep 15 ; _UpdateHelperJSFile_ "$extCheckALLvarID" "true" ; } &
25462546
fi
25472547

2548-
// Do this ONLY IF requested by user //
2548+
## Do this ONLY IF requested by user ##
25492549
"$doRouterLoginTest" && _TestLoginCredentials_
25502550
else
25512551
Say "No updated settings from WebUI found. No merge into $CONFIG_FILE necessary."
@@ -7185,9 +7185,9 @@ _ManageChangelogMerlin_()
71857185
"$inMenuMode" && _WaitForEnterKey_ "$logsMenuReturnPromptStr"
71867186
fi
71877187
fi
7188-
cp -fp "$changeLogFile" "${SETTINGS_DIR}/changelog.txt"
7188+
cp -fp "$changeLogFile" "$CHANGELOG_PATH"
71897189
rm -f "$changeLogFile" "$wgetLogFile"
7190-
ln -sf "${SETTINGS_DIR}/changelog.txt" "${SCRIPT_WEB_DIR}/changelog.htm" 2>/dev/null
7190+
ln -sf "$CHANGELOG_PATH" "${SCRIPT_WEB_DIR}/changelog.htm" 2>/dev/null
71917191
return 0
71927192
}
71937193

@@ -7245,10 +7245,10 @@ _ManageChangelogGnuton_()
72457245
less "$FW_Changelog_GITHUB"
72467246
fi
72477247
fi
7248-
cp -fp "$changeLogFile" "${SETTINGS_DIR}/changelog.txt"
7248+
cp -fp "$changeLogFile" "$CHANGELOG_PATH"
72497249
rm -f "$FW_Changelog_GITHUB" "$wgetLogFile"
7250-
ln -sf "${SETTINGS_DIR}/changelog.txt" "${SCRIPT_WEB_DIR}/changelog.htm" 2>/dev/null
7251-
return 1
7250+
ln -sf "$CHANGELOG_PATH" "${SCRIPT_WEB_DIR}/changelog.htm" 2>/dev/null
7251+
return 0
72527252
}
72537253

72547254
##----------------------------------------##
@@ -10657,11 +10657,11 @@ then
1065710657
sleep 1
1065810658
;;
1065910659
"${SCRIPT_NAME}downloadchangelog")
10660-
if "$isGNUtonFW"
10661-
then
10662-
_ManageChangelogGnuton_ "webuidownload"
10663-
else
10664-
_ManageChangelogMerlin_ "webuidownload"
10660+
if "$isGNUtonFW"
10661+
then
10662+
_ManageChangelogGnuton_ "webuidownload"
10663+
else
10664+
_ManageChangelogMerlin_ "webuidownload"
1066510665
fi
1066610666
;;
1066710667
"${SCRIPT_NAME}approvechangelog")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
22
## v1.4.0
3-
## 2025-Mar-08
3+
## 2025-Mar-10
44

55
## WebUI:
66
![image](https://github.com/user-attachments/assets/10d0971c-b3c6-477a-8904-d4bf013f72df)

0 commit comments

Comments
 (0)