Skip to content

Commit 07d807b

Browse files
committed
fix: irregular code
1 parent bd8603b commit 07d807b

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

nodes/CapSolver/Capsolver.node.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import {
33
INodeExecutionData,
44
INodeType,
55
INodeTypeDescription,
6+
NodeConnectionTypes,
67
NodeOperationError,
78
} from 'n8n-workflow';
89
import { INodeContext, Solver } from './libs';
910
import { handleRecognitionActions, handleTokenActions } from './actions';
1011
import { captchaTypes, resourceRecognition, resourceToken } from './config';
1112
import { optionalDescriptions, recognitionDescriptions, tokenDescriptions } from './descriptions';
1213

14+
const inputs = [NodeConnectionTypes.Main];
15+
const outputs = [NodeConnectionTypes.Main];
16+
1317
export class CapSolver implements INodeType {
1418
description: INodeTypeDescription = {
1519
displayName: 'CapSolver',
@@ -22,8 +26,8 @@ export class CapSolver implements INodeType {
2226
defaults: {
2327
name: 'CapSolver',
2428
},
25-
inputs: ['main'],
26-
outputs: ['main'],
29+
inputs,
30+
outputs,
2731
credentials: [
2832
{
2933
name: 'capSolverApi',
@@ -52,7 +56,7 @@ export class CapSolver implements INodeType {
5256

5357
// operation token
5458
{
55-
displayName: 'Captcha',
59+
displayName: 'Operation',
5660
name: 'operation',
5761
type: 'options',
5862
default: captchaTypes.recaptchaV2,

nodes/CapSolver/actions/recognitionActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export async function handleRecognitionActions(context: INodeContext): Promise<I
5656
success: true,
5757
data: result,
5858
},
59-
pairedItem: context.i,
59+
pairedItem: { item: context.i },
6060
};
6161
} catch (error) {
6262
if (context.functionThis.continueOnFail()) {

nodes/CapSolver/actions/tokenActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function handleTokenActions(context: INodeContext): Promise<INodeEx
3939
success: true,
4040
data: result,
4141
},
42-
pairedItem: context.i,
42+
pairedItem: { item: context.i },
4343
};
4444
} catch (error) {
4545
if (context.functionThis.continueOnFail()) {

nodes/CapSolver/libs/solver.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IExecuteFunctions, NodeOperationError } from 'n8n-workflow';
1+
import { IExecuteFunctions, NodeOperationError, sleep } from 'n8n-workflow';
22
import { Task } from './task';
33
import { resourceRecognition, TIME_OUT } from '../config';
44

@@ -43,13 +43,7 @@ export class Solver {
4343
`Get task result timeout: unable to solve within ${TIME_OUT} seconds`,
4444
);
4545
}
46-
this.delay(1000);
46+
await sleep(1000);
4747
}
4848
}
49-
50-
private delay(ms: number): void {
51-
const sab = new SharedArrayBuffer(4);
52-
const arr = new Int32Array(sab);
53-
Atomics.wait(arr, 0, 0, ms);
54-
}
5549
}

0 commit comments

Comments
 (0)