show captcha correctly if page unloads

This commit is contained in:
Cadence Ember
2025-11-13 01:06:32 +13:00
parent b2fe4ec61a
commit f4907a7b77
2 changed files with 18 additions and 15 deletions

View File

@@ -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)