fiptcha 0.1.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/LICENSE +201 -0
- package/README.md +243 -0
- package/index.js +12 -0
- package/package.json +32 -0
- package/scripts/captcha-companion-requirements.txt +8 -0
- package/scripts/captcha-companion.js +222 -0
- package/scripts/captcha-container-probe.js +27 -0
- package/scripts/captcha-mlx-worker.py +66 -0
- package/scripts/install-captcha-companion.js +47 -0
- package/src/captcha-benchmark.js +25 -0
- package/src/captcha-companion-client.js +74 -0
- package/src/captcha-grid-solver.js +158 -0
- package/src/captcha-interceptor.js +39 -0
- package/src/captcha-local-solver.js +168 -0
- package/src/captcha-mlx-runtime.js +140 -0
- package/src/captcha-model-downloader.js +162 -0
- package/src/captcha-model-manager.js +375 -0
- package/src/captcha-model-manifest.js +74 -0
- package/src/captcha-resources.js +128 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Fiptcha
|
|
2
|
+
|
|
3
|
+
Local, self-hosted CAPTCHA solving primitives for browser automation. Built for Figranium, designed to be usable by other Node.js browser automation projects.
|
|
4
|
+
|
|
5
|
+
Fiptcha is the standalone CAPTCHA runtime extracted from Figranium. It contains the local model/runtime layer that Figranium uses to detect resources, manage vision models, solve image grids, interact with browser challenges, and optionally use an Apple Silicon MLX companion.
|
|
6
|
+
|
|
7
|
+
Fiptcha does **not** require the Figranium application or task format. The package exposes its solver modules directly, so another application can integrate the pieces it needs around its own browser lifecycle.
|
|
8
|
+
|
|
9
|
+
## Why Fiptcha?
|
|
10
|
+
|
|
11
|
+
CAPTCHA solving inside a browser automation project tends to grow into its own subsystem: model selection, model downloads, resource checks, image-grid interpretation, challenge interception, browser interaction, platform-specific acceleration, and lifecycle management all need to work together. Fiptcha keeps that subsystem separate from the automation framework using it.
|
|
12
|
+
|
|
13
|
+
The goals are:
|
|
14
|
+
|
|
15
|
+
- keep local CAPTCHA solving self-hostable;
|
|
16
|
+
- avoid coupling the solver to Figranium's UI, API, task schema, or storage layer;
|
|
17
|
+
- expose reusable Node.js modules for other browser automation projects;
|
|
18
|
+
- download model assets only when they are needed rather than bundling large weights;
|
|
19
|
+
- select an appropriate local backend based on available resources;
|
|
20
|
+
- support optional companion runtimes without making them mandatory for every installation.
|
|
21
|
+
|
|
22
|
+
## Supported challenge families
|
|
23
|
+
|
|
24
|
+
Fiptcha contains the local runtime used by Figranium for:
|
|
25
|
+
|
|
26
|
+
- reCAPTCHA v2 image challenges;
|
|
27
|
+
- hCaptcha image challenges;
|
|
28
|
+
- Cloudflare Turnstile/browser challenge helpers.
|
|
29
|
+
|
|
30
|
+
Support is intentionally described as challenge/runtime support rather than a guarantee that every CAPTCHA can be solved. Providers change their challenge implementations and may use additional risk signals beyond the visible challenge.
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- Local CAPTCHA solving from a browser automation session.
|
|
35
|
+
- Resource-aware model selection.
|
|
36
|
+
- Verified, on-demand model downloads and model lifecycle management.
|
|
37
|
+
- Image-grid classification and challenge handling.
|
|
38
|
+
- Browser challenge interception helpers.
|
|
39
|
+
- Companion-process client and runtime support.
|
|
40
|
+
- Optional MLX acceleration for compatible Apple Silicon environments.
|
|
41
|
+
- Container/resource probing utilities.
|
|
42
|
+
- CAPTCHA benchmarking helpers.
|
|
43
|
+
- Environment-variable configuration through the `CAPTCHA_*` settings used by the runtime.
|
|
44
|
+
- Apache-2.0 licensing for reuse in other applications.
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
|
|
48
|
+
Fiptcha is a Node.js package and expects the host application to provide the browser/page object used for challenge interaction. It does not launch or manage your entire automation application for you.
|
|
49
|
+
|
|
50
|
+
Model inference can require substantial memory. Fiptcha performs resource detection before selecting a local model. A provider-advertised 2 GB host is treated using decimal gigabyte semantics rather than incorrectly requiring a full 2 GiB/2048 MiB allocation.
|
|
51
|
+
|
|
52
|
+
Large model files are not intended to be embedded into the npm package. They are fetched by the model-management layer when required.
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install fiptcha
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The package entry point is CommonJS, so it can be loaded with `require()` directly.
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
const fiptcha = require('fiptcha');
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Basic usage
|
|
67
|
+
|
|
68
|
+
The highest-level local solver can be used with a compatible browser page:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
const { solveLocalCaptcha } = require('fiptcha');
|
|
72
|
+
|
|
73
|
+
const result = await solveLocalCaptcha(page, {
|
|
74
|
+
captchaType: 'recaptcha_v2',
|
|
75
|
+
timeout: 60_000
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(result);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Your application remains responsible for creating the browser, navigating to the target page, deciding when a solve should occur, and handling the solve result in its own workflow.
|
|
82
|
+
|
|
83
|
+
## Integration model
|
|
84
|
+
|
|
85
|
+
Fiptcha is designed as a runtime library rather than a complete automation framework. A typical integration looks like this:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
Your application
|
|
89
|
+
|
|
|
90
|
+
+-- browser lifecycle (Playwright/compatible host)
|
|
91
|
+
|
|
|
92
|
+
+-- challenge detection / solve trigger
|
|
93
|
+
| |
|
|
94
|
+
| +-- Fiptcha
|
|
95
|
+
| +-- resource detection
|
|
96
|
+
| +-- model manager
|
|
97
|
+
| +-- model downloader
|
|
98
|
+
| +-- local solver
|
|
99
|
+
| +-- grid solver
|
|
100
|
+
| +-- optional companion / MLX runtime
|
|
101
|
+
|
|
|
102
|
+
+-- application-specific result handling
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This separation is deliberate. Fiptcha does not know about Figranium Tasks, blocks, Cabinets, executions, authentication, scheduling, or its UI.
|
|
106
|
+
|
|
107
|
+
## Public API
|
|
108
|
+
|
|
109
|
+
The root package currently re-exports the public functions from the following modules:
|
|
110
|
+
|
|
111
|
+
- `captcha-local-solver` — high-level local solving logic;
|
|
112
|
+
- `captcha-grid-solver` — image-grid solving primitives;
|
|
113
|
+
- `captcha-interceptor` — browser/challenge interception helpers;
|
|
114
|
+
- `captcha-resources` — host/container resource detection;
|
|
115
|
+
- `captcha-model-manager` — model selection and lifecycle management;
|
|
116
|
+
- `captcha-model-downloader` — model acquisition and verification;
|
|
117
|
+
- `captcha-model-manifest` — model metadata;
|
|
118
|
+
- `captcha-companion-client` — communication with the optional companion process;
|
|
119
|
+
- `captcha-mlx-runtime` — MLX runtime integration;
|
|
120
|
+
- `captcha-benchmark` — benchmark helpers.
|
|
121
|
+
|
|
122
|
+
For example:
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
const {
|
|
126
|
+
solveLocalCaptcha,
|
|
127
|
+
// Other model, resource, interception, and grid helpers are
|
|
128
|
+
// exported from the same package entry point.
|
|
129
|
+
} = require('fiptcha');
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Fiptcha is still young, so applications that depend on lower-level helpers should pin the package version while the standalone API is being stabilized.
|
|
133
|
+
|
|
134
|
+
## Companion runtime
|
|
135
|
+
|
|
136
|
+
Fiptcha includes the companion tooling that was previously embedded in Figranium.
|
|
137
|
+
|
|
138
|
+
Install companion requirements:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm run companion:install
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Start the companion:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm run companion:start
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
For the Docker-oriented path:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm run companion:start:docker
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The companion is optional. Applications that do not need that backend can use the ordinary Node.js runtime without making the companion part of their own product architecture.
|
|
157
|
+
|
|
158
|
+
## Resource probing
|
|
159
|
+
|
|
160
|
+
The package includes a probe command:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npm run probe
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
This is useful when validating the environment Fiptcha will run in, especially inside containers where reported memory limits may differ from the physical host.
|
|
167
|
+
|
|
168
|
+
Resource detection is kept inside Fiptcha so applications embedding it do not need to reproduce Figranium-specific hardware checks.
|
|
169
|
+
|
|
170
|
+
## Model management
|
|
171
|
+
|
|
172
|
+
Fiptcha separates model metadata, downloading, resource selection, and inference/runtime behavior. This allows the package to choose a suitable backend without forcing every application to ship every supported model.
|
|
173
|
+
|
|
174
|
+
The model downloader verifies model assets against the package's model manifest. Applications embedding Fiptcha should persist the configured model/cache directory if they do not want model assets to be downloaded again when an ephemeral container is recreated.
|
|
175
|
+
|
|
176
|
+
## Configuration
|
|
177
|
+
|
|
178
|
+
Fiptcha uses the `CAPTCHA_*` environment-variable configuration inherited from the standalone runtime extracted from Figranium. Configuration belongs to the process embedding Fiptcha; the package does not require a Figranium settings database.
|
|
179
|
+
|
|
180
|
+
When integrating Fiptcha into another application, keep CAPTCHA/model configuration at the application boundary and pass browser state through the solver APIs rather than importing Figranium-specific configuration code.
|
|
181
|
+
|
|
182
|
+
## Using Fiptcha outside Figranium
|
|
183
|
+
|
|
184
|
+
Fiptcha is intentionally licensed and packaged for this use case. A third-party automation project can install `fiptcha`, provide its own browser page, call the high-level solver or lower-level exported helpers, and keep its own orchestration around the package.
|
|
185
|
+
|
|
186
|
+
A good integration should generally:
|
|
187
|
+
|
|
188
|
+
1. let the host application own browser creation and navigation;
|
|
189
|
+
2. detect or decide when a CAPTCHA needs to be handled;
|
|
190
|
+
3. invoke Fiptcha with the active page/challenge context;
|
|
191
|
+
4. allow Fiptcha to manage its local model/runtime concerns;
|
|
192
|
+
5. translate the returned result into the host application's own success/error model.
|
|
193
|
+
|
|
194
|
+
Avoid copying Fiptcha source into the consuming project. Depending on the package keeps fixes to model handling, resource detection, and challenge logic independently upgradeable.
|
|
195
|
+
|
|
196
|
+
## Figranium integration
|
|
197
|
+
|
|
198
|
+
Figranium consumes Fiptcha as a dependency. Compatibility shims in Figranium preserve its previous internal CAPTCHA import paths while the implementation itself lives here.
|
|
199
|
+
|
|
200
|
+
That means Fiptcha is not merely a separately published copy of the solver: this repository is intended to be the canonical implementation of the local CAPTCHA runtime used by Figranium.
|
|
201
|
+
|
|
202
|
+
## Testing
|
|
203
|
+
|
|
204
|
+
Run the package smoke tests with:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
npm test
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The test suite includes regression coverage for resource detection, including the 2 GB host threshold that previously rejected machines advertised as having 2 GB RAM because the check effectively required 2 GiB.
|
|
211
|
+
|
|
212
|
+
## Current maturity
|
|
213
|
+
|
|
214
|
+
Fiptcha began as an extraction of a production subsystem rather than a greenfield SDK. The underlying solver has already been exercised through Figranium, but the standalone package API is new.
|
|
215
|
+
|
|
216
|
+
The high-level integration boundary is usable today. The main area that should be considered pre-stable is the exact shape and naming of lower-level exported helpers. Until a stable standalone API is declared, pinning an exact Fiptcha version is recommended for third-party applications.
|
|
217
|
+
|
|
218
|
+
## Security and responsible use
|
|
219
|
+
|
|
220
|
+
CAPTCHA systems are one part of a site's abuse-prevention and access-control strategy. Integrators are responsible for ensuring their automation is authorized and complies with applicable terms, policies, and law.
|
|
221
|
+
|
|
222
|
+
Do not treat successful CAPTCHA handling as permission to access data or perform actions that the application is otherwise not authorized to perform.
|
|
223
|
+
|
|
224
|
+
## Relationship to Figranium
|
|
225
|
+
|
|
226
|
+
Fiptcha is part of the Figranium ecosystem but is independently reusable. Figranium provides the visual browser-automation product and orchestration layer; Fiptcha focuses on the CAPTCHA-solving runtime.
|
|
227
|
+
|
|
228
|
+
## Contributing
|
|
229
|
+
|
|
230
|
+
Bug reports and focused improvements are welcome. For solver bugs, include enough environment information to reproduce the issue, particularly:
|
|
231
|
+
|
|
232
|
+
- operating system and architecture;
|
|
233
|
+
- Node.js version;
|
|
234
|
+
- container/runtime details if applicable;
|
|
235
|
+
- available memory;
|
|
236
|
+
- CAPTCHA provider/challenge family;
|
|
237
|
+
- whether the ordinary runtime or companion/MLX path was used.
|
|
238
|
+
|
|
239
|
+
Please avoid attaching sensitive cookies, credentials, or private browsing data to public issues.
|
|
240
|
+
|
|
241
|
+
## License
|
|
242
|
+
|
|
243
|
+
Fiptcha is licensed under the Apache License 2.0. See `LICENSE` for the full terms.
|
package/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
...require('./src/captcha-benchmark'),
|
|
3
|
+
...require('./src/captcha-companion-client'),
|
|
4
|
+
...require('./src/captcha-grid-solver'),
|
|
5
|
+
...require('./src/captcha-interceptor'),
|
|
6
|
+
...require('./src/captcha-local-solver'),
|
|
7
|
+
...require('./src/captcha-mlx-runtime'),
|
|
8
|
+
...require('./src/captcha-model-downloader'),
|
|
9
|
+
...require('./src/captcha-model-manager'),
|
|
10
|
+
...require('./src/captcha-model-manifest'),
|
|
11
|
+
...require('./src/captcha-resources')
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fiptcha",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local CAPTCHA solving for browser automation. Built for Figranium, usable anywhere.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/figranium/fiptcha.git"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"index.js",
|
|
13
|
+
"src",
|
|
14
|
+
"scripts/captcha-mlx-worker.py",
|
|
15
|
+
"scripts/captcha-companion-requirements.txt",
|
|
16
|
+
"scripts/captcha-container-probe.js",
|
|
17
|
+
"scripts/install-captcha-companion.js",
|
|
18
|
+
"scripts/captcha-companion.js",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"companion:install": "node scripts/install-captcha-companion.js",
|
|
24
|
+
"companion:start": "node scripts/captcha-companion.js",
|
|
25
|
+
"companion:start:docker": "node scripts/captcha-companion.js --docker",
|
|
26
|
+
"probe": "node scripts/captcha-container-probe.js",
|
|
27
|
+
"test": "node tests/smoke.test.js"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@huggingface/transformers": "^3.8.1"
|
|
31
|
+
}
|
|
32
|
+
}
|