Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
8b63ac79
Commit
8b63ac79
authored
8 years ago
by
Christof Schulze
Committed by
Matthias Schiffer
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gluon-statuspage-api: make lib/gluon/status-page/www/cgi-bin/interfaces mesh-protocol agnostic
parent
b3e609dc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package/gluon-status-page-api/Makefile
+1
-1
1 addition, 1 deletion
package/gluon-status-page-api/Makefile
package/gluon-status-page-api/luasrc/lib/gluon/status-page/www/cgi-bin/interfaces
+8
-11
8 additions, 11 deletions
...e-api/luasrc/lib/gluon/status-page/www/cgi-bin/interfaces
with
9 additions
and
12 deletions
package/gluon-status-page-api/Makefile
+
1
−
1
View file @
8b63ac79
...
...
@@ -14,7 +14,7 @@ define Package/gluon-status-page-api
SECTION
:=
gluon
CATEGORY
:=
Gluon
TITLE
:=
API
for
gluon-status-page
DEPENDS
:=
+gluon-core +uhttpd +sse-multiplex +gluon-neighbour-info +gluon-respondd +libiwinfo +libjson-c +libnl-tiny
DEPENDS
:=
+gluon-core +uhttpd +sse-multiplex +gluon-neighbour-info +gluon-respondd +libiwinfo +libjson-c +libnl-tiny
+libubus-lua
endef
define
Build/Prepare
...
...
This diff is collapsed.
Click to expand it.
package/gluon-status-page-api/luasrc/lib/gluon/status-page/www/cgi-bin/interfaces
+
8
−
11
View file @
8b63ac79
#!/usr/bin/lua
util
=
require
'gluon.util'
fs
=
require
'nixio.fs'
json
=
require
'luci.jsonc'
ubus
=
require
'ubus'
io.write
(
"Access-Control-Allow-Origin: *\n"
)
io.write
(
"Content-type: application/json\n\n"
)
f
=
io.popen
(
'batctl if'
)
local
uconn
=
ubus
.
connect
()
if
not
uconn
then
error
(
"Failed to connect to ubusd"
)
end
list
=
util
.
get_mesh_devices
(
uconn
)
ubus
.
close
(
uconn
)
interfaces
=
{}
for
line
in
f
:
lines
()
do
ifname
=
line
:
match
(
'^(.-):'
)
if
ifname
~=
nil
then
for
_
,
ifname
in
ipairs
(
list
)
do
pcall
(
function
()
local
address
=
util
.
trim
(
fs
.
readfile
(
'/sys/class/net/'
..
ifname
..
'/address'
))
interfaces
[
ifname
]
=
{
address
=
address
}
end
)
end
end
f
:
close
()
io.write
(
json
.
stringify
(
interfaces
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment