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
78 changes: 41 additions & 37 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-Mar-07 **/
/** Last Modified: 2025-Mar-10 **/
/** Intended for 1.4.x Release **/
/**----------------------------**/

Expand Down Expand Up @@ -796,14 +796,16 @@ const fwUpdateDirPath =
}
};

function ShowLatestChangelog() {
function ShowLatestChangelog()
{
document.form.action_script.value = 'start_MerlinAUdownloadchangelog';
document.form.action_wait.value = 10;

// Open popup **before** form submission to avoid browser popup blocking
// Open popup **before** form submission to avoid browser popup blocking //
var changelogWindow = window.open("", "ChangelogPopup", "width=800,height=600,scrollbars=1,resizable=1");

if (!changelogWindow) {
if (!changelogWindow)
{
alert("Popup blocked! Please allow popups for this site to view the changelog.");
return;
}
Expand All @@ -815,19 +817,21 @@ function ShowLatestChangelog() {
changelogWindow.document.write("</body></html>");
changelogWindow.document.close();

// Now submit the form (which might trigger a page refresh)
// Now submit the form (which might trigger a page refresh) //
showLoading();
document.form.submit();

// Delay the AJAX request slightly (but make sure it runs before page refresh)
// Delay the AJAX request slightly (but make sure it runs before page refresh) //
setTimeout(function() {
$.ajax({
url: '/ext/MerlinAU/changelog.htm',
dataType: 'text',
timeout: 9000,
success: function(data) {
// Ensure the popup is still open before modifying it
if (changelogWindow && !changelogWindow.closed) {
success: function(data)
{
// Ensure the popup is still open before modifying it //
if (changelogWindow && !changelogWindow.closed)
{
changelogWindow.document.open();
changelogWindow.document.write("<html><head><title>Latest Changelog</title></head>");
changelogWindow.document.write("<body style='font-family:monospace; white-space:pre-wrap;'>");
Expand All @@ -836,8 +840,10 @@ function ShowLatestChangelog() {
changelogWindow.document.close();
}
},
error: function() {
if (changelogWindow && !changelogWindow.closed) {
error: function()
{
if (changelogWindow && !changelogWindow.closed)
{
changelogWindow.document.open();
changelogWindow.document.write("<html><head><title>Changelog Error</title></head>");
changelogWindow.document.write("<body style='font-family:monospace; white-space:pre-wrap;'>");
Expand All @@ -847,24 +853,25 @@ function ShowLatestChangelog() {
}
}
});
}, 8000); // Delay slightly to allow form processing, but not too much
}, 8000); // Delay slightly to allow form processing, but not too much //
}

// **Control "Approve/Block Changelog" Checkbox State** //
function ToggleChangelogApproval(checkboxElem) {
if (checkboxElem.checked) {
// They are approving
if (!confirm(approveChangelogMsge)) {
// If user cancels at the confirm prompt, revert checkbox
function ToggleChangelogApproval (checkboxElem)
{
if (checkboxElem.checked)
{ // Approving //
if (!confirm(approveChangelogMsge))
{
checkboxElem.checked = false;
return;
}
ApproveChangelog();
}
else {
// They are blocking
if (!confirm(blockChangelogMsge)) {
// If user cancels at the confirm prompt, revert checkbox
else
{ // Blocking //
if (!confirm(blockChangelogMsge))
{
checkboxElem.checked = true;
return;
}
Expand Down Expand Up @@ -1650,8 +1657,7 @@ function InitializeFields()
{ fwUpdateEstimatedRunDateElement.innerHTML = InvYLWct + "TBD" + InvCLEAR; }
}

// **Handle Changelog Approval Display** //
// Now we handle the new Approve Changelog checkbox
// Handle Changelog Approval //
var changelogApprovalElement = document.getElementById('changelogApproval');
if (changelogApprovalElement)
{ // Default to "Disabled" if missing //
Expand All @@ -1660,26 +1666,24 @@ function InitializeFields()
}

var approveChangelogCheck = document.getElementById('approveChangelogCheck');
if (approveChangelogCheck) {
if (approveChangelogCheck)
{ // "APPROVED" or "BLOCKED" //
var isChangelogCheckEnabled = (custom_settings.CheckChangeLog === 'ENABLED');
var approvalValue = custom_settings.FW_New_Update_Changelog_Approval; // e.g. "APPROVED" or "BLOCKED"
var approvalValue = custom_settings.FW_New_Update_Changelog_Approval;

// If Changelog Check is disabled, also disable our checkbox
if (!isChangelogCheckEnabled || !approvalValue || approvalValue === 'TBD') {
// If Changelog Check is disabled, also disable checkbox //
if (!isChangelogCheckEnabled || !approvalValue || approvalValue === 'TBD')
{
approveChangelogCheck.disabled = true;
approveChangelogCheck.checked = false;
}
else {
else
{
approveChangelogCheck.disabled = false;

// If the stored approval is "APPROVED", default to checked
if (approvalValue === 'APPROVED') {
approveChangelogCheck.checked = true;
}
// Otherwise, set as unchecked for "BLOCKED," "Disabled," etc.
else {
approveChangelogCheck.checked = false;
}
if (approvalValue === 'APPROVED')
{ approveChangelogCheck.checked = true; }
else
{ approveChangelogCheck.checked = false; }
}
}

Expand Down
24 changes: 12 additions & 12 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-Mar-07
# Last Modified: 2025-Mar-10
###################################################################
set -u

Expand Down Expand Up @@ -2545,7 +2545,7 @@ _UpdateConfigFromWebUISettings_()
{ sleep 15 ; _UpdateHelperJSFile_ "$extCheckALLvarID" "true" ; } &
fi

// Do this ONLY IF requested by user //
## Do this ONLY IF requested by user ##
"$doRouterLoginTest" && _TestLoginCredentials_
else
Say "No updated settings from WebUI found. No merge into $CONFIG_FILE necessary."
Expand Down Expand Up @@ -7185,9 +7185,9 @@ _ManageChangelogMerlin_()
"$inMenuMode" && _WaitForEnterKey_ "$logsMenuReturnPromptStr"
fi
fi
cp -fp "$changeLogFile" "${SETTINGS_DIR}/changelog.txt"
cp -fp "$changeLogFile" "$CHANGELOG_PATH"
rm -f "$changeLogFile" "$wgetLogFile"
ln -sf "${SETTINGS_DIR}/changelog.txt" "${SCRIPT_WEB_DIR}/changelog.htm" 2>/dev/null
ln -sf "$CHANGELOG_PATH" "${SCRIPT_WEB_DIR}/changelog.htm" 2>/dev/null
return 0
}

Expand Down Expand Up @@ -7245,10 +7245,10 @@ _ManageChangelogGnuton_()
less "$FW_Changelog_GITHUB"
fi
fi
cp -fp "$changeLogFile" "${SETTINGS_DIR}/changelog.txt"
cp -fp "$changeLogFile" "$CHANGELOG_PATH"
rm -f "$FW_Changelog_GITHUB" "$wgetLogFile"
ln -sf "${SETTINGS_DIR}/changelog.txt" "${SCRIPT_WEB_DIR}/changelog.htm" 2>/dev/null
return 1
ln -sf "$CHANGELOG_PATH" "${SCRIPT_WEB_DIR}/changelog.htm" 2>/dev/null
return 0
}

##----------------------------------------##
Expand Down Expand Up @@ -10657,11 +10657,11 @@ then
sleep 1
;;
"${SCRIPT_NAME}downloadchangelog")
if "$isGNUtonFW"
then
_ManageChangelogGnuton_ "webuidownload"
else
_ManageChangelogMerlin_ "webuidownload"
if "$isGNUtonFW"
then
_ManageChangelogGnuton_ "webuidownload"
else
_ManageChangelogMerlin_ "webuidownload"
fi
;;
"${SCRIPT_NAME}approvechangelog")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
## v1.4.0
## 2025-Mar-08
## 2025-Mar-10

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