Skip to content
Snippets Groups Projects
Select Git revision
  • 14481851f6870084501bdc95fca22f562732218a
  • experimental default protected
  • v2023.2.5-ffs
  • nrb/ex400-remove-wps
  • nrb/airmax-test
  • v2023.2.4-ffs
  • nrb/ar9344-reset-sequence
  • autinerd/experimental-openwrt-24.10
  • v2023.2.3-ffs
  • v2023.2.2-ffs
  • v2023.2-ffs
  • v2023.1-ffs
  • v2022.1.4-ffs
  • feature/addMikrotikwAP
  • v2022.1.3-ffs
  • v2021.1.2-ffs
  • v2022.1.1-ffs
  • master protected
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • experimental-2025-07-12
  • experimental-2025-07-12-base
  • experimental-2025-07-04
  • experimental-2025-07-04-base
  • experimental-2025-07-01
  • experimental-2025-07-01-base
  • experimental-2025-06-25
  • experimental-2025-06-25-base
  • experimental-2025-06-24
  • experimental-2025-06-24-base
  • experimental-2025-06-22
  • experimental-2025-06-22-base
  • v2023.2.5-ffs0.1
  • experimental-2025-06-08
  • experimental-2025-06-08-base
  • experimental-2025-06-06
  • experimental-2025-06-06-base
  • experimental-2025-05-27
  • experimental-2025-05-27-base
  • experimental-2025-05-18
41 results

status-page.html

Blame
  • status-page.html 6.07 KiB
    <%-
    	local ubus = require 'ubus'
    	local unistd = require 'posix.unistd'
    	local util = require 'gluon.util'
    
    	local translations = {}
    
    	local function _(v)
    		translations[v] = translate(v)
    	end
    
    	-- i18n strings for JavaScript
    	_('.') -- decimal point
    	_('connected')
    	_('not connected')
    	_('1 day')
    	_('%s days')
    	_('%s used')
    	_('%s packets/s')
    
    	local function get_mesh()
    		local f = loadfile('/lib/gluon/status-page/mesh.lua')
    		if f then
    			return f()
    		end
    		return {}
    	end
    
    	local mesh = get_mesh()
    
    	local function get_interfaces()
    		local uconn = ubus.connect()
    		if not uconn then
    			error('failed to connect to ubus')
    		end
    		local interfaces = util.get_mesh_devices(uconn)
    		ubus.close(uconn)
    		table.sort(interfaces)
    		return interfaces
    	end
    
    	local function is_wireless(iface)
    		while true do
    			local pattern = '/sys/class/net/' .. iface .. '/lower_*'
    			local lower = util.glob(pattern)[1]
    			if not lower then break end
    
    			iface = lower:sub(pattern:len())
    		end
    
    		return unistd.access('/sys/class/net/' .. iface .. '/wireless') ~= nil
    	end
    
    	local interfaces = get_interfaces()
    
    	local function sorted(t)
    		t = {unpack(t)}
    		table.sort(t)
    		return t
    	end
    
    	local function enabled(v)
    		return v and translate('enabled') or translate('disabled')
    	end
    
    	local function statistics(key, format)
    		return string.format('<span data-statistics="%s" data-format="%s"></span>', pcdata(key), pcdata(format or 'id'))
    	end
    
    	local function statisticsTraffic(key)