From 98fc3b797c49bd18f67bdb39f1c24d0ba40cd76a Mon Sep 17 00:00:00 2001
From: onefang
Date: Sat, 4 Jan 2020 17:26:54 +1000
Subject: Add support for using CGI for the PHP graphs.
---
apt-panopticommon.lua | 9 +++++++++
apt-panopticon-report-email-web.lua | 9 ++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index dddcc9c..4a1a5e7 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -113,6 +113,12 @@ APT.options =
-- "Prometheus",
},
},
+ cgi =
+ {
+ typ = "boolean",
+ help = "",
+ value = false,
+ },
}
APT.args = {}
@@ -149,6 +155,9 @@ APT.parseArgs = function(args)
elseif "-r" == a then
APT.redir = true
sendArgs = sendArgs .. a .. " "
+ elseif "--cgi" == a then
+ APT.options.cgi.value = true
+ sendArgs = sendArgs .. a .. " "
elseif "--low" == a then
APT.options.bandwidth.value = 0
APT.options.timeout.value = 2
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index 1a379ec..93700ca 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -307,6 +307,9 @@ end
local makeIPlist = function(hosts)
local m = {}
+ local adr = ''
+ if APT.options.cgi.value then adr = 'php.cgi/' end
+ adr = '/' .. adr .. 'apt-panopticon/apt-panopticon_cgp/host.php?h='
for k, v in pairs(hosts) do
local log = k
local n = {}
@@ -323,15 +326,15 @@ local makeIPlist = function(hosts)
if type(w) == "table" then
n[l] = {}
for i, u in pairs(w) do
- local log = '[graphs] ' .. logCount(k, i)
+ local log = '[graphs] ' .. logCount(k, i)
if "" == log then n[l][i] = u else n[l][log .. " " .. revDNS(hosts, k, i)] = u end
end
else
- local log = '[graphs] ' .. logCount(k, l)
+ local log = '[graphs] ' .. logCount(k, l)
if "" == log then n[l] = w else n[log .. " " .. revDNS(hosts, k, l)] = w end
end
end
- m['[graphs] ' .. log .. " DNS entries -" .. redirs(hosts, k)] = n
+ m['[graphs] ' .. log .. " DNS entries -" .. redirs(hosts, k)] = n
end
return m
end
--
cgit v1.1