diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml deleted file mode 100644 index 4e951ea..0000000 --- a/.github/workflows/shellcheck.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: ShellCheck - -on: push - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - shellcheck: - name: Shellcheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run ShellCheck - uses: ludeeus/action-shellcheck@master diff --git a/flexqos.asp b/flexqos.asp index 7d4998d..cf0d84e 100644 --- a/flexqos.asp +++ b/flexqos.asp @@ -1185,6 +1185,7 @@ function get_data() { success: function(response) { redraw(); draw_conntrack_table(); + check_bandwidth_flow(); timedEvent = setTimeout("get_data();", refreshRate * 1000); } }); @@ -1297,6 +1298,56 @@ function initialize_charts() { line_obj_ul=line_obj; // actually draws the chart on the page } // initialize_charts +function getFwBase () { + /* "3.0.0.6" → 3006 */ + const ver = document.getElementById('firmver')?.value || ''; + return parseInt(ver.replace(/\./g, ''), 10); // NaN if blank +} + +window.addEventListener('DOMContentLoaded', () => { + const fwBase = getFwBase(); + + const noflowMsg = (fwBase === 3006) + ? 'Adaptive QoS is not functioning correctly on ' + + 'BE-series routers due to a known ASUS / Trend Micro issue. ' + + 'Once ASUS resolves this, FlexQoS should work as expected.' + : 'Adaptive QoS appears to be malfunctioning. ' + + 'FlexQoS cannot apply its rules while the underlying QoS system is malfunctioning.'; + + const span = document.getElementById('noflow_msg'); + if (span) span.innerHTML = noflowMsg; +}); + +/* consider anything below this many *kilobits* per second “idle” */ +const NOFLOW_CUTOFF_KBPS = 1; // feel free to raise/lower +const NOFLOW_THRESHOLD = 5; // 5 × 3s refresh about 15 seconds + +let noFlowCounter = 0; + +function kbpsFromRateString(str) { + if (!str) return 0; + if (str.includes("Mbit")) return parseFloat(str) * 1000; + if (str.includes("Kbit")) return parseFloat(str); + return parseFloat(str) / 1000; +} + +function check_bandwidth_flow () { + let dlRate = 0, ulRate = 0; + + for (const e of tcdata_lan_array) dlRate += kbpsFromRateString(e[2]); + for (const e of tcdata_wan_array) ulRate += kbpsFromRateString(e[2]); + + if (dlRate < NOFLOW_CUTOFF_KBPS && ulRate < NOFLOW_CUTOFF_KBPS) { + noFlowCounter++; + } else { + noFlowCounter = 0; + } + + const warn = document.getElementById('noflow_notice'); + warn.style.display = (noFlowCounter >= NOFLOW_THRESHOLD) ? 'block' + : 'none'; +} + function change_chart_scale(input) { var chart_scale = cookie.get('flexqos_rate_graph_scale'); if ( input == null ) { @@ -2024,6 +2075,8 @@ function set_FlexQoS_mod_vars() { if ( custom_settings.flexqos_ver != undefined ) document.getElementById("flexqos_version").innerText = "v" + custom_settings.flexqos_ver; + if ( custom_settings.flexqos_branch != undefined ) + document.getElementById("flexqos_version").innerText += " Dev"; if ( custom_settings.flexqos_iptables == undefined ) // rules not yet converted to API format { @@ -2503,7 +2556,7 @@ function update_status(){ document.getElementById("versionStatus").style.display = ""; } else { - /* version update available */ + /* version update or hotfix available */ /* toggle update button */ document.getElementById("versionStatus").innerText = " " + verUpdateStatus + " available!"; document.getElementById("versionStatus").style.display = ""; @@ -2741,7 +2794,7 @@ function DelCookie(cookiename){