diff --git a/templates/main.js b/templates/main.js index 422759b4..d8ae450e 100755 --- a/templates/main.js +++ b/templates/main.js @@ -262,26 +262,28 @@ window.onCaptchaLoadTurnstile_post_thread = function() { // Should be called by the captcha API when it's ready. Ugly I know... D: function onCaptchaLoadTurnstile(action) { - let renderer = { - renderOn: function(container) { - let widgetId = turnstile.render(container, { - sitekey: "{{ config.turnstile_public }}", - action: action, - }); - if (widgetId === undefined) { - return null; + if (captcha_renderer === null) { + let renderer = { + renderOn: function(container) { + let widgetId = turnstile.render(container, { + sitekey: "{{ config.turnstile_public }}", + action: action, + }); + if (widgetId === undefined) { + return null; + } + return widgetId; + }, + remove: function(widgetId) { + turnstile.remove(widgetId); + }, + reset: function(widgetId) { + turnstile.reset(widgetId); } - return widgetId; - }, - remove: function(widgetId) { - turnstile.remove(widgetId); - }, - reset: function(widgetId) { - turnstile.reset(widgetId); - } - }; + }; - onCaptchaLoad(renderer); + onCaptchaLoad(renderer); + } } function initCaptchaImpl() {