Package Exports
- @before.sh/mini
- @before.sh/mini/cap.min.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@before.sh/mini) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@before.sh/mini
A lightweight, modern CAPTCHA alternative widget based on SHA-256 Proof-of-Work. This is a customized version of Cap.js for use at before.sh.
Documentation
For complete documentation, see before.sh/docs
For the original Cap.js documentation, see capjs.js.org
Quick Start
New API (recommended)
<script src="https://cdn.hopjs.net/npm/@before.sh/mini@1.4.2/cap.min.js"></script>
<cap-mini cap-site-key="YOUR_SITE_KEY"></cap-mini>
Legacy API
<script src="https://cdn.hopjs.net/npm/@before.sh/mini@1.4.2/cap.min.js"></script>
<cap-widget cap-api-endpoint="/api/"></cap-widget>
Features
- ✅ Automatic fallback to multiple endpoints
- ✅ Exponential backoff retry logic
- ✅ Request timeout handling (10s)
- ✅ Enhanced error messages
- ✅ Dark mode support
- ✅ Customizable branding
Attributes
New Consistent Naming (v1.4.2+)
cap-site-key
- Your site key (new API)cap-endpoints
- Custom endpoints (comma-separated, optional)cap-api-endpoint
- Legacy API endpointcap-darkmode
- Enable dark mode (true
/false
)cap-label
- Show Cap label or before.sh branding (true
/false
)cap-color
- Primary color for border and .sh highlight (e.g.,#242424
)cap-worker-count
- Number of worker threadscap-hidden-field-name
- Name for hidden input field (default:cap-token
)
Legacy Names (still supported for backwards compatibility)
The following legacy attribute names are still supported:
data-cap-site-key
→ usecap-site-key
data-cap-endpoints
→ usecap-endpoints
data-cap-api-endpoint
→ usecap-api-endpoint
darkmode
→ usecap-darkmode
color
→ usecap-color
data-cap-worker-count
→ usecap-worker-count
data-cap-hidden-field-name
→ usecap-hidden-field-name
License
Apache-2.0 (inherited from Cap.js)