Fix a bug with i2p captcha

- if captcha_tor_only is set to true, posting over i2p requires a
  captcha but the javascript code removes it. Add a check to see if
  we're on a .i2p domain in this case.
This commit is contained in:
towards-a-new-leftypol 2024-06-07 15:07:25 -04:00
parent ad5383c196
commit d478f65ba0
1 changed files with 3 additions and 4 deletions

View File

@ -116,9 +116,9 @@
{% if config.captcha_tor_only %} {% if config.captcha_tor_only %}
<script> <script>
(() => { (() => {
function isOnionDomain() { function isHiddenService() {
const hostname = window.location.hostname; const hostname = window.location.hostname;
return hostname.endsWith('.onion'); return hostname.endsWith('.onion') || hostname.endsWith('.i2p');
} }
function removeCaptchaField() { function removeCaptchaField() {
@ -126,12 +126,11 @@
.forEach(e => e.parentNode.removeChild(e)); .forEach(e => e.parentNode.removeChild(e));
} }
if (!isOnionDomain()) { if (!isHiddenService()) {
removeCaptchaField(); removeCaptchaField();
} }
})(); })();
</script> </script>
{% else %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if config.user_flag %} {% if config.user_flag %}