Merge 0fe5bebe20 into ba62b698c0
				
					
				
			This commit is contained in:
		
						commit
						5bbef161bb
					
				| @ -8,6 +8,7 @@ badrequest() { | |||||||
| 
 | 
 | ||||||
| echo 'Access-Control-Allow-Origin: *' | echo 'Access-Control-Allow-Origin: *' | ||||||
| 
 | 
 | ||||||
| batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest | #batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest | ||||||
|  | lua -e 'mesh = require(gluon.mesh); for interface, _ in ipairs(mesh.interfaces()) do print(interface .. "\n"); end;' | grep -qxF "$QUERY_STRING" || badrequest | ||||||
| 
 | 
 | ||||||
| exec /usr/bin/gluon-neighbour-info -s neighbour -i "$QUERY_STRING" -d ff02::2:1001 -p 1001 -r nodeinfo | exec /usr/bin/gluon-neighbour-info -s neighbour -i "$QUERY_STRING" -d ff02::2:1001 -p 1001 -r nodeinfo | ||||||
|  | |||||||
| @ -8,7 +8,8 @@ badrequest() { | |||||||
| 
 | 
 | ||||||
| echo 'Access-Control-Allow-Origin: *' | echo 'Access-Control-Allow-Origin: *' | ||||||
| 
 | 
 | ||||||
| batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest | #batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest | ||||||
|  | lua -e 'mesh = require(gluon.mesh); for interface, _ in ipairs(mesh.interfaces()) do print(interface .. "\n"); end;' | grep -qxF "$QUERY_STRING" || badrequest | ||||||
| 
 | 
 | ||||||
| CMD="exec /lib/gluon/status-page/providers/stations '$QUERY_STRING'" | CMD="exec /lib/gluon/status-page/providers/stations '$QUERY_STRING'" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -3,16 +3,16 @@ | |||||||
| util = require 'luci.util' | util = require 'luci.util' | ||||||
| json = require 'luci.jsonc' | json = require 'luci.jsonc' | ||||||
| fs = require 'nixio.fs' | fs = require 'nixio.fs' | ||||||
|  | mesh = require 'gluon.mesh' | ||||||
| 
 | 
 | ||||||
| io.write("Access-Control-Allow-Origin: *\n") | io.write("Access-Control-Allow-Origin: *\n") | ||||||
| io.write("Content-type: application/json\n\n") | io.write("Content-type: application/json\n\n") | ||||||
| 
 | 
 | ||||||
| list = util.exec('batctl if') | -- list = util.exec('batctl if') | ||||||
| 
 | 
 | ||||||
| interfaces = {} | interfaces = {} | ||||||
| 
 | 
 | ||||||
| for _, line in ipairs(util.split(list)) do | for interface, _ in ipairs(mesh.interfaces()) do | ||||||
|   ifname = line:match('^(.-):') |  | ||||||
|   if ifname ~= nil then |   if ifname ~= nil then | ||||||
|     pcall(function() |     pcall(function() | ||||||
|       local address = util.trim(fs.readfile('/sys/class/net/' .. ifname .. '/address')) |       local address = util.trim(fs.readfile('/sys/class/net/' .. ifname .. '/address')) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user