JSPM

@before.sh/mini

1.4.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 626
  • Score
    100M100P100Q84241F
  • License Apache-2.0

Client-side widget for Cap, a lightweight, modern open-source CAPTCHA alternative designed using SHA-256 PoW.

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

Based on Cap.js by Tiago.

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

<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 endpoint
  • cap-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 threads
  • cap-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 → use cap-site-key
  • data-cap-endpoints → use cap-endpoints
  • data-cap-api-endpoint → use cap-api-endpoint
  • darkmode → use cap-darkmode
  • color → use cap-color
  • data-cap-worker-count → use cap-worker-count
  • data-cap-hidden-field-name → use cap-hidden-field-name

License

Apache-2.0 (inherited from Cap.js)