From 0588a838ce7fd91f85e91f2d53f7f9d8f81c6409 Mon Sep 17 00:00:00 2001 From: the lemons Date: Sun, 6 Mar 2022 11:41:24 -0600 Subject: log IP addresses --- zzcxz.cgi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zzcxz.cgi b/zzcxz.cgi index 54f2a7f..5aad998 100755 --- a/zzcxz.cgi +++ b/zzcxz.cgi @@ -330,6 +330,10 @@ local function new_action(page, action, result) end assert(old:write(('%s:%s\n'):format(new_name, action))) + if env "REMOTE_ADDR" then + new:write(('!ip %s\n'):format(env "REMOTE_ADDR")) + end + if directives.backlinks then for _,d in ipairs(directives.backlinks) do assert(new:write(('%s:%s\n'):format(d.page, d.action))) @@ -631,6 +635,8 @@ map["^/g/(%w%w%w%w%w)/raw$"] = function(p) local page = load_page(p, true) if not page then return not_found() end + page = page:gsub("\n!ip [^\n]*", "") + return page, { content_type = 'text/plain', headers = { ['access-control-allow-origin'] = "*" } -- cgit v1.2.3