Allow a custom autorefresh status script for each wan and output its HTML in the overview page.

- thanks to @notsure2
arm-ng
pedro 6 years ago
parent 9f6b4b4af8
commit a5e052b9d2

@ -579,6 +579,7 @@ static const nvset_t nvset_list[] = {
{ "wan_sta", V_LENGTH(0, 10) },
{ "wan_dns", V_LENGTH(0, 50) }, // ip ip ip
{ "wan_hilink_ip", V_IP },
{ "wan_status_script", V_01 },
{ "wan_ckmtd", V_LENGTH(1, 2) }, // check method: 1 - ping, 2 - traceroute, 3 - curl
#ifdef TCONFIG_MULTIWAN
@ -621,6 +622,7 @@ static const nvset_t nvset_list[] = {
{ "wan2_dns", V_LENGTH(0, 50) }, // ip ip ip
{ "wan2_dns_auto", V_01 },
{ "wan2_hilink_ip", V_IP },
{ "wan2_status_script", V_01 },
{ "wan2_ckmtd", V_LENGTH(1, 2) }, // check method: 1 - ping, 2 - traceroute, 3 - curl
#ifdef TCONFIG_MULTIWAN
@ -651,6 +653,7 @@ static const nvset_t nvset_list[] = {
{ "wan3_dns", V_LENGTH(0, 50) }, // ip ip ip
{ "wan3_dns_auto", V_01 },
{ "wan3_hilink_ip", V_IP },
{ "wan3_status_script", V_01 },
{ "wan3_ckmtd", V_LENGTH(1, 2) }, // check method: 1 - ping, 2 - traceroute, 3 - curl
{ "wan4_proto", V_LENGTH(1, 16) }, // disabled, dhcp, static, pppoe, pptp, l2tp
@ -680,6 +683,7 @@ static const nvset_t nvset_list[] = {
{ "wan4_dns", V_LENGTH(0, 50) }, // ip ip ip
{ "wan4_dns_auto", V_01 },
{ "wan4_hilink_ip", V_IP },
{ "wan4_status_script", V_01 },
{ "wan4_ckmtd", V_LENGTH(1, 2) }, // check method: 1 - ping, 2 - traceroute, 3 - curl
#endif

@ -71,6 +71,7 @@ struct nvram_tuple router_defaults[] = {
{ "wan_dns", "" , 0 }, // x.x.x.x x.x.x.x ...
{ "wan_weight", "1" , 0 },
{ "wan_hilink_ip", "0.0.0.0" , 0 },
{ "wan_status_script", "0" , 0 },
{ "wan_ckmtd", "2" , 0 },
{ "wan2_proto", "dhcp" , 0 }, // [static|dhcp|pppoe|disabled]
@ -83,6 +84,7 @@ struct nvram_tuple router_defaults[] = {
{ "wan2_hwaddr", "" , 0 }, // WAN interface MAC address
{ "wan2_ifnameX", NULL , 0 }, // real wan if; see wan.c:start_wan
{ "wan2_hilink_ip", "0.0.0.0" , 0 },
{ "wan2_status_script", "0" , 0 },
{ "wan2_ckmtd", "2" , 0 },
#ifdef TCONFIG_MULTIWAN
@ -96,6 +98,7 @@ struct nvram_tuple router_defaults[] = {
{ "wan3_hwaddr", "" , 0 }, // WAN interface MAC address
{ "wan3_ifnameX", NULL , 0 }, // real wan if; see wan.c:start_wan
{ "wan3_hilink_ip", "0.0.0.0" , 0 },
{ "wan3_status_script", "0" , 0 },
{ "wan3_ckmtd", "2" , 0 },
{ "wan4_proto", "dhcp" , 0 }, // [static|dhcp|pppoe|disabled]
@ -108,6 +111,7 @@ struct nvram_tuple router_defaults[] = {
{ "wan4_hwaddr", "" , 0 }, // WAN interface MAC address
{ "wan4_ifnameX", NULL , 0 }, // real wan if; see wan.c:start_wan
{ "wan4_hilink_ip", "0.0.0.0" , 0 },
{ "wan4_status_script", "0" , 0 },
{ "wan4_ckmtd", "2" , 0 },
#endif

@ -20,7 +20,7 @@
<script src="interfaces.js"></script>
<script src="wireless.js"></script>
<script>
// <% nvram("dhcp_lease,dhcp_num,dhcp_start,dhcpd_startip,dhcpd_endip,lan_gateway,lan_ipaddr,lan_netmask,lan_proto,lan_state,lan_desc,lan_invert,wl_security_mode,dnscrypt_proxy,dnscrypt_priority,dnscrypt_port,dnscrypt_resolver,dnscrypt_log,dnscrypt_manual,dnscrypt_provider_name,dnscrypt_provider_key,dnscrypt_resolver_address,dnscrypt_ephemeral_keys,stubby_proxy,stubby_priority,stubby_log,wan_wins,wl_wds_enable,wl_channel,wl_closed,wl_crypto,wl_key,wl_key1,wl_key2,wl_key3,wl_key4,wl_lazywds,wl_mode,wl_net_mode,wl_passphrase,wl_radio,wl_radius_ipaddr,wl_radius_port,wl_ssid,wl_wds,wl_wep_bit,wl_wpa_gtk_rekey,wl_wpa_psk,wl_radius_key,wl_auth,wl_hwaddr,t_features,wl_nbw_cap,wl_nctrlsb,wl_nband,wl_phytype,lan_ifname,lan_stp,lan1_ifname,lan1_ipaddr,lan1_netmask,lan1_proto,lan1_stp,dhcp1_start,dhcp1_num,dhcp1_lease,dhcpd1_startip,dhcpd1_endip,lan2_ifname,lan2_ipaddr,lan2_netmask,lan2_proto,lan2_stp,dhcp2_start,dhcp2_num,dhcp2_lease,dhcpd2_startip,dhcpd2_endip,lan3_ifname,lan3_ipaddr,lan3_netmask,lan3_proto,lan3_stp,dhcp3_start,dhcp3_num,dhcp3_lease,dhcpd3_startip,dhcpd3_endip,cstats_enable,wan_proto,wan_weight,wan_modem_type,wan_modem_pin,wan_modem_dev,wan_modem_init,wan_modem_apn,wan_modem_speed,wan_modem_band,wan_modem_roam,wan_ppp_username,wan_ppp_passwd,wan_ppp_service,wan_l2tp_server_ip,wan_pptp_dhcp,wan_ipaddr,wan_netmask,wan_gateway,wan_pptp_server_ip,wan_ppp_custom,wan_ppp_demand,wan_ppp_idletime,wan_ppp_demand_dnsip,wan_ppp_redialperiod,wan_pppoe_lei,wan_pppoe_lef,wan_mtu_enable,wan_mtu,wan_ppp_mlppp,wan_modem_ipaddr,wan_islan,wan_sta,wan_dns,wan_dns_auto,wan_ifnameX,wan_ckmtd,wan2_proto,wan2_weight,wan2_modem_type,wan2_modem_pin,wan2_modem_dev,wan2_modem_init,wan2_modem_apn,wan2_modem_speed,wan2_modem_band,wan2_modem_roam,wan2_ppp_username,wan2_ppp_passwd,wan2_ppp_service,wan2_l2tp_server_ip,wan2_pptp_dhcp,wan2_ipaddr,wan2_netmask,wan2_gateway,wan2_pptp_server_ip,wan2_ppp_custom,wan2_ppp_demand,wan2_ppp_idletime,wan2_ppp_demand_dnsip,wan2_ppp_redialperiod,wan2_pppoe_lei,wan2_pppoe_lef,wan2_mtu_enable,wan2_mtu,wan2_ppp_mlppp,wan2_modem_ipaddr,wan2_islan,wan2_sta,wan2_dns,wan2_dns_auto,wan2_ifnameX,wan2_ckmtd,wan3_proto,wan3_weight,wan3_modem_type,wan3_modem_pin,wan3_modem_dev,wan3_modem_init,wan3_modem_apn,wan3_modem_speed,wan3_modem_band,wan3_modem_roam,wan3_ppp_username,wan3_ppp_passwd,wan3_ppp_service,wan3_l2tp_server_ip,wan3_pptp_dhcp,wan3_ipaddr,wan3_netmask,wan3_gateway,wan3_pptp_server_ip,wan3_ppp_custom,wan3_ppp_demand,wan3_ppp_idletime,wan3_ppp_demand_dnsip,wan3_ppp_redialperiod,wan3_pppoe_lei,wan3_pppoe_lef,wan3_mtu_enable,wan3_mtu,wan3_ppp_mlppp,wan3_modem_ipaddr,wan3_islan,wan3_sta,wan3_dns,wan3_dns_auto,wan3_ifnameX,wan3_ckmtd,wan4_proto,wan4_weight,wan4_modem_type,wan4_modem_pin,wan4_modem_dev,wan4_modem_init,wan4_modem_apn,wan4_modem_speed,wan4_modem_band,wan4_modem_roam,wan4_ppp_username,wan4_ppp_passwd,wan4_ppp_service,wan4_l2tp_server_ip,wan4_pptp_dhcp,wan4_ipaddr,wan4_netmask,wan4_gateway,wan4_pptp_server_ip,wan4_ppp_custom,wan4_ppp_demand,wan4_ppp_idletime,wan4_ppp_demand_dnsip,wan4_ppp_redialperiod,wan4_pppoe_lei,wan4_pppoe_lef,wan4_mtu_enable,wan4_mtu,wan4_ppp_mlppp,wan4_modem_ipaddr,wan4_islan,wan4_sta,wan4_dns,wan4_dns_auto,wan4_ifnameX,wan4_ckmtd,mwan_num,mwan_cktime,mwan_ckdst,dnssec_enable,wan_hilink_ip,wan2_hilink_ip,wan3_hilink_ip,wan4_hilink_ip"); %>
// <% nvram("dhcp_lease,dhcp_num,dhcp_start,dhcpd_startip,dhcpd_endip,lan_gateway,lan_ipaddr,lan_netmask,lan_proto,lan_state,lan_desc,lan_invert,wl_security_mode,dnscrypt_proxy,dnscrypt_priority,dnscrypt_port,dnscrypt_resolver,dnscrypt_log,dnscrypt_manual,dnscrypt_provider_name,dnscrypt_provider_key,dnscrypt_resolver_address,dnscrypt_ephemeral_keys,stubby_proxy,stubby_priority,stubby_log,wan_wins,wl_wds_enable,wl_channel,wl_closed,wl_crypto,wl_key,wl_key1,wl_key2,wl_key3,wl_key4,wl_lazywds,wl_mode,wl_net_mode,wl_passphrase,wl_radio,wl_radius_ipaddr,wl_radius_port,wl_ssid,wl_wds,wl_wep_bit,wl_wpa_gtk_rekey,wl_wpa_psk,wl_radius_key,wl_auth,wl_hwaddr,t_features,wl_nbw_cap,wl_nctrlsb,wl_nband,wl_phytype,lan_ifname,lan_stp,lan1_ifname,lan1_ipaddr,lan1_netmask,lan1_proto,lan1_stp,dhcp1_start,dhcp1_num,dhcp1_lease,dhcpd1_startip,dhcpd1_endip,lan2_ifname,lan2_ipaddr,lan2_netmask,lan2_proto,lan2_stp,dhcp2_start,dhcp2_num,dhcp2_lease,dhcpd2_startip,dhcpd2_endip,lan3_ifname,lan3_ipaddr,lan3_netmask,lan3_proto,lan3_stp,dhcp3_start,dhcp3_num,dhcp3_lease,dhcpd3_startip,dhcpd3_endip,cstats_enable,wan_proto,wan_weight,wan_modem_type,wan_modem_pin,wan_modem_dev,wan_modem_init,wan_modem_apn,wan_modem_speed,wan_modem_band,wan_modem_roam,wan_ppp_username,wan_ppp_passwd,wan_ppp_service,wan_l2tp_server_ip,wan_pptp_dhcp,wan_ipaddr,wan_netmask,wan_gateway,wan_pptp_server_ip,wan_ppp_custom,wan_ppp_demand,wan_ppp_idletime,wan_ppp_demand_dnsip,wan_ppp_redialperiod,wan_pppoe_lei,wan_pppoe_lef,wan_mtu_enable,wan_mtu,wan_ppp_mlppp,wan_modem_ipaddr,wan_islan,wan_sta,wan_dns,wan_dns_auto,wan_ifnameX,wan_ckmtd,wan2_proto,wan2_weight,wan2_modem_type,wan2_modem_pin,wan2_modem_dev,wan2_modem_init,wan2_modem_apn,wan2_modem_speed,wan2_modem_band,wan2_modem_roam,wan2_ppp_username,wan2_ppp_passwd,wan2_ppp_service,wan2_l2tp_server_ip,wan2_pptp_dhcp,wan2_ipaddr,wan2_netmask,wan2_gateway,wan2_pptp_server_ip,wan2_ppp_custom,wan2_ppp_demand,wan2_ppp_idletime,wan2_ppp_demand_dnsip,wan2_ppp_redialperiod,wan2_pppoe_lei,wan2_pppoe_lef,wan2_mtu_enable,wan2_mtu,wan2_ppp_mlppp,wan2_modem_ipaddr,wan2_islan,wan2_sta,wan2_dns,wan2_dns_auto,wan2_ifnameX,wan2_ckmtd,wan3_proto,wan3_weight,wan3_modem_type,wan3_modem_pin,wan3_modem_dev,wan3_modem_init,wan3_modem_apn,wan3_modem_speed,wan3_modem_band,wan3_modem_roam,wan3_ppp_username,wan3_ppp_passwd,wan3_ppp_service,wan3_l2tp_server_ip,wan3_pptp_dhcp,wan3_ipaddr,wan3_netmask,wan3_gateway,wan3_pptp_server_ip,wan3_ppp_custom,wan3_ppp_demand,wan3_ppp_idletime,wan3_ppp_demand_dnsip,wan3_ppp_redialperiod,wan3_pppoe_lei,wan3_pppoe_lef,wan3_mtu_enable,wan3_mtu,wan3_ppp_mlppp,wan3_modem_ipaddr,wan3_islan,wan3_sta,wan3_dns,wan3_dns_auto,wan3_ifnameX,wan3_ckmtd,wan4_proto,wan4_weight,wan4_modem_type,wan4_modem_pin,wan4_modem_dev,wan4_modem_init,wan4_modem_apn,wan4_modem_speed,wan4_modem_band,wan4_modem_roam,wan4_ppp_username,wan4_ppp_passwd,wan4_ppp_service,wan4_l2tp_server_ip,wan4_pptp_dhcp,wan4_ipaddr,wan4_netmask,wan4_gateway,wan4_pptp_server_ip,wan4_ppp_custom,wan4_ppp_demand,wan4_ppp_idletime,wan4_ppp_demand_dnsip,wan4_ppp_redialperiod,wan4_pppoe_lei,wan4_pppoe_lef,wan4_mtu_enable,wan4_mtu,wan4_ppp_mlppp,wan4_modem_ipaddr,wan4_islan,wan4_sta,wan4_dns,wan4_dns_auto,wan4_ifnameX,wan4_ckmtd,mwan_num,mwan_cktime,mwan_ckdst,dnssec_enable,wan_hilink_ip,wan2_hilink_ip,wan3_hilink_ip,wan4_hilink_ip,wan_status_script,wan2_status_script,wan3_status_script,wan4_status_script"); %>
/* DUALWAN-BEGIN */
maxwan_num = 2;
@ -480,6 +480,7 @@ function verifyFields(focused, quiet) {
vis['_wan'+u+'_netmask'] = 1;
vis['_wan'+u+'_gateway'] = 1;
vis['_wan'+u+'_hilink_ip'] = 1;
vis['_f_wan'+u+'_status_script'] = 1;
vis['_wan'+u+'_ckmtd'] = 1;
vis['_wan'+u+'_pptp_server_ip'] = 1;
vis['_f_wan'+u+'_pptp_dhcp'] = 1;
@ -516,6 +517,7 @@ function verifyFields(focused, quiet) {
E('_wan'+u+'_netmask').disabled = 0;
E('_wan'+u+'_gateway').disabled = 0;
E('_wan'+u+'_hilink_ip').disabled = 0;
E('_f_wan'+u+'_status_script').disabled = 0;
E('_wan'+u+'_ckmtd').disabled = 0;
E('_wan'+u+'_pptp_server_ip').disabled = 0;
E('_f_wan'+u+'_pptp_dhcp').disabled = 0;
@ -589,6 +591,7 @@ function verifyFields(focused, quiet) {
E('_wan'+u+'_netmask').disabled = 1;
E('_wan'+u+'_gateway').disabled = 1;
E('_wan'+u+'_hilink_ip').disabled = 1;
E('_f_wan'+u+'_ckmtd').disabled = 1;
E('_wan'+u+'_ckmtd').disabled = 1;
E('_wan'+u+'_pptp_server_ip').disabled = 1;
E('_f_wan'+u+'_pptp_dhcp').disabled = 1;
@ -702,6 +705,7 @@ function verifyFields(focused, quiet) {
vis['_wan'+u+'_netmask'] = 0;
vis['_wan'+u+'_gateway'] = 0;
vis['_wan'+u+'_hilink_ip'] = 0;
vis['_f_wan'+u+'_status_script'] = 0;
vis['_wan'+u+'_ckmtd'] = 0;
vis['_wan'+u+'_pptp_server_ip'] = 0;
vis['_f_wan'+u+'_pptp_dhcp'] = 0;
@ -1558,6 +1562,7 @@ REMOVE-END */
fom['wan'+u+'_islan'].value = fom['f_wan'+u+'_islan'].checked ? 1 : 0;
fom['wan'+u+'_pptp_dhcp'].value = fom['f_wan'+u+'_pptp_dhcp'].checked ? 1 : 0;
fom['wan'+u+'_ppp_mlppp'].value = fom['f_wan'+u+'_ppp_mlppp'].checked ? 1 : 0;
fom['wan'+u+'_status_script'].value = fom['f_wan'+u+'_status_script'].checked ? 1 : 0;
if (fom['wan'+u+'_dns_auto'].value == '1') {
fom['wan'+u+'_dns'].value = '';
}
@ -1720,6 +1725,7 @@ REMOVE-END -->
W('<input type="hidden" name="wan'+u+'_pptp_dhcp">');
W('<input type="hidden" name="wan'+u+'_ppp_mlppp">');
W('<input type="hidden" name="wan'+u+'_dns">');
W('<input type="hidden" name="wan'+u+'_status_script">');
W('<div class="section-title" id="wan'+u+'-title">WAN'+u+' Settings<\/div>');
W('<div class="section" id="sesdiv_wan'+u+'">');
createFieldTable('', [
@ -1771,6 +1777,7 @@ REMOVE-END -->
{ title: 'Route Modem IP', name: 'wan'+u+'_modem_ipaddr', type: 'text', maxlen: 15, size: 17, suffix: '&nbsp; <small>must be in different subnet to router, 0.0.0.0 to disable<\/small>', value: nvram['wan'+u+'_modem_ipaddr'] },
{ title: 'Query HiLink Modem IP', name: 'wan'+u+'_hilink_ip', type: 'text', maxlen: 15, size: 17, suffix: '&nbsp; <small>show status of reachable hilink modem, 0.0.0.0 to disable<\/small>', value: nvram['wan'+u+'_hilink_ip'] },
{ title: 'Call Custom Status Script', name: 'f_wan'+u+'_status_script', type: 'checkbox', suffix: '&nbsp; <small>Call /www/user/cgi-bin/wan' + u + '_status.sh in the home page. Must output HTML.<\/small>', value: (nvram['wan'+u+'_status_script'] == 1) },
{ title: 'Watchdog Mode', name: 'wan'+u+'_ckmtd', type: 'select', options: [['1','Ping'],['2','Traceroute*']
/* BBT-BEGIN */
,['3','Curl']

@ -7,7 +7,7 @@
No part of this file may be used without permission.
*/
// <% nvram("router_name,wan_domain,wan_hostname,et0macaddr,lan_proto,lan_ipaddr,dhcp_start,dhcp_num,dhcpd_startip,dhcpd_endip,lan_netmask,wl_security_mode,wl_crypto,wl_mode,wl_wds_enable,wl_hwaddr,wl_net_mode,wl_radio,wl_channel,lan_gateway,wl_ssid,wl_closed,t_model_name,t_features,dhcp1_start,dhcp1_num,dhcpd1_startip,dhcpd1_endip,dhcp2_start,dhcp2_num,dhcpd2_startip,dhcpd2_endip,dhcp3_start,dhcp3_num,dhcpd3_startip,dhcpd3_endip,lan1_proto,lan1_ipaddr,lan1_netmask,lan2_proto,lan2_ipaddr,lan2_netmask,lan3_proto,lan3_ipaddr,lan3_netmask,lan_ifname,lan1_ifname,lan2_ifname,lan3_ifname,lan_ifnames,lan1_ifnames,lan2_ifnames,lan3_ifnames,wan_ifnames,tomatoanon_enable,tomatoanon_answer,lan_desc,wan_ppp_get_ip,wan_pptp_dhcp,wan_pptp_server_ip,wan_ipaddr_buf,wan_gateway,wan_gateway_get,wan_get_domain,wan_hwaddr,wan_ipaddr,wan_netmask,wan_proto,wan_run_mtu,wan_sta,wan2_ppp_get_ip,wan2_pptp_dhcp,wan2_pptp_server_ip,wan2_ipaddr_buf,wan2_gateway,wan2_gateway_get,wan2_get_domain,wan2_hwaddr,wan2_ipaddr,wan2_netmask,wan2_proto,wan2_run_mtu,wan2_sta,wan3_ppp_get_ip,wan3_pptp_dhcp,wan3_pptp_server_ip,wan3_ipaddr_buf,wan3_gateway,wan3_gateway_get,wan3_get_domain,wan3_hwaddr,wan3_ipaddr,wan3_netmask,wan3_proto,wan3_run_mtu,wan3_sta,wan4_ppp_get_ip,wan4_pptp_dhcp,wan4_pptp_server_ip,wan4_ipaddr_buf,wan4_gateway,wan4_gateway_get,wan4_get_domain,wan4_hwaddr,wan4_ipaddr,wan4_netmask,wan4_proto,wan4_run_mtu,wan4_sta,mwan_num,pptp_client_enable,pptp_client_ipaddr,pptp_client_netmask,pptp_client_gateway,pptp_client_get_dns,pptp_client_srvsub,pptp_client_srvsubmsk,wan_modem_type,wan2_modem_type,wan3_modem_type,wan4_modem_type,wan_hilink_ip,wan2_hilink_ip,wan3_hilink_ip,wan4_hilink_ip"); %>
// <% nvram("router_name,wan_domain,wan_hostname,et0macaddr,lan_proto,lan_ipaddr,dhcp_start,dhcp_num,dhcpd_startip,dhcpd_endip,lan_netmask,wl_security_mode,wl_crypto,wl_mode,wl_wds_enable,wl_hwaddr,wl_net_mode,wl_radio,wl_channel,lan_gateway,wl_ssid,wl_closed,t_model_name,t_features,dhcp1_start,dhcp1_num,dhcpd1_startip,dhcpd1_endip,dhcp2_start,dhcp2_num,dhcpd2_startip,dhcpd2_endip,dhcp3_start,dhcp3_num,dhcpd3_startip,dhcpd3_endip,lan1_proto,lan1_ipaddr,lan1_netmask,lan2_proto,lan2_ipaddr,lan2_netmask,lan3_proto,lan3_ipaddr,lan3_netmask,lan_ifname,lan1_ifname,lan2_ifname,lan3_ifname,lan_ifnames,lan1_ifnames,lan2_ifnames,lan3_ifnames,wan_ifnames,tomatoanon_enable,tomatoanon_answer,lan_desc,wan_ppp_get_ip,wan_pptp_dhcp,wan_pptp_server_ip,wan_ipaddr_buf,wan_gateway,wan_gateway_get,wan_get_domain,wan_hwaddr,wan_ipaddr,wan_netmask,wan_proto,wan_run_mtu,wan_sta,wan2_ppp_get_ip,wan2_pptp_dhcp,wan2_pptp_server_ip,wan2_ipaddr_buf,wan2_gateway,wan2_gateway_get,wan2_get_domain,wan2_hwaddr,wan2_ipaddr,wan2_netmask,wan2_proto,wan2_run_mtu,wan2_sta,wan3_ppp_get_ip,wan3_pptp_dhcp,wan3_pptp_server_ip,wan3_ipaddr_buf,wan3_gateway,wan3_gateway_get,wan3_get_domain,wan3_hwaddr,wan3_ipaddr,wan3_netmask,wan3_proto,wan3_run_mtu,wan3_sta,wan4_ppp_get_ip,wan4_pptp_dhcp,wan4_pptp_server_ip,wan4_ipaddr_buf,wan4_gateway,wan4_gateway_get,wan4_get_domain,wan4_hwaddr,wan4_ipaddr,wan4_netmask,wan4_proto,wan4_run_mtu,wan4_sta,mwan_num,pptp_client_enable,pptp_client_ipaddr,pptp_client_netmask,pptp_client_gateway,pptp_client_get_dns,pptp_client_srvsub,pptp_client_srvsubmsk,wan_modem_type,wan2_modem_type,wan3_modem_type,wan4_modem_type,wan_hilink_ip,wan2_hilink_ip,wan3_hilink_ip,wan4_hilink_ip,wan_status_script,wan2_status_script,wan3_status_script,wan4_status_script"); %>
// <% uptime(); %>
// <% sysinfo(); %>
// <% wlstats(1); %>

@ -41,6 +41,7 @@ lastjiffiestotal = 0;
lastjiffiesidle = 0;
lastjiffiesusage = 100;
updateWWANTimers = [];
customStatusTimers = [];
</script>
<script src="wireless.jsx?_http_id=<% nv(http_id); %>"></script>
@ -153,6 +154,27 @@ foreach_wwan(function(i) {
});
/* USB-END */
for (var uidx = 1; uidx <= nvram.mwan_num; uidx++) {
var wan_suffix = uidx > 1 ? uidx : '';
var wan_str = 'nvram.wan';
wan_str += wan_suffix;
var use_wan_status_script = eval(wan_str + '_status_script') == '1';
if (use_wan_status_script) {
var wan_status_script_url = '/user/cgi-bin/wan' + wan_suffix + '_status.sh';
customStatusTimers[uidx-1] = new TomatoRefresh(wan_status_script_url, null, 30, 'wan_custom_status');
customStatusTimers[uidx-1].refresh = (function(wan_suffix) {
return function(text) {
try {
var element = document.querySelector("#WanCustomStatus" + wan_suffix + " > td");
element.innerHTML = text;
}
catch (ex) {
}
};
})(wan_suffix);
}
}
function c(id, htm) {
E(id).cells[1].innerHTML = htm;
}
@ -376,6 +398,14 @@ function init() {
timer.initPage(3000, 3);
});
/* USB-END */
for (var uidx = 1; uidx <= nvram.mwan_num; uidx++) {
if (!customStatusTimers[uidx - 1]) {
continue;
}
var timer = customStatusTimers[uidx - 1];
timer.initPage(3000, 3);
}
ref.initPage(3000, 3);
var elements = document.getElementsByClassName("new_window");
@ -475,7 +505,8 @@ function init() {
null,
{ title: 'Status', rid: 'wan'+u+'status', text: stats.wanstatus[uidx-1] },
{ title: 'Connection Uptime', rid: 'wan'+u+'uptime', text: stats.wanuptime[uidx-1] },
{ title: 'Remaining Lease Time', rid: 'wan'+u+'lease', text: stats.wanlease[uidx-1], ignore: !show_dhcpc[uidx-1] }
{ title: 'Remaining Lease Time', rid: 'wan'+u+'lease', text: stats.wanlease[uidx-1], ignore: !show_dhcpc[uidx-1] },
{ text: 'Please wait... Initial refresh... &nbsp; <img src="spin.gif" alt="" style="vertical-align:middle">', rid: "WanCustomStatus"+u, ignore: !customStatusTimers[uidx-1] }
]);
W('<span id="b'+u+'_dhcpc" style="display:none">');
W('<input type="button" class="status-controls" onclick="dhcpc(\'renew\',\'wan'+u+'\')" value="Renew"> &nbsp;');

Loading…
Cancel
Save