Merge dcb32b460b
into d0831aa83a
This commit is contained in:
commit
cf66c3a293
@ -1,13 +1,19 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/lua
|
||||
local mesh = require 'gluon.mesh'
|
||||
local querystring = os.getenv("QUERY_STRING")
|
||||
|
||||
badrequest() {
|
||||
echo 'Status: 400 Bad Request'
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
print('Access-Control-Allow-Origin: *\n')
|
||||
|
||||
echo 'Access-Control-Allow-Origin: *'
|
||||
for interface, _ in pairs(mesh.interfaces()) do
|
||||
if querystring
|
||||
then
|
||||
if string.find(interface, querystring)
|
||||
then
|
||||
os.execute("/usr/bin/gluon-neighbour-info -s neighbour -i " .. querystring .. " -d ff02::2:1001 -p 1001 -r nodeinfo");
|
||||
os.exit(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest
|
||||
|
||||
exec /usr/bin/gluon-neighbour-info -s neighbour -i "$QUERY_STRING" -d ff02::2:1001 -p 1001 -r nodeinfo
|
||||
print("Status: 400 Bad Request\n")
|
||||
os.exit(1)
|
||||
|
@ -1,15 +1,20 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/lua
|
||||
local mesh = require 'gluon.mesh'
|
||||
local querystring = os.getenv("QUERY_STRING")
|
||||
|
||||
badrequest() {
|
||||
echo 'Status: 400 Bad Request'
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
print('Access-Control-Allow-Origin: *\n')
|
||||
|
||||
echo 'Access-Control-Allow-Origin: *'
|
||||
for interface, _ in pairs(mesh.interfaces()) do
|
||||
if querystring
|
||||
then
|
||||
if string.find(interface, querystring)
|
||||
then
|
||||
os.execute("/usr/sbin/sse-multiplex /lib/gluon/status-page/providers/stations " .. querystring );
|
||||
os.exit(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest
|
||||
|
||||
CMD="exec /lib/gluon/status-page/providers/stations '$QUERY_STRING'"
|
||||
|
||||
exec /usr/sbin/sse-multiplex "$CMD"
|
||||
print("Status: 400 Bad Request\n")
|
||||
os.exit(1)
|
||||
|
@ -3,16 +3,14 @@
|
||||
util = require 'luci.util'
|
||||
json = require 'luci.jsonc'
|
||||
fs = require 'nixio.fs'
|
||||
mesh = require 'gluon.mesh'
|
||||
|
||||
io.write("Access-Control-Allow-Origin: *\n")
|
||||
io.write("Content-type: application/json\n\n")
|
||||
|
||||
list = util.exec('batctl if')
|
||||
|
||||
interfaces = {}
|
||||
|
||||
for _, line in ipairs(util.split(list)) do
|
||||
ifname = line:match('^(.-):')
|
||||
for interface, _ in ipairs(mesh.interfaces()) do
|
||||
if ifname ~= nil then
|
||||
pcall(function()
|
||||
local address = util.trim(fs.readfile('/sys/class/net/' .. ifname .. '/address'))
|
||||
|
Loading…
Reference in New Issue
Block a user