support grapheneOS Vanadium browser

This commit is contained in:
Your Name 2025-10-31 00:04:43 -05:00
parent fc527e897d
commit a8473cb696

View File

@ -88,10 +88,15 @@
attempts: 0,
startTime: new Date().getTime(),
};
const progressBarContainer = element.querySelector(".pow-bot-deterrent-progress-bar-container");
progressBarContainer.style.display = "block";
const mainElement = element.querySelector(".pow-bot-deterrent");
mainElement.style.display = "inline-block";
const progressBarContainer = element.querySelector(".pow-bot-deterrent-progress-bar-container");
// if progressBarContainer is null, that means that WASM is disabled
if(!progressBarContainer) {
return;
}
progressBarContainer.style.display = "block";
const gears = element.querySelector(".pow-gears-icon");
gears.style.display = "block";
@ -131,7 +136,7 @@
let webWorkers;
webWorkers = [...Array(numberOfWebWorkersToCreate)].map((_, i) => {
const webWorker = new Worker(`/${staticAssetsPath}/proofOfWorker.js`);
const webWorker = new Worker(`/${staticAssetsPath}/proofOfWorker.js?v=2`);
webWorker.onmessage = function(e) {
const challengeState = challengesMap[e.data.challenge]
if(!challengeState) {
@ -244,6 +249,7 @@
}
function renderProgressInfo(parent) {
const svgXMLNS = "http://www.w3.org/2000/svg";
const xmlnsXMLNS = 'http://www.w3.org/2000/xmlns/';
const xmlSpaceXMLNS = 'http://www.w3.org/XML/1998/namespace';
@ -265,6 +271,40 @@
);
createElement(headerLink, "span", null, "Bot Deterrent");
const description = createElement(mainColumn, "div", {"class": "pow-bot-deterrent-description"});
if (typeof WebAssembly === 'undefined') {
appendFragment(description, "Browser Compatibility Issue (WebAssembly)");
const steps = createElement(description, "ol");
const firstStep = createElement(steps, "li");
appendFragment(firstStep, 'Click the "Site Settings" Button to the left of the URL. It should look like this: ');
const settingsIcon = createElementNS(firstStep, svgXMLNS, "svg", {
"xmlns": [xmlnsXMLNS, svgXMLNS],
"viewBox": "0 2 25 25",
});
settingsIcon.style.display = 'inline';
settingsIcon.style.width = '5vw';
settingsIcon.style.height = '5vw';
settingsIcon.style.position = 'relative';
settingsIcon.style.top = '1.5vw';
settingsIcon.style.marginTop = '-2vw';
createElementNS(settingsIcon, svgXMLNS, "circle", {cx: "6", cy: "10", stroke:"#ffffff", fill:"#ffffff", "stroke-width":"5", r:"3"});
createElementNS(settingsIcon, svgXMLNS, "circle", {cx: "6", cy: "10", stroke:"#000000", fill:"none", "stroke-width":"2", r:"3"});
createElementNS(settingsIcon, svgXMLNS, "line", {x1:"14", y1:"10", x2:"21", y2:"10", stroke:"#ffffff", "stroke-width":"5", "stroke-linecap":"round"});
createElementNS(settingsIcon, svgXMLNS, "line", {x1:"14", y1:"10", x2:"21", y2:"10", stroke:"#000000", "stroke-width":"2", "stroke-linecap":"round"});
createElementNS(settingsIcon, svgXMLNS, "circle", {cx: "19", cy: "20", stroke:"#ffffff", fill:"#ffffff", "stroke-width":"5", r:"3"});
createElementNS(settingsIcon, svgXMLNS, "circle", {cx: "19", cy: "20", stroke:"#000000", fill:"none", "stroke-width":"2", r:"3"});
createElementNS(settingsIcon, svgXMLNS, "line", {x1:"4", y1:"20", x2:"11", y2:"20", stroke:"#ffffff", "stroke-width":"5", "stroke-linecap":"round"});
createElementNS(settingsIcon, svgXMLNS, "line", {x1:"4", y1:"20", x2:"11", y2:"20", stroke:"#000000", "stroke-width":"2", "stroke-linecap":"round"});
createElement(steps, "li", {}, 'Click on "Permissions"');
createElement(steps, "li", {}, 'Enable "JavaScript JIT"');
appendFragment(description, `JavaScript Just In Time compilation is disabled on some privacy-focused web browsers, like on GrapheneOS.
This site requires it for the hash function we use to stick it to the bots.
Sorry for the inconvenience.`);
} else {
appendFragment(description, "Creating ");
createElement(
description,
@ -316,6 +356,7 @@
"d": "M216.478,154.389c-0.896-0.977-2.145-1.558-3.469-1.615l-9.418-0.404 c-0.867-4.445-2.433-8.736-4.633-12.697l6.945-6.374c2.035-1.867,2.17-5.03,0.303-7.064l-6.896-7.514 c-0.896-0.977-2.145-1.558-3.47-1.615c-1.322-0.049-2.618,0.416-3.595,1.312l-6.944,6.374c-3.759-2.531-7.9-4.458-12.254-5.702 l0.404-9.418c0.118-2.759-2.023-5.091-4.782-5.209l-10.189-0.437c-2.745-0.104-5.091,2.023-5.209,4.781l-0.404,9.418 c-4.444,0.867-8.735,2.433-12.697,4.632l-6.374-6.945c-0.896-0.977-2.145-1.558-3.469-1.615c-1.324-0.054-2.618,0.416-3.595,1.312 l-7.514,6.896c-2.035,1.867-2.17,5.03-0.303,7.064l6.374,6.945c-2.531,3.759-4.458,7.899-5.702,12.254l-9.417-0.404 c-2.747-0.111-5.092,2.022-5.21,4.781l-0.437,10.189c-0.057,1.325,0.415,2.618,1.312,3.595c0.896,0.977,2.145,1.558,3.47,1.615 l9.417,0.403c0.867,4.445,2.433,8.736,4.632,12.698l-6.944,6.374c-0.977,0.896-1.558,2.145-1.615,3.469 c-0.057,1.325,0.415,2.618,1.312,3.595l6.896,7.514c0.896,0.977,2.145,1.558,3.47,1.615c1.319,0.053,2.618-0.416,3.595-1.312 l6.944-6.374c3.759,2.531,7.9,4.458,12.254,5.702l-0.404,9.418c-0.118,2.759,2.022,5.091,4.781,5.209l10.189,0.437 c0.072,0.003,0.143,0.004,0.214,0.004c1.25,0,2.457-0.468,3.381-1.316c0.977-0.896,1.558-2.145,1.615-3.469l0.404-9.418 c4.444-0.867,8.735-2.433,12.697-4.632l6.374,6.945c0.896,0.977,2.145,1.558,3.469,1.615c1.33,0.058,2.619-0.416,3.595-1.312 l7.514-6.896c2.035-1.867,2.17-5.03,0.303-7.064l-6.374-6.945c2.531-3.759,4.458-7.899,5.702-12.254l9.417,0.404 c2.756,0.106,5.091-2.022,5.21-4.781l0.437-10.189C217.847,156.659,217.375,155.366,216.478,154.389z M160.157,183.953 c-12.844-0.55-22.846-11.448-22.295-24.292c0.536-12.514,10.759-22.317,23.273-22.317c0.338,0,0.678,0.007,1.019,0.022 c12.844,0.551,22.846,11.448,22.295,24.292C183.898,174.511,173.106,184.497,160.157,183.953z"
});
}
}
function createElementNS(parent, ns, tag, attr) {
const element = document.createElementNS(ns, tag);