diff --git a/src/lua/endpoints/edit_post.lua b/src/lua/endpoints/edit_post.lua index 92a0927..8df2fec 100644 --- a/src/lua/endpoints/edit_post.lua +++ b/src/lua/endpoints/edit_post.lua @@ -92,6 +92,7 @@ local function edit_post(req) cache.dirty(string.format("%s/%s",config.domain,id_enc)) -- This place to read this post cache.dirty(string.format("%s",config.domain)) -- The site index (ex, if the author changed the paste from their's to "Anonymous", the cache should reflect that). cache.dirty(string.format("%s.%s",author,config.domain)) -- The author's index, same reasoning as above. + cache.dirty(string.format("%s-logout",config.domain)) http_response_header(req,"Location",loc) http_response(req,303,"") return diff --git a/src/lua/endpoints/index_get.lua b/src/lua/endpoints/index_get.lua index 3784180..e80b84d 100644 --- a/src/lua/endpoints/index_get.lua +++ b/src/lua/endpoints/index_get.lua @@ -112,7 +112,8 @@ local function index_get(req) end) elseif host == config.domain and author then --Display home page with "log out" button - text = cache.render(config.domain .. "-logout", function() + local cachepath = string.format("%s-logout",config.domain) + text = cache.render(cachepath, function() return get_site_home(req,true) end) elseif host ~= config.domain and author ~= subdomain then diff --git a/src/lua/endpoints/paste_post.lua b/src/lua/endpoints/paste_post.lua index bf61438..c6781a3 100644 --- a/src/lua/endpoints/paste_post.lua +++ b/src/lua/endpoints/paste_post.lua @@ -148,6 +148,7 @@ local function author_paste(req,ps) cache.dirty(string.format("%s.%s",author,config.domain)) cache.dirty(string.format("%s/%s",config.domain,url)) cache.dirty(string.format("%s",config.domain)) + cache.dirty(string.format("%s-logout",config.domain)) end http_response_header(req,"Location",loc) http_response(req,303,"") diff --git a/src/lua/endpoints/read_get.lua b/src/lua/endpoints/read_get.lua index b13c098..877fe08 100644 --- a/src/lua/endpoints/read_get.lua +++ b/src/lua/endpoints/read_get.lua @@ -8,6 +8,7 @@ local util = require("util") local cache = require("cache") local pages = require("pages") local config = require("config") +local zlib = require("zlib") local stmnt_read, stmnt_update_views, stmnt_comments @@ -175,6 +176,12 @@ local function read_get(req) text = pages.read(ps) end end + + --If this isn't unlisted, dirty everywhere the hit counter is shown + cache.dirty(string.format("%s",config.domain)) + cache.dirty(string.format("%s/%s",config.domain,ps.idp)) -- This place to read this post + cache.dirty(string.format("%s/%s",config.domain,ps.idp)) -- The author's index page + assert(text) http_response(req,200,text) return