Merge pull request #2006 from dibdot/adblock
luci-app-adblock: small fixes
This commit is contained in:
commit
4a85973a9a
3 changed files with 23 additions and 28 deletions
|
@ -6,11 +6,9 @@ module("luci.controller.adblock", package.seeall)
|
||||||
local sys = require("luci.sys")
|
local sys = require("luci.sys")
|
||||||
local util = require("luci.util")
|
local util = require("luci.util")
|
||||||
local http = require("luci.http")
|
local http = require("luci.http")
|
||||||
local templ = require("luci.template")
|
|
||||||
local i18n = require("luci.i18n")
|
local i18n = require("luci.i18n")
|
||||||
local json = require("luci.jsonc")
|
local json = require("luci.jsonc")
|
||||||
local uci = require("luci.model.uci").cursor()
|
local uci = require("luci.model.uci").cursor()
|
||||||
local fs = require("nixio.fs")
|
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
if not nixio.fs.access("/etc/config/adblock") then
|
if not nixio.fs.access("/etc/config/adblock") then
|
||||||
|
@ -48,14 +46,12 @@ function status_update()
|
||||||
|
|
||||||
rt_file = uci:get("adblock", "global", "adb_rtfile") or "/tmp/adb_runtime.json"
|
rt_file = uci:get("adblock", "global", "adb_rtfile") or "/tmp/adb_runtime.json"
|
||||||
|
|
||||||
if fs.access(rt_file) then
|
if nixio.fs.access(rt_file) then
|
||||||
content = json.parse(fs.readfile(rt_file))
|
content = json.parse(nixio.fs.readfile(rt_file) or "")
|
||||||
if content then
|
|
||||||
http.prepare_content("application/json")
|
http.prepare_content("application/json")
|
||||||
http.write_json(content)
|
http.write_json(content)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
function logread()
|
function logread()
|
||||||
local content
|
local content
|
||||||
|
|
|
@ -46,7 +46,7 @@ local anonclass = (not self.anonymous or self.sectiontitle) and "named" or "ano
|
||||||
|
|
||||||
<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
|
<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
|
||||||
<% if self.title then -%>
|
<% if self.title then -%>
|
||||||
<legend><%=self.title%></legend>
|
<h3><%=self.title%></h3>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
<div class="cbi-section-descr"><%=self.description%></div>
|
<div class="cbi-section-descr"><%=self.description%></div>
|
||||||
<div class="cbi-section-node">
|
<div class="cbi-section-node">
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<%#
|
<%#
|
||||||
Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
|
Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
|
||||||
This is free software, licensed under the Apache License, Version 2.0
|
This is free software, licensed under the Apache License, Version 2.0
|
||||||
local sys = require("luci.sys")
|
|
||||||
|
|
||||||
-%>
|
-%>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.runtime
|
.runtime
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue