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
66 changes: 62 additions & 4 deletions MerlinAU.asp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,7 @@ function InitializeFields()

// Call the visibility handler //
handleROGFWBuildTypeVisibility();
updateTUFROGAvailText();
console.log("Initializing was completed successfully.");
}
else
Expand Down Expand Up @@ -1902,6 +1903,55 @@ document.addEventListener("DOMContentLoaded", function()
FormatFirmwareVersion();
});

function updateTUFROGAvailText() {
// For ROG
let rogSelect = document.getElementById('rogFWBuildType');
let rogMsgSpan = document.getElementById('rogFWBuildTypeAvailMsg');
if (rogSelect && rogMsgSpan) {
if (rogSelect.value === 'ROG') {
rogMsgSpan.style.display = 'inline-block';
} else {
rogMsgSpan.style.display = 'none';
}
}

// For TUF
let tufSelect = document.getElementById('tuffFWBuildType');
let tufMsgSpan = document.getElementById('tuffFWBuildTypeAvailMsg');
if (tufSelect && tufMsgSpan) {
if (tufSelect.value === 'TUF') {
tufMsgSpan.style.display = 'inline-block';
} else {
tufMsgSpan.style.display = 'none';
}
}
}

function handleTUFROGChange(selectElem) {
// If user picks TUF or ROG, show the popup alert
if (selectElem.value === 'TUF' || selectElem.value === 'ROG') {
alert("The TUF/ROG Build will only apply if a compatible TUF firmware image is available. Otherwise, the Pure Build will be used.");
}

// Show or hide the "if available" text next to the relevant dropdown
if (selectElem.id === 'rogFWBuildType') {
let rogMsgSpan = document.getElementById('rogFWBuildTypeAvailMsg');
if (selectElem.value === 'ROG') {
rogMsgSpan.style.display = 'inline-block';
} else {
rogMsgSpan.style.display = 'none';
}
}
else if (selectElem.id === 'tuffFWBuildType') {
let tufMsgSpan = document.getElementById('tuffFWBuildTypeAvailMsg');
if (selectElem.value === 'TUF') {
tufMsgSpan.style.display = 'inline-block';
} else {
tufMsgSpan.style.display = 'none';
}
}
}

function initializeCollapsibleSections()
{
if (typeof jQuery !== 'undefined')
Expand Down Expand Up @@ -2303,20 +2353,28 @@ function initializeCollapsibleSections()
<tr id="rogFWBuildRow">
<td style="text-align: left;"><label for="rogFWBuildType">ROG F/W Build Type</label></td>
<td>
<select id="rogFWBuildType" name="rogFWBuildType" style="width: 20%;">
<select id="rogFWBuildType" name="rogFWBuildType" style="width: 20%;" onchange="handleTUFROGChange(this)">
<option value="ROG">ROG</option>
<option value="Pure">Pure</option>
</select>
</td>
<span id="rogFWBuildTypeAvailMsg"
style="margin-left:10px; display:none; font-size:12px; font-weight:bolder;">
Note: Only if available
</span>
</td>
</tr>
<tr id="tuffFWBuildRow">
<td style="text-align: left;"><label for="tuffFWBuildType">TUF F/W Build Type</label></td>
<td>
<select id="tuffFWBuildType" name="tuffFWBuildType" style="width: 20%;">
<select id="tuffFWBuildType" name="tuffFWBuildType" style="width: 20%;" onchange="handleTUFROGChange(this)">
<option value="TUF">TUF</option>
<option value="Pure">Pure</option>
</select>
</td>
<span id="tuffFWBuildTypeAvailMsg"
style="margin-left:10px; display:none; font-size:12px; font-weight:bolder;">
Note: Only if available
</span>
</td>
</tr>
<tr>
<td style="text-align: left;"><label for="emailNotificationsEnabled">Enable F/W Update Email Notifications</label></td>
Expand Down
92 changes: 53 additions & 39 deletions MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1659,20 +1659,6 @@ _Migrate_Settings_()
fi
}

##------------------------------------------##
## Modified by ExtremeFiretop [2024-Jun-03] ##
##------------------------------------------##
# NOTE:
# ROG upgrades to 3006 codebase should have
# the ROG option deleted.
#-----------------------------------------------------------
if ! "$isGNUtonFW"
then
if [ "$fwInstalledBaseVers" -ge 3006 ] && \
grep -q "^ROGBuild" "$CONFIG_FILE"
then Delete_Custom_Settings "ROGBuild" ; fi
fi

##------------------------------------------##
## Modified by ExtremeFiretop [2024-Jan-27] ##
##------------------------------------------##
Expand Down Expand Up @@ -4803,8 +4789,10 @@ _ChangeBuildType_TUF_()
do
printf "\n${SEPstr}"
printf "\nChoose your preferred option for the build type to flash:\n"
printf "\n ${GRNct}1${NOct}. Original ${REDct}TUF${NOct} themed user interface${NOct}\n"
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-TUF${NOct} themed user interface ${GRNct}(Recommended)${NOct}\n"
printf "\n ${GRNct}1${NOct}. Original ${REDct}TUF${NOct} themed user interface"
printf "\n ${REDct}(Applies only if TUF F/W is available; otherwise defaults to Pure Build)${NOct}\n"
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-TUF${NOct} themed user interface"
printf "\n ${GRNct}(Recommended)${NOct}\n"
printf "\n ${GRNct}e${NOct}. Exit to Advanced Menu\n"
printf "${SEPstr}\n"
printf "[$display_choice] Enter selection: "
Expand All @@ -4816,7 +4804,9 @@ _ChangeBuildType_TUF_()
then doReturnToMenu=true ; break ; fi

case $choice in
1) buildtypechoice="ENABLED" ; break
1) buildtypechoice="ENABLED"
printf "${CYANct}\nNote: The TUF Build will only apply if a compatible TUF firmware image is available. Otherwise, the Pure Build will be used.${NOct}\n"
break
;;
2) buildtypechoice="DISABLED" ; break
;;
Expand Down Expand Up @@ -4863,8 +4853,10 @@ _ChangeBuildType_ROG_()
do
printf "\n${SEPstr}"
printf "\nChoose your preferred option for the build type to flash:\n"
printf "\n ${GRNct}1${NOct}. Original ${REDct}ROG${NOct} themed user interface${NOct}\n"
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-ROG${NOct} themed user interface ${GRNct}(Recommended)${NOct}\n"
printf "\n ${GRNct}1${NOct}. Original ${REDct}ROG${NOct} themed user interface"
printf "\n ${REDct}(Applies only if ROG F/W is available; otherwise defaults to Pure Build)${NOct}\n"
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-ROG${NOct} themed user interface"
printf "\n ${GRNct}(Recommended)${NOct}\n"
printf "\n ${GRNct}e${NOct}. Exit to Advanced Menu\n"
printf "${SEPstr}\n"
printf "[$display_choice] Enter selection: "
Expand All @@ -4876,7 +4868,9 @@ _ChangeBuildType_ROG_()
then doReturnToMenu=true ; break ; fi

case $choice in
1) buildtypechoice="ENABLED" ; break
1) buildtypechoice="ENABLED"
printf "${CYANct}\nNote: The ROG Build will only apply if a compatible ROG firmware image is available. Otherwise, the Pure Build will be used.${NOct}\n"
break
;;
2) buildtypechoice="DISASLED" ; break
;;
Expand Down Expand Up @@ -9166,21 +9160,41 @@ then
_ReleaseLock_ ; exit 0
fi

currentBackupOption="$(Get_Custom_Setting "FW_Auto_Backupmon")"
if [ -f "/jffs/scripts/backupmon.sh" ]
then
# If setting is empty, add it to the configuration file #
if [ "$currentBackupOption" = "TBD" ]
then
Update_Custom_Settings FW_Auto_Backupmon "ENABLED"
fi
else
# If the configuration setting exists, delete it #
if [ "$currentBackupOption" != "TBD" ]
then
Delete_Custom_Settings "FW_Auto_Backupmon"
##---------------------------------------##
## Added by ExtremeFiretop [2025-Feb-08] ##
##---------------------------------------##
_CheckAndSetBackupOption_() {
local currentBackupOption
currentBackupOption="$(Get_Custom_Setting "FW_Auto_Backupmon")"
if [ -f "/jffs/scripts/backupmon.sh" ]; then
# If setting is empty, add it to the configuration file #
if [ "$currentBackupOption" = "TBD" ]; then
Update_Custom_Settings FW_Auto_Backupmon "ENABLED"
fi
else
# If the configuration setting exists, delete it #
if [ "$currentBackupOption" != "TBD" ]; then
Delete_Custom_Settings "FW_Auto_Backupmon"
fi
fi
fi
}

##---------------------------------------##
## Added by ExtremeFiretop [2025-Feb-08] ##
##---------------------------------------##
_SetDefaultBuildType_() {
if echo "$PRODUCT_ID" | grep -q "^TUF-"
then
if [ "$(Get_Custom_Setting "TUFBuild")" = "TBD" ]
then Update_Custom_Settings "TUFBuild" "DISABLED"
fi
elif echo "$PRODUCT_ID" | grep -q "^GT-"
then
if [ "$(Get_Custom_Setting "ROGBuild")" = "TBD" ]
then Update_Custom_Settings "ROGBuild" "DISABLED"
fi
fi
}

##-------------------------------------##
## Added by Martinski W. [2025-Jan-05] ##
Expand Down Expand Up @@ -10112,11 +10126,7 @@ _AdvancedOptionsMenu_()
;;
bt) if echo "$PRODUCT_ID" | grep -q "^TUF-"
then _ChangeBuildType_TUF_
elif [ "$fwInstalledBaseVers" -le 3004 ] && \
echo "$PRODUCT_ID" | grep -q "^GT-"
then _ChangeBuildType_ROG_
elif [ "$fwInstalledBaseVers" -ge 3006 ] && "$isGNUtonFW" && \
echo "$PRODUCT_ID" | grep -q "^GT-"
elif echo "$PRODUCT_ID" | grep -q "^GT-"
then _ChangeBuildType_ROG_
else _InvalidMenuSelection_
fi
Expand Down Expand Up @@ -10287,6 +10297,10 @@ _DoInitializationStartup_()
_AutoStartupHook_ create 2>/dev/null
_AutoServiceEvent_ create 2>/dev/null
fi

_CheckAndSetBackupOption_
_SetDefaultBuildType_

}

FW_InstalledVersion="$(_GetCurrentFWInstalledLongVersion_)"
Expand Down