Skip to content
Closed
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
165 changes: 111 additions & 54 deletions MerlinAU.asp
Original file line number Diff line number Diff line change
Expand Up @@ -857,64 +857,93 @@ function FetchChangelog(startTime)
});
}

/**------------------------------------------**/
/** Modified by ExtremeFiretop [2025-May-18] **/
/**------------------------------------------**/
function ShowLatestChangelog(e)
{
if (e) e.preventDefault();

let loadingMessage = '<p>Please wait and allow up to 10 seconds for the changelog to load.<br>' +
'Click on "Cancel" button to stop and exit this dialog.</p>';
const loadingMessage =
'<p>Please wait and allow up to 10 seconds for the changelog to load.<br>' +
'Click on "Cancel" button to stop and exit this dialog.</p>';

if ($('#changelogModal').length)
{
$('#changelogData').html(loadingMessage);
$('#closeChangelogModal').text("Cancel");
}
else
{ // Create modal overlay if it doesn't exist //
/* ----- build the modal once ----- */
if (!$('#changelogModal').length) {
$('body').append(
'<div id="changelogModal" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; ' +
'background:rgba(0,0,0,0.8); z-index:10000;">' +
'<div id="changelogContent" style="position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); ' +
'background:#fff; color:#000; padding:20px; max-height:90%; overflow:auto; width:80%; max-width:800px;">' +
'<h2 style="margin-top:0; color:#000;">Latest Changelog</h2>' +
'<button id="closeChangelogModal" style="float:right; font-size:14px; cursor:pointer;">Cancel</button>' +
'<div id="changelogData" style="font-family:monospace; white-space:pre-wrap; margin-top:10px; color:#000;">' +
'<div id="changelogModal" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;' +
'background:rgba(0,0,0,0.8);z-index:10000;">' +
'<div id="changelogContent" style="position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);' +
'background:#fff;color:#000;padding:20px;max-height:90%;overflow:auto;width:80%;max-width:800px;">' +
'<h2 style="margin-top:0;color:#000;">Latest Changelog</h2>' +
'<button id="closeChangelogModal" style="float:right;font-size:14px;cursor:pointer;">Cancel</button>' +
'<div id="changelogData" style="font-family:monospace;white-space:pre-wrap;margin-top:10px;color:#000;">' +
loadingMessage +
'</div>' +
'</div>' +
'</div>'
);
$('#closeChangelogModal').on('click', function(){

/* close button */
$('#closeChangelogModal').on('click', function () {
$('#changelogModal').hide();
});

/* ---------- NEW: arrow‑key scroll handler (bind once) ---------- */
$(document).on('keydown', function (ev) {
if (!$('#changelogModal').is(':visible')) return; // ignore if dialog not open
const box = $('#changelogContent')[0]; // the scrollable div
switch (ev.key) {
case 'ArrowDown':
box.scrollTop += 40;
ev.preventDefault();
break;
case 'ArrowUp':
box.scrollTop -= 40;
ev.preventDefault();
break;
case 'ArrowRight':
box.scrollTop += 40;
ev.preventDefault();
break;
case 'ArrowLeft':
box.scrollTop -= 40;
ev.preventDefault();
break;
default:
break;
}
});
/* -------------------------------------------------------------- */
} else {
$('#changelogData').html(loadingMessage);
$('#closeChangelogModal').text("Cancel");
}

$('#changelogModal').show();

// Trigger the backend shell script via form submission //
var formData = $('form[name="form"]').serializeArray();
/* ---------- NEW: focusable + give it focus ---------- */
$('#changelogContent').attr('tabindex', 0).focus();
/* ---------------------------------------------------- */

/* kick the backend */
const formData = $('form[name="form"]').serializeArray();
formData.push({ name: "action_script", value: "start_MerlinAUdownloadchangelog" });
formData.push({ name: "action_wait", value: "10" });

$.post('start_apply.htm', formData)
.done(function(response) {
console.log("Changelog trigger submitted successfully.");
})
.fail(function() {
console.error("Failed to submit changelog trigger.");
});

// Record the start time and wait 8 seconds before attempting to fetch the changelog //
var startTime = new Date().getTime();
setTimeout(function() {
FetchChangelog(startTime);
// Once the changelog has loaded, update the button text to "Close"
$('#closeChangelogModal').text("Close");
formData.push({ name: "action_wait", value: "10" });

$.post('start_apply.htm', formData);

/* wait 8 s, then fetch the changelog */
const startTime = Date.now();
setTimeout(function () {
FetchChangelog(startTime);
$('#closeChangelogModal').text("Close");
}, 8000);

return false;
}


// **Control "Approve/Block Changelog" Checkbox State** //
function ToggleChangelogApproval (checkboxElem)
{
Expand Down Expand Up @@ -1544,9 +1573,9 @@ function BlockChangelog()
document.form.submit();
}

/**----------------------------------------**/
/** Modified by Martinski W. [2025-Mar-07] **/
/**----------------------------------------**/
/**------------------------------------------**/
/** Modified by ExtremeFiretop [2025-May-18] **/
/**------------------------------------------**/
function InitializeFields()
{
console.log("Initializing fields...");
Expand Down Expand Up @@ -1642,7 +1671,9 @@ function InitializeFields()
{ tailscaleVPNEnabled.checked = (custom_settings.Allow_Updates_OverVPN === 'ENABLED'); }

if (script_AutoUpdate_Check)
{ script_AutoUpdate_Check.checked = (custom_settings.Allow_Script_Auto_Update === 'ENABLED'); }
{ script_AutoUpdate_Check.checked = (custom_settings.Allow_Script_Auto_Update === 'ENABLED');
UpdateForceScriptCheckboxState(script_AutoUpdate_Check?.checked);
}

if (betaToReleaseUpdatesEnabled)
{ betaToReleaseUpdatesEnabled.checked = (custom_settings.FW_Allow_Beta_Production_Up === 'ENABLED'); }
Expand Down Expand Up @@ -2292,29 +2323,55 @@ function Uninstall()
document.form.submit();
}

/**----------------------------------------**/
/** Modified by Martinski W. [2025-May-11] **/
/**----------------------------------------**/
/**---------------------------------------**/
/** Added by ExtremeFiretop [2025-May-18] **/
/**---------------------------------------**/
function UpdateForceScriptCheckboxState(autoUpdatesEnabled) {
const forceCB = document.getElementById('ForceScriptUpdateCheck');
if (!forceCB) return; // safety
forceCB.disabled = autoUpdatesEnabled; // gray‑out logic
forceCB.style.opacity = autoUpdatesEnabled ? '0.5' : '1';
if (autoUpdatesEnabled) forceCB.checked = false; // clear if now disabled
}

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

let actionScriptValue;
let forceScriptUpdateCheck = document.getElementById('ForceScriptUpdateCheck');
const forceScriptUpdateCheck = document.getElementById('ForceScriptUpdateCheck');
const autoUpdatesEnabled = document.getElementById('Script_AutoUpdate_Check')?.checked;

/* ----- build the appropriate confirmation text ----- */
let confirmText;
if (forceScriptUpdateCheck.checked) {
/* user explicitly wants to install right now */
confirmText = "INSTALL UPDATE:\n" +
"Install the latest available MerlinAU script update now, " +
"even if the version is already current.\n\nContinue?";
} else {
/* normal check – message depends on auto‑update setting */
confirmText = "CHECK AND PROMPT:\n" +
"Check for a newer version of MerlinAU and prompt if found. " +
(autoUpdatesEnabled
? "It DOES install automatically!" // <‑‑ NEW text
: "It does NOT install update automatically!") +
"\n\nContinue?";
}

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 (!confirm(confirmText)) return; /* user cancelled */

if (!forceScriptUpdateCheck.checked)
{ actionScriptValue = 'start_MerlinAUscrptupdate'; }
else
{ actionScriptValue = 'start_MerlinAUscrptupdate_force'; }
/* choose action script */
actionScriptValue = forceScriptUpdateCheck.checked
? 'start_MerlinAUscrptupdate_force'
: 'start_MerlinAUscrptupdate';

/* submit the form */
document.form.action_script.value = actionScriptValue;
document.form.action_wait.value = 10;
document.form.action_wait.value = 10;
showLoading();
document.form.submit();
}
Expand Down Expand Up @@ -2944,7 +3001,7 @@ function initializeCollapsibleSections()
</label>
</td>
<td>
<input type="checkbox" id="Script_AutoUpdate_Check" name="Script_AutoUpdate_Check"/>
<input type="checkbox" id="Script_AutoUpdate_Check" name="Script_AutoUpdate_Check" onchange="UpdateForceScriptCheckboxState(this.checked)"/>
<span id="Script_AutoUpdate_SchedText" name="Script_AutoUpdate_SchedText"
style="vertical-align:bottom; margin-left:15px; display:none; font-size: 12px; font-weight: bolder;"></span>
</td>
Expand Down
15 changes: 10 additions & 5 deletions MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
#
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
# Last Modified: 2025-May-17
# Last Modified: 2025-May-18
###################################################################
set -u

## Set version for each Production Release ##
readonly SCRIPT_VERSION=1.4.6
readonly SCRIPT_VERSION=1.4.7
readonly SCRIPT_NAME="MerlinAU"
## Set to "master" for Production Releases ##
SCRIPT_BRANCH="master"
SCRIPT_BRANCH="dev"

##----------------------------------------##
## Modified by Martinski W. [2024-Jul-03] ##
Expand Down Expand Up @@ -4423,7 +4423,6 @@ _GetLoginCredentials_()
then
_WaitForEnterKey_ "$mainMenuReturnPromptStr"
_UpdateLoginPswdCheckHelper_ NoACCESS
return 1
fi

# Get the Username from NVRAM #
Expand Down Expand Up @@ -7419,7 +7418,7 @@ _ChangelogVerificationCheck_()
}

##------------------------------------------##
## Modified by ExtremeFiretop [2025-Apr-11] ##
## Modified by ExtremeFiretop [2025-May-18] ##
##------------------------------------------##
_ManageChangelogMerlin_()
{
Expand Down Expand Up @@ -7464,6 +7463,12 @@ _ManageChangelogMerlin_()
fi
fi

# force 3006 changelog if tag is NG but $2 says 3006
if [ "$changeLogTag" = "NG" ] && [ $# -gt 1 ] && echo "$2" | grep -qE '^3006[.]' ; then
changeLogTag="3006"
MerlinChangeLogURL="${CL_URL_3006}"
fi

wgetLogFile="${FW_BIN_DIR}/${ScriptFNameTag}.WGET.LOG"
changeLogFile="${FW_BIN_DIR}/Changelog-${changeLogTag}.txt"

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.6
1.4.7
Loading