MODULE 5 / 6 • CUSTOM WEBPAGES & THEMES
CUSTOM THEMING
Replace the built-in verification UI with your own custom HTML template, brand styling, fonts, and static assets.
PORTING YOUR OWN BRANDED WEBPAGE
Override the built-in UI completely by passing a raw string via custom_html or a file via custom_html_path
(custom_html takes precedence if both are set):
from doescap import DoesCap, RelayConfig
config = RelayConfig(
custom_html_path="./my_branding.html",
custom_assets_dir="./my_assets",
title="My Custom Portal",
theme="dark",
)
with DoesCap(config=config) as relay:
token = relay.solve(sitekey="...")
SSR TEMPLATE PLACEHOLDERS & CLIENT CONTRACT
- Optional SSR Placeholders: Server automatically replaces
{{ title }},{{ theme }},{{ sitekey }},{{ rqdata }}, and{{ captcha_host }}inside custom HTML before serving. - Client Polling: Fetch
GET /statusto retrieve live JSON{"sitekey", "rqdata", "captcha_host", "mode", "solved", "claimed", "task_name", "promo_code", "success_message"}. - Enterprise
rqdata&captcha_hostBinding: Wheninfo.rqdataorinfo.captcha_hostis present, pass&host=in theapi.jsquery string, setopts.rqdata/opts.hostinhcaptcha.render(...), and callhcaptcha.setData(widgetId, { rqdata, host }). - Token Submission: When hCaptcha resolves,
POST /solvewith JSON{"token": token}.
STATIC ASSET HOSTING (/assets/*)
Point custom_assets_dir to a local folder containing stylesheets, scripts, fonts, or logos, then reference them from your custom HTML as /assets/filename.ext:
<link rel="stylesheet" href="/assets/style.css">
<img src="/assets/logo.png" alt="Logo">
All asset requests are verified against os.path.commonpath to prevent directory traversal outside custom_assets_dir.