Skip to content

Commit cfb216a

Browse files
Messaging Improvements
More improvements and fine-tuning WRT messaging.
1 parent 30ab1dc commit cfb216a

File tree

2 files changed

+39
-24
lines changed

2 files changed

+39
-24
lines changed

MerlinAU.asp

Lines changed: 22 additions & 21 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-Feb-23 **/
32+
/** Last Modified: 2025-Feb-25 **/
3333
/** Intended for 1.4.0 Release **/
3434
/**----------------------------**/
3535
@@ -41,6 +41,10 @@ var ajax_custom_settings = {};
4141
let isFormSubmitting = false;
4242
let FW_NewUpdateVersAvailable = '';
4343
44+
// Order of NVRAM keys to search for 'Model ID' and 'Product ID' //
45+
const modelKeys = ["nvram_odmpid", "nvram_wps_modelnum", "nvram_model", "nvram_build_name"];
46+
const productKeys = ["nvram_productid", "nvram_build_name", "nvram_odmpid"];
47+
4448
// Define color formatting //
4549
const CYANct = "<span style='color:cyan;'>";
4650
const REDct = "<span style='color:red;'>";
@@ -57,11 +61,12 @@ const InvCYNct = '<span style="margin-left:4px; background-color:cyan; color:bla
5761
const InvCLEAR = '&nbsp;</span>'
5862
5963
/**----------------------------------------**/
60-
/** Modified by Martinski W. [2025-Jan-27] **/
64+
/** Modified by Martinski W. [2025-Feb-25] **/
6165
/**----------------------------------------**/
6266
var externalCheckID = 0x00;
6367
var externalCheckOK = true;
6468
var externalCheckMsg = '';
69+
var defaultFWUpdateZIPdirPath = '/home/root';
6570
var isEMailConfigEnabledInAMTM = false;
6671
var scriptAutoUpdateCronSchedHR = 'TBD';
6772
var fwAutoUpdateCheckCronSchedHR = 'TBD';
@@ -815,7 +820,7 @@ function ValidateDirectoryPath (formField, dirType)
815820
}
816821
817822
/**----------------------------------------**/
818-
/** Modified by Martinski W. [2025-Feb-23] **/
823+
/** Modified by Martinski W. [2025-Feb-25] **/
819824
/**----------------------------------------**/
820825
function GetExternalCheckResults()
821826
{
@@ -831,6 +836,7 @@ function GetExternalCheckResults()
831836
document.getElementById('Script_AutoUpdate_SchedText').textContent = 'Schedule: '+scriptAutoUpdateCronSchedHR;
832837
document.getElementById('FW_AutoUpdate_CheckSchedText').textContent = 'Schedule: '+fwAutoUpdateCheckCronSchedHR;
833838
SetUpEmailNotificationFields();
839+
FWUpdateDirZIPHint = FWUpdateDirZIPHint.replace(/DefaultPATH/, defaultFWUpdateZIPdirPath);
834840
835841
// Skip during form submission //
836842
if (isFormSubmitting) { return true ; }
@@ -876,8 +882,8 @@ function GetExternalCheckResults()
876882
externalCheckOK = true; //Reset for Next Check//
877883
fwUpdateDirPath.ResetExtCheckVars();
878884
alert('Validation failed.\n' + validationStatus);
879-
setTimeout(ValidateDirectoryPath, 5000, fwUpdateZIPdirectory, 'ZIP');
880-
setTimeout(ValidateDirectoryPath, 5000, fwUpdateLOGdirectory, 'LOG');
885+
setTimeout(ValidateDirectoryPath, 3000, fwUpdateZIPdirectory, 'ZIP');
886+
setTimeout(ValidateDirectoryPath, 3000, fwUpdateLOGdirectory, 'LOG');
881887
return false;
882888
}
883889
}
@@ -1135,17 +1141,17 @@ function SetUpEmailNotificationFields()
11351141
}
11361142
11371143
/**----------------------------------------**/
1138-
/** Modified by Martinski W. [2025-Feb-23] **/
1144+
/** Modified by Martinski W. [2025-Feb-25] **/
11391145
/**----------------------------------------**/
11401146
const emailNotifyHint = 'The Email Notifications option requires the AMTM email configuration settings to be enabled and set up.';
11411147
11421148
const autoBackupsHint = 'The Automatic Backups option requires the BACKUPMON script to be installed on the router.';
11431149
11441150
const addonAutoUpdatesHint = 'The daily schedule for automatic updates of MerlinAU is always configured to be 15 minutes *before* the scheduled time for automatic F/W Update checks.';
11451151
1146-
const FWUpdateDirZIPHint = 'This is the directory path where the subdirectory [MerlinAU.d] will be located to download and store the new F/W update files.';
1152+
let FWUpdateDirZIPHint = "This is the base directory path where the subdirectory <br><b>MerlinAU.d/[RouterID]_firmware</b></br> will be located to download and store the new firmware update files.<br>Default base path:</br><b>DefaultPATH</b>";
11471153
1148-
const FWUpdateDirLOGHint = 'This is the directory path where the subdirectory [MerlinAU.d] will be located to store the log files of the F/W update process.';
1154+
const FWUpdateDirLOGHint = 'This is the base directory path where the subdirectory <br><b>MerlinAU.d/logs</b></br> will be located to store the log files of the firmware update process.';
11491155
11501156
const betaToReleaseHint = 'Enabling this option allows the F/W update process to detect an installed Beta version and proceed to update to the latest production release version.';
11511157
@@ -2042,19 +2048,19 @@ function CheckFirmwareUpdate()
20422048
document.form.submit();
20432049
}
20442050
2045-
// Function to get the first non-empty value from a list of element IDs
2046-
function getFirstNonEmptyValue(ids)
2051+
// Get first non-empty value from a list of element IDs //
2052+
function GetFirstNonEmptyValue(elemIDs)
20472053
{
2048-
for (var i = 0; i < ids.length; i++)
2054+
for (var indx = 0; indx < elemIDs.length; indx++)
20492055
{
2050-
var elem = document.getElementById(ids[i]);
2056+
var elem = document.getElementById(elemIDs[indx]);
20512057
if (elem)
20522058
{
20532059
var value = elem.value.trim();
20542060
if (value.length > 0) { return value; }
20552061
}
20562062
}
2057-
return "";
2063+
return '';
20582064
}
20592065
20602066
/**----------------------------------------**/
@@ -2063,15 +2069,10 @@ function getFirstNonEmptyValue(ids)
20632069
// Function to format and display the Router IDs //
20642070
function FormatRouterIDs()
20652071
{
2066-
// Define the order of NVRAM keys to search for Model ID and Product ID
2067-
var modelKeys = ["nvram_odmpid", "nvram_wps_modelnum", "nvram_model", "nvram_build_name"];
2068-
var productKeys = ["nvram_productid", "nvram_build_name", "nvram_odmpid"];
2069-
2070-
// Retrieve the first non-empty values //
2071-
var MODEL_ID = getFirstNonEmptyValue(modelKeys);
2072-
var PRODUCT_ID = getFirstNonEmptyValue(productKeys);
2072+
let MODEL_ID = GetFirstNonEmptyValue(modelKeys);
2073+
let PRODUCT_ID = GetFirstNonEmptyValue(productKeys);
20732074
2074-
// Convert MODEL_ID to uppercase for comparison //
2075+
// Convert to uppercase for comparison //
20752076
var MODEL_ID_UPPER = MODEL_ID.toUpperCase();
20762077
20772078
// Determine FW_RouterModelID based on comparison //

MerlinAU.sh

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

@@ -1359,8 +1359,20 @@ extCheckZIPdirMG="OK"
13591359
extCheckLOGdirMG="OK"
13601360
extCheckRETvarMG="OK"
13611361

1362+
##-------------------------------------##
1363+
## Added by Martinski W. [2025-Feb-25] ##
1364+
##-------------------------------------##
1365+
_WebUI_FW_UpdateZIPDirPathDefault_()
1366+
{
1367+
local defltDirPath="/home/root"
1368+
if [ -n "$USBMountPoint" ] && \
1369+
_ValidateUSBMountPoint_ "$FW_ZIP_BASE_DIR"
1370+
then defltDirPath="$FW_ZIP_BASE_DIR" ; fi
1371+
_WriteVarDefToHelperJSFile_ "defaultFWUpdateZIPdirPath" "$defltDirPath"
1372+
}
1373+
13621374
##----------------------------------------##
1363-
## Modified by Martinski W. [2025-Jan-27] ##
1375+
## Modified by Martinski W. [2025-Feb-25] ##
13641376
##----------------------------------------##
13651377
_InitHelperJSFile_()
13661378
{
@@ -1373,13 +1385,14 @@ _InitHelperJSFile_()
13731385
echo "var externalCheckMsg = '';"
13741386
} > "$HELPER_JSFILE"
13751387

1388+
_WebUI_FW_UpdateZIPDirPathDefault_
13761389
_WebUI_SetEmailConfigFileFromAMTM_
13771390
_WebUI_AutoScriptUpdateCronSchedule_
13781391
_WebUI_AutoFWUpdateCheckCronSchedule_
13791392
}
13801393

13811394
##----------------------------------------##
1382-
## Modified by Martinski W. [2025-Feb-23] ##
1395+
## Modified by Martinski W. [2025-Feb-25] ##
13831396
##----------------------------------------##
13841397
_UpdateHelperJSFile_()
13851398
{
@@ -1432,6 +1445,7 @@ _UpdateHelperJSFile_()
14321445
echo "var externalCheckMsg = '${extCheckRETvarMG}';"
14331446
} > "$HELPER_JSFILE"
14341447

1448+
_WebUI_FW_UpdateZIPDirPathDefault_
14351449
_WebUI_SetEmailConfigFileFromAMTM_
14361450
_WebUI_AutoScriptUpdateCronSchedule_
14371451
_WebUI_AutoFWUpdateCheckCronSchedule_

0 commit comments

Comments
 (0)