add 540-geolocator-settings

This commit is contained in:
Jan-Tarek Butt 2017-08-04 20:07:36 +02:00
parent 749b942288
commit f96e72d919

View File

@ -0,0 +1,33 @@
#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require('simple-uci').cursor()
local config = 'geolocator'
local static_location = uci:get(config, 'settings', 'static_location')
local auto_location = uci:get(config, 'settings', 'auto_location')
if not auto_location then
auto_location = 0
if site.geolocator.autolocation then
auto_location = tonumber(site.geolocator.autolocation)
end
end
local refresh_interval = uci:get(config, 'settings', 'refresh_interval')
if not refresh_interval then
refresh_interval = 43200 --12h
if site.geolocator.interval then
refresh_interval = tonumber(site.geolocator.interval)
end
end
uci:delete(config, 'settings')
uci:section(config, config, 'settings', {
static_location = static_location,
refresh_interval = refresh_interval,
auto_location = auto_location,
blacklist = site.geolocator.blacklist,
})
uci:save(config)