altcha 0.6.6 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -12
- package/dist/altcha.d.ts +55 -24
- package/dist/altcha.js +856 -692
- package/dist/altcha.umd.cjs +2 -2
- package/dist_external/altcha.d.ts +55 -24
- package/dist_external/altcha.js +862 -698
- package/dist_external/altcha.umd.cjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ https://altcha.org
|
|
|
26
26
|
- [PHP](https://github.com/altcha-org/altcha-lib-php)
|
|
27
27
|
- [Go](https://github.com/altcha-org/altcha-lib-go)
|
|
28
28
|
- [Python](https://github.com/altcha-org/altcha-lib-py)
|
|
29
|
+
- [Java](https://github.com/altcha-org/altcha-lib-java)
|
|
30
|
+
- [Ruby](https://github.com/altcha-org/altcha-lib-rb)
|
|
29
31
|
|
|
30
32
|
## Plugins
|
|
31
33
|
|
|
@@ -89,7 +91,9 @@ Required options (at least one is required):
|
|
|
89
91
|
|
|
90
92
|
Additional options:
|
|
91
93
|
|
|
94
|
+
- __analytics__ - Enable analytics with [ALTCHA Forms](https://altcha.org/forms/). See [HTML submissions documentation](https://altcha.org/docs/forms/features/html-submissions).
|
|
92
95
|
- __auto__ - Automatically verify without user interaction (possible values: `onfocus`, `onload`, `onsubmit`).
|
|
96
|
+
- __beaconurl__ - URL to which analytics data will be sent using a beacon POST if the form is abandoned. This option is only used when `analytics` is enabled.
|
|
93
97
|
- __blockspam__ - Only used in conjunction with the `spamfilter` option. If enabled, it will block form submission and fail verification if the Spam Filter returns a negative classification. This effectively prevents submission of the form.
|
|
94
98
|
- __delay__ - The artificial delay in milliseconds to apply before the verification (defaults to 0).
|
|
95
99
|
- __expire__ - The challenge expiration (duration in milliseconds).
|
|
@@ -103,7 +107,7 @@ Additional options:
|
|
|
103
107
|
- __spamfilter__ - Enable [Spam Filter](#spam-filter).
|
|
104
108
|
- __strings__ - JSON-encoded translation strings. Refer to [customization](/docs/widget-customization).
|
|
105
109
|
- __refetchonexpire__ - Automatically re-fetch and re-validate when the challenge expires (defaults to true).
|
|
106
|
-
- __verifyurl__ -
|
|
110
|
+
- __verifyurl__ - URL for server-side verification requests. This option is automatically configured when the `spamfilter` option is used. Override this setting only if you are using a custom server implementation.
|
|
107
111
|
- __workers__ - The number of workers to utilize for PoW (defaults to `navigator.hardwareConcurrency || 8`, max. value `16`).
|
|
108
112
|
- __workerurl__ - The URL of the Worker script (defaults to `./worker.js`, only works with `external` build).
|
|
109
113
|
|
|
@@ -135,35 +139,41 @@ Available configuration options:
|
|
|
135
139
|
|
|
136
140
|
```ts
|
|
137
141
|
export interface Configure {
|
|
138
|
-
|
|
142
|
+
analytics?: boolean | string;
|
|
143
|
+
auto?: 'onfocus' | 'onload' | 'onsubmit';
|
|
144
|
+
beaconurl?: string;
|
|
139
145
|
challenge?: {
|
|
140
146
|
algorithm: string;
|
|
141
147
|
challenge: string;
|
|
148
|
+
maxnumber?: number;
|
|
142
149
|
salt: string;
|
|
143
150
|
signature: string;
|
|
144
151
|
};
|
|
152
|
+
challengeurl?: string;
|
|
145
153
|
debug?: boolean;
|
|
146
154
|
delay?: number;
|
|
147
155
|
expire?: number;
|
|
148
156
|
floating?: 'auto' | 'top' | 'bottom';
|
|
149
157
|
floatinganchor?: string;
|
|
150
158
|
floatingoffset?: number;
|
|
159
|
+
autorenew?: boolean;
|
|
151
160
|
hidefooter?: boolean;
|
|
152
161
|
hidelogo?: boolean;
|
|
153
162
|
maxnumber?: number;
|
|
154
163
|
mockerror?: boolean;
|
|
155
164
|
name?: string;
|
|
156
165
|
refetchonexpire?: boolean;
|
|
157
|
-
spamfilter
|
|
166
|
+
spamfilter?: boolean | 'ipAddress' | SpamFilter;
|
|
158
167
|
strings?: {
|
|
159
|
-
error
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
error: string;
|
|
169
|
+
expired: string;
|
|
170
|
+
footer: string;
|
|
171
|
+
label: string;
|
|
172
|
+
verified: string;
|
|
173
|
+
verifying: string;
|
|
174
|
+
waitAlert: string;
|
|
175
|
+
}
|
|
176
|
+
test?: boolean | number | 'delay';
|
|
167
177
|
verifyurl?: string;
|
|
168
178
|
workers?: number;
|
|
169
179
|
workerurl?: string;
|
|
@@ -196,7 +206,7 @@ document.querySelector('#altcha').addEventListener('statechange', (ev) => {
|
|
|
196
206
|
```
|
|
197
207
|
|
|
198
208
|
> [!IMPORTANT]
|
|
199
|
-
> Both programmatic configuration and event listeners have to called/attached after the ALTCHA script loads, such as within window.addEventListener('load', ...)
|
|
209
|
+
> Both programmatic configuration and event listeners have to called/attached after the ALTCHA script loads, such as within `window.addEventListener('load', ...)`.
|
|
200
210
|
|
|
201
211
|
## Spam Filter
|
|
202
212
|
|
package/dist/altcha.d.ts
CHANGED
|
@@ -3,9 +3,62 @@ export {};
|
|
|
3
3
|
declare module 'altcha';
|
|
4
4
|
|
|
5
5
|
declare global {
|
|
6
|
+
type AltchaState = 'error' | 'expired' | 'verified' | 'verifying' | 'unverified';
|
|
7
|
+
|
|
8
|
+
interface AltchaStateChangeEvent extends CustomEvent<{
|
|
9
|
+
payload?: string;
|
|
10
|
+
state: AltchaState;
|
|
11
|
+
}> {}
|
|
12
|
+
|
|
13
|
+
interface AltchaVerifiedEvent extends CustomEvent<{
|
|
14
|
+
payload: string;
|
|
15
|
+
}> {}
|
|
16
|
+
|
|
17
|
+
interface AltchaServerVerificationEvent extends CustomEvent<Record<string, unknown>> {}
|
|
18
|
+
|
|
19
|
+
interface AltchaWidget {
|
|
20
|
+
analytics?: boolean | string;
|
|
21
|
+
auto?: 'onfocus' | 'onload' | 'onsubmit';
|
|
22
|
+
beaconurl?: string;
|
|
23
|
+
blockspam?: boolean;
|
|
24
|
+
challengeurl?: string;
|
|
25
|
+
challengejson?: string;
|
|
26
|
+
debug?: boolean;
|
|
27
|
+
delay?: number;
|
|
28
|
+
expire?: number;
|
|
29
|
+
floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean;
|
|
30
|
+
floatinganchor?: string;
|
|
31
|
+
floatingoffset?: number;
|
|
32
|
+
hidefooter?: boolean;
|
|
33
|
+
hidelogo?: boolean;
|
|
34
|
+
name?: string;
|
|
35
|
+
maxnumber?: number;
|
|
36
|
+
mockerror?: boolean;
|
|
37
|
+
refetchonexpire?: boolean;
|
|
38
|
+
spamfilter?: boolean | 'ipAddress';
|
|
39
|
+
strings?: string;
|
|
40
|
+
test?: boolean | number;
|
|
41
|
+
verifyurl?: string;
|
|
42
|
+
workers?: number;
|
|
43
|
+
workerurl?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare namespace svelteHTML {
|
|
47
|
+
interface IntrinsicElements {
|
|
48
|
+
'altcha-widget': AltchaWidgetSvelte;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface AltchaWidgetSvelte extends AltchaWidget {
|
|
52
|
+
'on:statechange'?: (event: AltchaStateChangeEvent) => void;
|
|
53
|
+
'on:serververification'?: (event: AltchaServerVerificationEvent) => void;
|
|
54
|
+
'on:verified'?: (event: AltchaVerifiedEvent) => void;
|
|
55
|
+
style?: string;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
6
59
|
namespace JSX {
|
|
7
60
|
interface IntrinsicElements {
|
|
8
|
-
'altcha-widget':
|
|
61
|
+
'altcha-widget': AltchaWidgetReact;
|
|
9
62
|
}
|
|
10
63
|
|
|
11
64
|
interface AltchaWidgetCSSProperties extends React.CSSProperties {
|
|
@@ -20,31 +73,9 @@ declare global {
|
|
|
20
73
|
'--altcha-max-width'?: string;
|
|
21
74
|
}
|
|
22
75
|
|
|
23
|
-
interface AltchaWidget extends React.HTMLAttributes<HTMLElement> {
|
|
24
|
-
auto?: 'onfocus' | 'onload' | 'onsubmit';
|
|
25
|
-
blockspam?: boolean;
|
|
26
|
-
challengeurl?: string;
|
|
27
|
-
challengejson?: string;
|
|
28
|
-
debug?: boolean;
|
|
29
|
-
delay?: number;
|
|
30
|
-
expire?: number;
|
|
31
|
-
floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean;
|
|
32
|
-
floatinganchor?: string;
|
|
33
|
-
floatingoffset?: number;
|
|
34
|
-
hidefooter?: boolean;
|
|
35
|
-
hidelogo?: boolean;
|
|
36
|
-
name?: string;
|
|
37
|
-
maxnumber?: number;
|
|
38
|
-
mockerror?: boolean;
|
|
76
|
+
interface AltchaWidgetReact extends AltchaWidget extends React.HTMLAttributes<HTMLElement> {
|
|
39
77
|
ref?: React.RefObject<HTMLElement>;
|
|
40
|
-
refetchonexpire?: boolean;
|
|
41
|
-
spamfilter?: boolean | 'ipAddress';
|
|
42
|
-
strings?: string;
|
|
43
78
|
style?: AltchaWidgetCSSProperties;
|
|
44
|
-
test?: boolean | number;
|
|
45
|
-
verifyurl?: string;
|
|
46
|
-
workers?: number;
|
|
47
|
-
workerurl?: string;
|
|
48
79
|
}
|
|
49
80
|
}
|
|
50
81
|
}
|