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
|
||||
SECTION:=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
|
||||
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'
|
||||
local json = require 'luci.jsonc'
|
||||
local util = require 'luci.util'
|
||||
local nixio = require 'nixio'
|
||||
echo "Access-Control-Allow-Origin: *"
|
||||
|
||||
local announce_dir = '/lib/gluon/announce/statistics.d/'
|
||||
|
||||
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
|
||||
exec gluon-neighbour-info -s "" -l -d ::1 -p 1001 -t 1 -r statistics
|
||||
|
@ -1,15 +1,8 @@
|
||||
#!/usr/bin/lua
|
||||
#!/bin/sh
|
||||
|
||||
local announce = require 'gluon.announce'
|
||||
local json = require 'luci.jsonc'
|
||||
local util = require 'luci.util'
|
||||
local nixio = require 'nixio'
|
||||
cat <<EOF
|
||||
Access-Control-Allow-Origin: *
|
||||
Content-type: application/json
|
||||
|
||||
local announce_dir = '/lib/gluon/announce/nodeinfo.d/'
|
||||
|
||||
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()
|
||||
EOF
|
||||
exec gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r nodeinfo
|
||||
|
Loading…
Reference in New Issue
Block a user