Skip to content

Commit

Permalink
gluon-status-page-api: merge back into gluon-status-page
Browse files Browse the repository at this point in the history
All Access-Control-Allow-Origin are removed to improve users' privacy. As
the status page API is thus not useful without the status page anymore,
merge them back into a single package.

The status-page-api respondd provider is removed as well.

Fixes #1194
  • Loading branch information
neocturne committed Feb 26, 2018
1 parent 88906f2 commit fdf823a
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 167 deletions.
42 changes: 0 additions & 42 deletions package/gluon-status-page-api/Makefile

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

47 changes: 0 additions & 47 deletions package/gluon-status-page-api/src/respondd.c

This file was deleted.

9 changes: 5 additions & 4 deletions package/gluon-status-page/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ define Package/gluon-status-page
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Status page showing information about the node
DEPENDS:=+gluon-web +gluon-status-page-api
DEPENDS:=+gluon-web +gluon-neighbour-info +gluon-respondd +uhttpd +sse-multiplex +libiwinfo +libjson-c +libnl-tiny +libbatadv
endef

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Compile
$(call Build/Compile/Default)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
$(call GluonBuildI18N,gluon-status-page,i18n)
endef

define Package/gluon-status-page/install
$(INSTALL_DIR) $(1)/lib/gluon/status-page/providers
$(INSTALL_BIN) $(PKG_BUILD_DIR)/{neighbours-batadv,stations} $(1)/lib/gluon/status-page/providers/

$(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

echo 'Access-Control-Allow-Origin: *'

CMD='exec /lib/gluon/status-page/providers/neighbours-batadv'

exec /usr/sbin/sse-multiplex "$CMD"
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ badrequest() {
exit 1
}

echo 'Access-Control-Allow-Origin: *'

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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ badrequest() {
exit 1
}

echo 'Access-Control-Allow-Origin: *'

batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" || badrequest

CMD="exec /lib/gluon/status-page/providers/stations '$QUERY_STRING'"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

echo 'Access-Control-Allow-Origin: *'

CMD='exec gluon-neighbour-info -s "" -l -d ::1 -p 1001 -t 3 -r statistics'

exec /usr/sbin/sse-multiplex "$CMD"
38 changes: 38 additions & 0 deletions package/gluon-status-page/luasrc/lib/gluon/upgrade/500-status-page
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/lua

local uci = require('simple-uci').cursor()


local function get_mem_total()
for line in io.lines('/proc/meminfo') do
local match = line:match('^MemTotal:%s+(%d+)')
if match then
return tonumber(match)
end
end
end

local max_requests = 32
if get_mem_total() < 48*1024 then
max_requests = 16
end

uci:section('uhttpd', 'uhttpd', 'main', {
listen_http = { '0.0.0.0:80', '[::]:80' },
listen_https = {},

home = '/lib/gluon/status-page/www',
max_requests = max_requests,
})
uci:save('uhttpd')


for _, zone in ipairs({'mesh', 'local_client'}) do
uci:section('firewall', 'rule', zone .. '_http', {
src = zone,
dest_port = '80',
proto = 'tcp',
target = 'ACCEPT',
})
end
uci:save('firewall')
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@ ifeq ($(origin LIBBATADV_CFLAGS) $(origin LIBBATADV_LDLIBS), undefined undefined
LIBBATADV_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBBATADV_NAME))
endif

all: neighbours-batadv stations respondd.so
all: neighbours-batadv stations

neighbours-batadv: neighbours-batadv.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_JSONC) $(LIBNL_CFLAGS) $(LIBBATADV_CFLAGS) $(LDFLAGS) $(LDFLAGS_JSONC) $(LIBNL_LDLIBS) $(LIBBATADV_LDLIBS) -Wall -o $@ $^ $(LDLIBS)

stations: stations.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_JSONC) $(LDFLAGS) $(LDFLAGS_JSONC) -Wall -o $@ $^ $(LDLIBS) -liwinfo

respondd.so: respondd.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared -fPIC -o $@ $^ $(LDLIBS)
File renamed without changes.

0 comments on commit fdf823a

Please sign in to comment.