fix header phase and fix error template

This commit is contained in:
bunkerity 2023-04-18 14:58:20 +02:00
parent d3d18e15a6
commit 29cb6fe161
2 changed files with 13 additions and 9 deletions

View File

@ -25,8 +25,8 @@ if not plugins then
end
plugins = cjson.decode(plugins)
-- Call header() methods
logger:log(ngx.INFO, "calling header() methods of plugins ...")
-- Call head() methods
logger:log(ngx.INFO, "calling head() methods of plugins ...")
for i, plugin in ipairs(plugins) do
-- Require call
local plugin_lua, err = helpers.require_plugin(plugin.id)
@ -35,27 +35,28 @@ for i, plugin in ipairs(plugins) do
elseif plugin_lua == nil then
logger:log(ngx.INFO, err)
else
-- Check if plugin has header method
if plugin_lua.header ~= nil then
-- Check if plugin has head method
if plugin_lua.head ~= nil then
-- New call
local ok, plugin_obj = helpers.new_plugin(plugin_lua)
if not ok then
logger:log(ngx.ERR, plugin_obj)
else
local ok, ret = helpers.call_plugin(plugin_obj, "head")
if not ok then
logger:log(ngx.ERR, ret)
elseif not ret.ret then
logger:log(ngx.ERR, plugin.id .. ":header() call failed : " .. ret.msg)
logger:log(ngx.ERR, plugin.id .. ":head() call failed : " .. ret.msg)
else
logger:log(ngx.NOTICE, plugin.id .. ":header() call successful : " .. ret.msg)
logger:log(ngx.NOTICE, plugin.id .. ":head() call successful : " .. ret.msg)
end
end
else
logger:log(ngx.INFO, "skipped execution of " .. plugin.id .. " because method header() is not defined")
logger:log(ngx.INFO, "skipped execution of " .. plugin.id .. " because method head() is not defined")
end
end
end
logger:log(ngx.INFO, "called header() methods of plugins")
logger:log(ngx.INFO, "called head() methods of plugins")
return true

View File

@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{title}}</title>
{-raw-}
<link
rel="icon"
href="data:image/svg+xml, %3Csvg version='1.0' xmlns='http://www.w3.org/2000/svg' width='96.000000pt' height='96.000000pt' viewBox='0 0 96.000000 96.000000' preserveAspectRatio='xMidYMid meet'%3E%3Cg transform='translate(0.000000,96.000000) scale(0.100000,-0.100000)'%0Afill='%23085577' stroke='none'%3E%3Cpath d='M535 863 c-22 -2 -139 -17 -260 -34 -228 -31 -267 -43 -272 -85 -2%0A-10 23 -181 55 -379 l57 -360 400 0 400 0 20 40 c16 31 20 59 19 125 -1 100%0A-24 165 -73 199 -41 29 -46 57 -22 111 30 67 29 188 -3 256 -13 28 -37 60 -53%0A72 -55 39 -169 62 -268 55z m-15 -348 c30 -16 60 -61 60 -90 0 -10 -8 -33 -17%0A-52 -16 -34 -16 -41 0 -116 9 -44 15 -82 12 -85 -6 -7 -92 -21 -131 -21 l-31%0A-1 -6 85 c-4 75 -8 89 -31 112 -20 20 -26 36 -26 70 0 38 5 50 34 79 39 39 86%0A45 136 19z'/%3E%3C/g%3E%3C/svg%3E"
@ -231,13 +232,14 @@
</div>
<!-- end lottie -->
{-raw-}
<!-- text -->
<div id="text-container" class="-translate-y-12 hidden w-full lg:w-[400px] xl:w-1/3 z-10 flex flex-col justify-center items-center">
<h1 class="uppercase title text-2xl xsm:text-3xl sm:text-4xl 2xl:text-5xl 3xl:text-6xl tracking-wide text-white order-1 text-center">{{error_title}}</h1>
<p class="title text-5xl xsm:text-6xl sm:text-7xl 2xl:text-8xl 3xl:text-9xl tracking-wide text-white order-2 uppercase ">{{error_code}}</p>
<p class="mx-2 mt-4 text text-xs xs:text-sm sm:text-base 2xl:text-lg 3xl:text-xl text-secondary order-3 text-center">
{{error_text}}
{-raw-}
</p>
<a
href="/"
@ -304,3 +306,4 @@
</body>
</html>
{-raw-}