diff --git a/src/page-captcha.rkt b/src/page-captcha.rkt index 3c8f2f5..df4f5bb 100644 --- a/src/page-captcha.rkt +++ b/src/page-captcha.rkt @@ -92,21 +92,21 @@ (link (@ (rel "stylesheet") (type "text/css") (href ,(get-static-url "internal.css")))) (link (@ (rel "stylesheet") (type "text/css") (href ,(get-static-url "main.css")))) (link (@ (rel "icon") (href ,(head-data^-icon-url head-data-default)))) - (script (@ (defer) (src ,(get-static-url "captcha.js")))) - (body (@ (class "skin-fandomdesktop theme-fandomdesktop-light internal")) - (div (@ (class "main-container")) - (div (@ (class "fandom-community-header__background tileBoth header"))) - (div (@ (class "page")) - (main (@ (class "page__main")) - (div (@ (class "custom-top")) - (h1 (@ (class "page-title")) - "Checking you're not a bot...")) - (div (@ (id "content") #;(class "page-content")) - (div (@ (id "mw-content-text")) - (p "To confirm, please click directly in the circle, or hold down the " ,(~a (get-key-solution req)) " key on your keyboard.") - (noscript (p "JavaScript is required for the captcha. Sorry!")) - (div (@ (id "captcha-area"))))) - ,(application-footer #f))))))))) + (script (@ (defer) (src ,(get-static-url "captcha.js"))))) + (body (@ (class "skin-fandomdesktop theme-fandomdesktop-light internal")) + (div (@ (class "main-container")) + (div (@ (class "fandom-community-header__background tileBoth header"))) + (div (@ (class "page")) + (main (@ (class "page__main")) + (div (@ (class "custom-top")) + (h1 (@ (class "page-title")) + "Checking you're not a bot...")) + (div (@ (id "content") #;(class "page-content")) + (div (@ (id "mw-content-text")) + (p "To confirm, please click directly in the circle, or hold down the " ,(~a (get-key-solution req)) " key on your keyboard.") + (noscript (p "JavaScript is required for the captcha. Sorry!")) + (div (@ (id "captcha-area"))))) + ,(application-footer #f)))))))) (when (config-true? 'debug) (xexp->html body)) (response/output diff --git a/static/jsonp.js b/static/jsonp.js index 99c4885..2e2c2db 100644 --- a/static/jsonp.js +++ b/static/jsonp.js @@ -88,7 +88,10 @@ async function cont() { xhr.addEventListener("load", () => { console.log(xhr) + // check for errors if (xhr.status === 500) return fetch(pkg.url, pkg.init).then(res => res.text()).then(error) + // check for captcha screen + if (xhr.responseXML.head.querySelector('script[src*="captcha.js"]')) return location.reload() // page -> #content const imported = document.importNode(xhr.responseXML.getElementById("content"), true) document.getElementById("content").replaceWith(imported)