gluon/package/gluon-status-page/luasrc/lib/gluon/upgrade/500-status-page
Matthias Schiffer fdf823a3a2
gluon-status-page-api: merge back into gluon-status-page
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
2018-02-26 02:20:38 +01:00

39 lines
726 B
Lua
Executable File

#!/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')