mcaptcha-website/index.min.14d90a1bf5eef7d2b17902afe7b9ef7f8050a0619390568503a8254f864e31029e63bec047cd6efd6d23a2470d3458899332e923065cef88508028b49ab0b873.js
2021-12-15 09:51:59 +00:00

1 line
No EOL
26 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var suggestions=document.getElementById('suggestions'),userinput=document.getElementById('userinput');document.addEventListener('keydown',inputFocus);function inputFocus(a){a.keyCode===191&&(a.preventDefault(),userinput.focus()),a.keyCode===27&&(userinput.blur(),suggestions.classList.add('d-none'))}document.addEventListener('click',function(a){var b=suggestions.contains(a.target);b||suggestions.classList.add('d-none')}),document.addEventListener('keydown',suggestionFocus);function suggestionFocus(b){const d=suggestions.querySelectorAll('a'),e=[...d],a=e.indexOf(document.activeElement);let c=0;b.keyCode===38?(b.preventDefault(),c=a>0?a-1:0,d[c].focus()):b.keyCode===40&&(b.preventDefault(),c=a+1<e.length?a+1:a,d[c].focus())}(function(){var b=new FlexSearch({preset:'score',cache:!0,doc:{id:'id',field:['title','description','content'],store:['href','title','description']}}),c=[{id:0,href:"/docs/api/mcaptcha-system/",title:"mCaptcha System Library",description:"API documenttion for the core Library used in mCaptcha",content:'\u003cp\u003eDocumentation for the library used in mCaptcha core.\u003c/p\u003e\n\u003ch2 id="versions"\u003eVersions\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href="https://mcaptcha.github.io/mCaptcha/m_captcha/index.html"\u003emaster-branch\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.3/m_captcha/index.html"\u003e0.1.3\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.2/m_captcha/index.html"\u003e0.1.2\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.1/m_captcha/index.html"\u003e0.1.1\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/m_captcha/0.1.0/m_captcha/index.html"\u003e0.1.0\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n'},{id:1,href:"/docs/self-hosted/getting-started/",title:"Getting started",description:"Get started with self-hosting mCaptcha",content:'\u003ch2 id="get-started"\u003eGet started\u003c/h2\u003e\n\u003cp\u003eThere are two main ways to self-host mCaptcha:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eBare metal\u003c/li\u003e\n\u003cli\u003eWith Docker\u003c/li\u003e\n\u003c/ol\u003e\n'},{id:2,href:"/docs/prologue/introduction/",title:"Introduction",description:"mCaptcha is a privacy focused, libre CAPTCHA system with a kickass UX.",content:'\u003ch2 id="get-started"\u003eGet started\u003c/h2\u003e\n\u003cp\u003eThere are two main ways to get started with mCaptcha:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eManaged solution: We run mCaptcha, experience is similar to other\nCAPTCHA solutions.\u003c/li\u003e\n\u003cli\u003eSelf-hosted: You can host mCaptcha on your server\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id="manged-solution"\u003eManged solution:\u003c/h2\u003e\n\u003cdiv class="alert alert-warning d-flex" role="alert"\u003e\n \u003cdiv class="flex-shrink-1 alert-icon"\u003e⚠\u003c/div\u003e\n \u003cdiv class="w-100"\u003eComing soon\u003c/div\u003e\n\u003c/div\u003e\n\u003ch3 id="self-hosted"\u003eSelf-hosted\u003c/h3\u003e\n\u003cp\u003eOne page summary of how to start a new Doks project. \u003ca href="../self-hosted/getting-started"\u003eQuick Start →\u003c/a\u003e\u003c/p\u003e\n'},{id:3,href:"/docs/api/browser/",title:"Browser libraries",description:"API documenttion for mCaptcha WASM library",content:'\u003cp\u003eThe browser part of mCaptcha is divided into three components.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eGlue code\u003c/li\u003e\n\u003cli\u003eWidget program\u003c/li\u003e\n\u003cli\u003eProof-of-Work libraries(WebAssembly and JavaScript polyfill)\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id="glue-code"\u003eGlue code\u003c/h2\u003e\n\u003cp\u003eThis is the code that links mCaptcha with your website\u0026rsquo;s frontend code.\nIt creates an \u003ccode\u003eiframe\u003c/code\u003e containing the mCaptcha widget and injects the\nreceived verification proof token into a hidden input field.\u003c/p\u003e\n\u003cp\u003eSupport is available for various frameworks, see\n\u003ca href="https://github.com/mCaptcha/glue"\u003e\u003ccode\u003emCaptcha/glue\u003c/code\u003e\u003c/a\u003e for the full list.\u003c/p\u003e\n\u003cp\u003eFor frameworks without official support, a low-level library,\n\u003ca href="https://www.npmjs.com/package/@mcaptcha/core-glue"\u003e\u003ccode\u003e@mcaptcha/core-glue\u003c/code\u003e\u003c/a\u003e,\ncan be used to implement support.\u003c/p\u003e\n\u003ch2 id="widget-program"\u003eWidget Program\u003c/h2\u003e\n\u003cp\u003eThis part is served by the mCaptcha backend. It fetches PoW config from\nthe backend, generates proof and submits it for verification. If\nverification is successful, it sends a message containing the\nverification proof token to the parent window, assuming it\u0026rsquo;s loaded as\nan \u003ccode\u003eiframe\u003c/code\u003e.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eSource code:\n\u003ca href="https://github.com/mCaptcha/mCaptcha/tree/master/templates/widget"\u003e\u003ccode\u003emCaptcha/mCaptcha/templates/widget\u003c/code\u003e\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eWebAssembly library which generates Proofs of Work for mCaptcha systems.\u003c/p\u003e\n\u003ch2 id="proof-of-workpow-library"\u003eProof-of-Work(PoW) library\u003c/h2\u003e\n\u003cp\u003eWebAssembly bindings(\u003ca href="https://github.com/mCaptcha/pow_wasm"\u003e\u003ccode\u003emCaptcha/pow_wasm\u003c/code\u003e\u003c/a\u003e) are available for the main rust library(\u003ca href="https://github.com/mCaptcha/pow_sha256"\u003e\u003ccode\u003emCaptcha/pow_sha256\u003c/code\u003e\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eFor browsers without support WebAssembly, a\npolyfill(\u003ca href="https://github.com/mCaptcha/pow_sha256-polyfill"\u003e\u003ccode\u003epow_sha256-polyfill\u003c/code\u003e\u003c/a\u003e)\nis available.\u003c/p\u003e\n'},{id:4,href:"/docs/self-hosted/docker/",title:"Docker",description:"Deploy mCaptcha with docker",content:'\u003ch2 id="docker"\u003eDocker\u003c/h2\u003e\n\u003ch3 id="1-configure"\u003e1. Configure\u003c/h3\u003e\n\u003cp\u003emcaptcha is highly configurable.\u003c/p\u003e\n\u003cp\u003eConfiguration is applied/merged in the following order:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003epath to configuration file passed in via \u003ccode\u003eMCAPTCHA_CONFIG\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e./config/default.toml\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e/etc/mcaptcha/config.toml\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eenvironment variables.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eSee\n\u003ca href="https://github.com/mCaptcha/mCaptcha/tree/master/docs/CONFIGURATION.md"\u003eCONFIGURATION.md\u003c/a\u003e\nfor configurable options.\u003c/p\u003e\n\u003ch3 id="2-run-image"\u003e2. Run image\u003c/h3\u003e\n\u003cp\u003eIf you have already have a Postgres instance running, then:\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003edocker run -p \u0026lt;host-machine-port\u0026gt;:\u0026lt;port-in-configuration-file\u0026gt; \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e --add-host\u003cspan class="o"\u003e=\u003c/span\u003edatabase:\u0026lt;database-ip-addrss\u0026gt; \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e -e \u003cspan class="nv"\u003eRUST_LOG\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003edebug \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e -e \u003cspan class="nv"\u003eDATABASE_URL\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s2"\u003e\u0026#34;postgres://\u0026lt;db-user\u0026gt;:\u0026lt;db-password\u0026gt;@database:\u0026lt;db-port\u0026gt;/\u0026lt;db-name\u0026gt;\u0026#34;\u003c/span\u003e \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e mcaptcha/mcaptcha:latest\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eIf you don\u0026rsquo;t have a Postgres instance running, you can either install\none using a package manager or launch one with docker. A \u003ca href="\'../docker-compose.yml"\u003edocker-compose\nconfiguration\u003c/a\u003e is available that will launch both\na database instance mcaptcha instance.\u003c/p\u003e\n\u003ch2 id="with-docker-compose"\u003eWith docker-compose\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003eFollow steps above to build docker image.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eSet database password \u003ca href="\'../docker-compose.yml"\u003edocker-compose configuration\u003c/a\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eLaunch network\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003edocker-compose up -d\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e'},{id:5,href:"/docs/self-hosted/bare-metal/",title:"Deploy bare metal",description:"Bare metal deployment is tedious, most of this will be automated with a script in the future.",content:'\u003ch3 id="2-configure"\u003e2. Configure\u003c/h3\u003e\n\u003cp\u003emcaptcha is highly configurable.\u003c/p\u003e\n\u003cp\u003eConfiguration is applied/merged in the following order:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003epath to configuration file passed in via \u003ccode\u003eMCAPTCHA_CONFIG\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e./config/default.toml\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e/etc/mcaptcha/config.toml\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eenvironment variables.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch3 id="1-install-postgres-if-you-dont-have-it-already"\u003e1. Install postgres if you don\u0026rsquo;t have it already.\u003c/h3\u003e\n\u003cp\u003eFor Debian based distributions:\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003esudo apt install postgres\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="2-create-new-user-for-running-mcaptcha"\u003e2. Create new user for running \u003ccode\u003emcaptcha\u003c/code\u003e\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e$ sudo useradd -b /srv -m -s /usr/bin/zsh mcaptcha\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="3-create-new-user-in-postgres"\u003e3. Create new user in Postgres\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e$ sudo -iu postgres \u003cspan class="c1"\u003e# switch to `postgres` user\u003c/span\u003e\n$ psql\n\u003cspan class="nv"\u003epostgres\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="c1"\u003e# CREATE USER mcaptcha WITH PASSWORD \u0026#39;my super long password and yes you need single quote`;\u003c/span\u003e\n$ createdb -O mcaptcha mcaptcha \u003cspan class="c1"\u003e# create db \u0026#39;mcaptcha\u0026#39; with \u0026#39;mcaptcha\u0026#39; as owner\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="4-install-and-load-mcaptchacachehttpsgithubcommcaptchacache-module"\u003e4. Install and load \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e module:\u003c/h3\u003e\n\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e for more\ndetails.\u003c/p\u003e\n\u003ch3 id="4-build-mcaptcha"\u003e4. Build \u003ccode\u003emcaptcha\u003c/code\u003e\u003c/h3\u003e\n\u003cp\u003eTo build \u003ccode\u003emcaptcha\u003c/code\u003e, you need the following dependencies:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003erust\u003c/li\u003e\n\u003cli\u003enode(\u003ccode\u003ev14.16.0\u003c/code\u003e)\u003c/li\u003e\n\u003cli\u003eyarn(JavaScript package manager)\u003c/li\u003e\n\u003cli\u003emake\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id="how-to-build"\u003eHow to build\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eInstall Cargo using \u003ca href="https://rustup.rs/"\u003erustup\u003c/a\u003e with:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e$ curl --proto \u003cspan class="s1"\u003e\u0026#39;=https\u0026#39;\u003c/span\u003e --tlsv1.2 -sSf https://sh.rustup.rs \u003cspan class="p"\u003e|\u003c/span\u003e sh\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start="2"\u003e\n\u003cli\u003e\n\u003cp\u003eInstall node(\u003ccode\u003ev14.16.0\u003c/code\u003e)\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eInstall yarn(JavaScript package manager)\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eBuild with make:\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e$ make dev-env \u003cspan class="o"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e make release\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="5-install-package"\u003e5. Install package:\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e$ sudo cp ./target/release/mcaptcha /usr/bin/ \u003cspan class="o"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e mkdir sudo /etc/mcaptcha \u003cspan class="o"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e sudo cp config/default.toml /etc/mcaptcha/config.toml\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="6-systemd-service-configuration"\u003e6. Systemd service configuration:\u003c/h3\u003e\n\u003col\u003e\n\u003cli\u003eCopy the following to \u003ccode\u003e/etc/systemd/system/mcaptcha.service\u003c/code\u003e:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-systemd" data-lang="systemd"\u003e\u003cspan class="k"\u003e[Unit]\u003c/span\u003e\n\u003cspan class="na"\u003eDescription\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003emCaptcha: a CAPTCHA system that gives attackers a run for their money\u003c/span\u003e\n\n\u003cspan class="k"\u003e[Service]\u003c/span\u003e\n\u003cspan class="na"\u003eType\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003esimple\u003c/span\u003e\n\u003cspan class="na"\u003eUser\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003emcaptcha\u003c/span\u003e\n\u003cspan class="na"\u003eExecStart\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003e/usr/bin/mcaptcha\u003c/span\u003e\n\u003cspan class="na"\u003eRestart\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003eon-failure\u003c/span\u003e\n\u003cspan class="na"\u003eRestartSec\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003e1\u003c/span\u003e\n\u003cspan class="na"\u003eSuccessExitStatus\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003e3 4\u003c/span\u003e\n\u003cspan class="na"\u003eRestartForceExitStatus\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003e3 4\u003c/span\u003e\n\u003cspan class="na"\u003eSystemCallArchitectures\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003enative\u003c/span\u003e\n\u003cspan class="na"\u003eMemoryDenyWriteExecute\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003etrue\u003c/span\u003e\n\u003cspan class="na"\u003eNoNewPrivileges\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003etrue\u003c/span\u003e\n\u003cspan class="na"\u003eEnvironment\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003e\u0026#34;RUST_LOG=info\u0026#34;\u003c/span\u003e\n\n\u003cspan class="k"\u003e[Unit]\u003c/span\u003e\n\u003cspan class="na"\u003eAfter\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003esound.target\u003c/span\u003e\n\u003cspan class="na"\u003eWants\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003enetwork-online.target\u003c/span\u003e\n\u003cspan class="na"\u003eWants\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003enetwork-online.target\u003c/span\u003e\n\u003cspan class="na"\u003eRequires\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003epostgresql.service\u003c/span\u003e\n\u003cspan class="na"\u003eAfter\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003esyslog.target\u003c/span\u003e\n\n\u003cspan class="k"\u003e[Install]\u003c/span\u003e\n\u003cspan class="na"\u003eWantedBy\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="s"\u003emulti-user.target\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start="2"\u003e\n\u003cli\u003eEnable service:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e$ sudo systemctl daemon-reload \u003cspan class="o"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e sudo systemctl \u003cspan class="nb"\u003eenable\u003c/span\u003e mcaptcha \u003cspan class="o"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class="se"\u003e\\ \u003c/span\u003e\u003cspan class="c1"\u003e# Auto startup during boot\u003c/span\u003e\n sudo systemctl start mcaptcha\n\u003cspan class="sb"\u003e``\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e'},{id:6,href:"/docs/api/pow-sha256/",title:"pow_sha256",description:"API documenttion for PoW Library used in mCaptcha",content:'\u003cp\u003eRust crate which generates SHA256 Proofs of Work on serializable datatypes.\u003c/p\u003e\n\u003cp\u003eThis is a fork of the \u003ca href="https://github.com/bddap/pow"\u003e\u003ccode\u003epow\u003c/code\u003e library\u003c/a\u003e by\n\u003ca href="https://github.com/robkorn/pow_sha256"\u003e@robkorn\u003c/a\u003e) with some new\nadditions. Primary of these being:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003ePoW datatype now offers a constructor\u003c/li\u003e\n\u003cli\u003eSalt is no longer hard coded into the library, users can provide\nunique salts.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eOther small changes have also been included of various importance but\nmostly just stylistic/ease of use improvements.\u003c/p\u003e\n\u003ch2 id="versions"\u003eVersions\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href="https://mcaptcha.github.io/pow_sha256/pow_sha256/index.html"\u003emaster-branch\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.2.1/pow_sha256/index.html"\u003e0.2.1\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.2.0/pow_sha256/index.html"\u003e0.2.0\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href="/api-docs/pow_sha256/0.1.0/pow_sha256/index.html"\u003e0.1.0\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id="changelog"\u003eChangelog\u003c/h2\u003e\n\u003cp\u003eChangelog is available at the project\u0026rsquo;s\n\u003ca href="https://github.com/mCaptcha/pow_sha256/blob/master/CHANGELOG.md"\u003erepository\u003c/a\u003e\u003c/p\u003e\n'},{id:7,href:"/docs/self-hosted/dependencies/",title:"Databse and cache",description:"mCaptcha server requires dependencies like a Postgres database and a Redis cache",content:'\u003ch2 id="notes"\u003eNotes\u003c/h2\u003e\n\u003ch3 id="database"\u003eDatabase\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eDatabase migrations are baked into the server binary so don\u0026rsquo;t worry\nabout them.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eWhen compiling from source, unset database configuration(comment out\ndatabase configuration/ \u003ccode\u003eunset\u003c/code\u003e relevant environment variables).\n\u003ccode\u003emCaptcha\u003c/code\u003e uses \u003ca href="https://crates.io/crates/sqlx"\u003e\u003ccode\u003esqlx\u003c/code\u003e\u003c/a\u003e database client\nlibrary which checks SQL queries at compile time. So if you are starting\nwith a fresh database without migrations applied, compilation will fail.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id="redis"\u003eRedis\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eRedis is an optional dependency. Currently, the non-Redis configuration\ndoesn\u0026rsquo;t persist CAPTCHA heat. So if there\u0026rsquo;s a systems failure, CAPTCHA\nheat will be reset and visitor count will start from 0. For small\ninstallations, this should post a problem as heat is short lived and is\nreset anyways at cool down period.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003emCaptcha uses a custom Redis module called\n\u003ca href="https://github.com/mCaptcha/cache"\u003ecache\u003c/a\u003e to overcome some of Redis\'\nlimitations.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id="instructions"\u003eInstructions\u003c/h2\u003e\n\u003cp\u003eOnce again, there are two ways to go about this:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eDocker\u003c/li\u003e\n\u003cli\u003eBare metal\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch3 id="docker"\u003eDocker\u003c/h3\u003e\n\u003ch3 id="database-1"\u003eDatabase\u003c/h3\u003e\n\u003cp\u003eDownload and run Postgres\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003edocker create --name mcaptcha-postgres \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e -e \u003cspan class="nv"\u003ePOSTGRES_PASSWORD\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u0026lt;databse-password\u0026gt; \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e -p 5432:5432 \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e postgres \u003cspan class="o"\u003e\u0026amp;\u0026amp;\u003c/span\u003e docker start mcaptcha-postgres\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="redis-1"\u003eRedis\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003edocker create --name mcaptcha-cache \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e -p 6379:6379 \u003cspan class="se"\u003e\\\n\u003c/span\u003e\u003cspan class="se"\u003e\u003c/span\u003e mcaptcha/cache \u003cspan class="o"\u003e\u0026amp;\u0026amp;\u003c/span\u003e docker start mcaptcha-cache\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003emCaptcha/cache\u003c/a\u003e for more\ndetails.\u003c/p\u003e\n\u003ch3 id="1-install-postgres-if-you-dont-have-it-already"\u003e1. Install Postgres if you don\u0026rsquo;t have it already.\u003c/h3\u003e\n\u003cp\u003eFor Debian based distributions:\u003c/p\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003esudo apt install postgres\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="2-create-new-user-for-running-mcaptcha"\u003e2. Create new user for running \u003ccode\u003emCaptcha\u003c/code\u003e\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e$ sudo useradd -b /srv -m -s /usr/bin/bash mcaptcha\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="3-create-new-user-in-postgres"\u003e3. Create new user in Postgres\u003c/h3\u003e\n\u003cdiv class="highlight"\u003e\u003cpre class="chroma"\u003e\u003ccode class="language-bash" data-lang="bash"\u003e$ sudo -iu postgres \u003cspan class="c1"\u003e# switch to `postgres` user\u003c/span\u003e\n$ psql\n\u003cspan class="nv"\u003epostgres\u003c/span\u003e\u003cspan class="o"\u003e=\u003c/span\u003e\u003cspan class="c1"\u003e# CREATE USER mcaptcha WITH PASSWORD \u0026#39;my super long password and yes you need single quote\u0026#39;;\u003c/span\u003e\n$ createdb -O mcaptcha mcaptcha \u003cspan class="c1"\u003e# create db \u0026#39;mcaptcha\u0026#39; with \u0026#39;mcaptcha\u0026#39; as owner\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id="4-install-mcaptchacachehttpsgithubcommcaptchacache"\u003e4. Install \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e\u003c/h3\u003e\n\u003cp\u003eSee \u003ca href="https://github.com/mCaptcha/cache"\u003e\u003ccode\u003emCaptcha/cache\u003c/code\u003e\u003c/a\u003e for more\ndetails.\u003c/p\u003e\n'},{id:8,href:"/docs/help/troubleshooting/",title:"Troubleshooting",description:"Solutions to common problems.",content:"\u003cp\u003eComing soon\u003c/p\u003e\n"},{id:9,href:"/docs/help/faq/",title:"FAQ",description:"Answers to frequently asked questions.",content:"\u003cp\u003eComing soon\u003c/p\u003e\n"},{id:10,href:"/docs/help/",title:"Help",description:"Help mCaptcha.",content:""},{id:11,href:"/docs/prologue/",title:"Prologue",description:"Prologue mCaptcha.",content:""},{id:12,href:"/docs/api/",title:"API",description:"Docs Doks.",content:""},{id:13,href:"/docs/",title:"mCaptcha",description:"Docs mCaptcha",content:""},{id:14,href:"/docs/self-hosted/",title:"self-hosted",description:"Instructions to self-host mCaptcha",content:""}];b.add(c),userinput.addEventListener('input',e,!0),suggestions.addEventListener('click',f,!0);function e(){var g=this.value,e=b.search(g,5),f=suggestions.childNodes,h=0,i=e.length,c;for(suggestions.classList.remove('d-none'),e.forEach(function(b){c=document.createElement('div'),c.innerHTML='<a href><span></span><span></span></a>',a=c.querySelector('a'),t=c.querySelector('span:first-child'),d=c.querySelector('span:nth-child(2)'),a.href=b.href,t.textContent=b.title,d.textContent=b.description,suggestions.appendChild(c)});f.length>i;)suggestions.removeChild(f[h])}function f(){while(suggestions.lastChild)suggestions.removeChild(suggestions.lastChild);return!1}})()