mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
move the improved site title to a separate new section, so now the hcaptcha page has it too
This commit is contained in:
@ -70,6 +70,7 @@ local body_template = [[
|
|||||||
</noscript>
|
</noscript>
|
||||||
</head>
|
</head>
|
||||||
<body data-pow="%s">
|
<body data-pow="%s">
|
||||||
|
%s
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
<noscript>
|
<noscript>
|
||||||
@ -102,12 +103,16 @@ local noscript_extra_template = [[
|
|||||||
</details>
|
</details>
|
||||||
]]
|
]]
|
||||||
|
|
||||||
-- 3 dots animation for proof of work
|
-- title with favicon and hostname
|
||||||
local pow_section_template = [[
|
local site_name_section_template = [[
|
||||||
<h3 class="pt">
|
<h3 class="pt">
|
||||||
<img src="/favicon.ico" width="32" height="32">
|
<img src="/favicon.ico" width="32" height="32">
|
||||||
%s
|
%s
|
||||||
</h3>
|
</h3>
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- spinner animation for proof of work
|
||||||
|
local pow_section_template = [[
|
||||||
<h3>
|
<h3>
|
||||||
Checking your browser for robots 🤖
|
Checking your browser for robots 🤖
|
||||||
</h3>
|
</h3>
|
||||||
@ -118,7 +123,9 @@ local pow_section_template = [[
|
|||||||
|
|
||||||
-- message, hcaptcha form and submit button
|
-- message, hcaptcha form and submit button
|
||||||
local captcha_section_template = [[
|
local captcha_section_template = [[
|
||||||
<p class="pt">Please solve the captcha to continue.</p>
|
<h3>
|
||||||
|
Please solve the captcha to continue.
|
||||||
|
</h3>
|
||||||
<form class="jsonly" method="POST">
|
<form class="jsonly" method="POST">
|
||||||
<div class="h-captcha" data-sitekey="%s"></div>
|
<div class="h-captcha" data-sitekey="%s"></div>
|
||||||
<script src="https://hcaptcha.com/1/api.js" async defer></script>
|
<script src="https://hcaptcha.com/1/api.js" async defer></script>
|
||||||
@ -135,6 +142,7 @@ function _M.view(applet)
|
|||||||
generated_work = utils.generate_secret(applet, pow_cookie_secret, true, "")
|
generated_work = utils.generate_secret(applet, pow_cookie_secret, true, "")
|
||||||
|
|
||||||
-- define body sections
|
-- define body sections
|
||||||
|
local site_name_body = ""
|
||||||
local captcha_body = ""
|
local captcha_body = ""
|
||||||
local pow_body = ""
|
local pow_body = ""
|
||||||
local noscript_extra_body = ""
|
local noscript_extra_body = ""
|
||||||
@ -152,15 +160,16 @@ function _M.view(applet)
|
|||||||
--
|
--
|
||||||
|
|
||||||
-- pow at least is always enabled when reaching bot-check page
|
-- pow at least is always enabled when reaching bot-check page
|
||||||
|
site_name_body = string.format(site_name_section_template, host)
|
||||||
if captcha_enabled then
|
if captcha_enabled then
|
||||||
captcha_body = string.format(captcha_section_template, captcha_sitekey)
|
captcha_body = string.format(captcha_section_template, captcha_sitekey)
|
||||||
else
|
else
|
||||||
pow_body = string.format(pow_section_template, host)
|
pow_body = pow_section_template
|
||||||
noscript_extra_body = string.format(noscript_extra_template, generated_work)
|
noscript_extra_body = string.format(noscript_extra_template, generated_work)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- sub in the body sections
|
-- sub in the body sections
|
||||||
response_body = string.format(body_template, generated_work, pow_body, captcha_body, noscript_extra_body, ray_id)
|
response_body = string.format(body_template, generated_work, site_name_body, pow_body, captcha_body, noscript_extra_body, ray_id)
|
||||||
response_status_code = 403
|
response_status_code = 403
|
||||||
elseif applet.method == "POST" then
|
elseif applet.method == "POST" then
|
||||||
local parsed_body = url.parseQuery(applet.receive(applet))
|
local parsed_body = url.parseQuery(applet.receive(applet))
|
||||||
|
Reference in New Issue
Block a user