gluon-alfred/gluon-status-page: Query gluon-announced
By not executing all scripts from gluon.announce themselves, both should be considerably faster and lighter on RAM usage.
This commit is contained in:
parent
d2ff7d5c22
commit
bae6519279
@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk
|
|||||||
define Package/gluon-alfred
|
define Package/gluon-alfred
|
||||||
SECTION:=gluon
|
SECTION:=gluon
|
||||||
CATEGORY:=Gluon
|
CATEGORY:=Gluon
|
||||||
DEPENDS:=+gluon-core +gluon-announce +gluon-cron +alfred
|
DEPENDS:=+gluon-core +gluon-announced +gluon-neighbour-info +gluon-cron +alfred
|
||||||
TITLE:=Configure alfred
|
TITLE:=Configure alfred
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
* * * * * /lib/gluon/announce/collect.lua nodeinfo | gzip | alfred -s 158; /lib/gluon/announce/collect.lua statistics | gzip | alfred -s 159; /lib/gluon/announce/collect.lua neighbours | gzip | alfred -s 160
|
* * * * * gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r nodeinfo | gzip | alfred -s 158; gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r statistics | gzip | alfred -s 159; gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r neighbours | gzip | alfred -s 160
|
||||||
|
@ -1,18 +1,5 @@
|
|||||||
#!/usr/bin/lua
|
#!/bin/sh
|
||||||
|
|
||||||
local announce = require 'gluon.announce'
|
echo "Access-Control-Allow-Origin: *"
|
||||||
local json = require 'luci.jsonc'
|
|
||||||
local util = require 'luci.util'
|
|
||||||
local nixio = require 'nixio'
|
|
||||||
|
|
||||||
local announce_dir = '/lib/gluon/announce/statistics.d/'
|
exec gluon-neighbour-info -s "" -l -d ::1 -p 1001 -t 1 -r statistics
|
||||||
|
|
||||||
io.write("Access-Control-Allow-Origin: *\n")
|
|
||||||
io.write("Content-type: text/event-stream\n\n")
|
|
||||||
|
|
||||||
while true do
|
|
||||||
local data = json.stringify(announce.collect_dir(announce_dir))
|
|
||||||
io.write("data: " .. data .. "\n\n")
|
|
||||||
io.flush()
|
|
||||||
nixio.nanosleep(1, 0)
|
|
||||||
end
|
|
||||||
|
@ -1,15 +1,8 @@
|
|||||||
#!/usr/bin/lua
|
#!/bin/sh
|
||||||
|
|
||||||
local announce = require 'gluon.announce'
|
cat <<EOF
|
||||||
local json = require 'luci.jsonc'
|
Access-Control-Allow-Origin: *
|
||||||
local util = require 'luci.util'
|
Content-type: application/json
|
||||||
local nixio = require 'nixio'
|
|
||||||
|
|
||||||
local announce_dir = '/lib/gluon/announce/nodeinfo.d/'
|
EOF
|
||||||
|
exec gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r nodeinfo
|
||||||
io.write("Access-Control-Allow-Origin: *\n")
|
|
||||||
io.write("Content-type: application/json\n\n")
|
|
||||||
|
|
||||||
local data = json.stringify(announce.collect_dir(announce_dir))
|
|
||||||
io.write(data)
|
|
||||||
io.flush()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user