Skip to content
Permalink
Browse files

webui: Make check_AiMesh_fw_version() use regexp instead of iterating…

… an array
  • Loading branch information...
RMerl committed Jul 11, 2019
1 parent e2a9e59 commit 3ab2638162da56f78aaacff4bda792a27fce9ea8
Showing with 9 additions and 15 deletions.
  1. +9 −15 release/src/router/www/Advanced_FirmwareUpgrade_Content.asp
@@ -1077,23 +1077,17 @@ function check_AiMesh_fw_version(_fw) {
var support_manual_fw_id = 382;
var support_manual_fw_num = 18000;
var manual_status = false;
var fw_array = _fw.split(".");
for(var i = 0; i < fw_array.length; i += 1) {
if( fw_array[i] != "" && (fw_array[i].indexOf("_") != -1) && (fw_array[i].indexOf("-") != -1) ) {
var fw_id_num = fw_array[i].substring(0, fw_array[i].indexOf('-')).split("_");
var fw_id = fw_id_num[0];
var fw_num = fw_id_num[1];
if(parseInt(fw_id) > support_manual_fw_id) {
manual_status = true;
break;
}
else if( (parseInt(fw_id) == support_manual_fw_id) && (parseInt(fw_num) >= support_manual_fw_num) ) {
manual_status = true;
break;
}
var fw_array = _fw.match(/(\d+)\.(\d+)\.(\d+)\.(\d+)\.([^_]+)_(\w+)/);
if (fw_array) {
var fw_id = fw_array[5];
var fw_num = fw_array[6];
if( (parseInt(fw_id) > support_manual_fw_id) ||
(parseInt(fw_id) == support_manual_fw_id) && (parseInt(fw_num) >= support_manual_fw_num) ) {
manual_status = true;
}
}
return manual_status
return manual_status;
}
function toggle_fw_check(state) {

0 comments on commit 3ab2638

Please sign in to comment.
You can’t perform that action at this time.