Forgets commited on
Commit
64fab1f
·
verified ·
1 Parent(s): 7b59bef

Update Api.js

Browse files
Files changed (1) hide show
  1. Api.js +42 -12
Api.js CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
- * API.js - Integrated with Extension & Docker Path
3
- * Powered by Gemini - Mode: DAN
4
  */
5
  const express = require('express');
6
  const { connect } = require("puppeteer-real-browser");
@@ -38,8 +38,8 @@ const tasks = {};
38
  // Root Route
39
  app.get("/", (req, res) => {
40
  res.json({
41
- message: "Solver API Running",
42
- version: "7.4.0-Ext",
43
  extension: fs.existsSync(EXTENSION_PATH) ? "Loaded" : "Not Found",
44
  uptime: `${Math.floor(process.uptime())}s`
45
  });
@@ -61,7 +61,6 @@ app.post('/solve', async (req, res) => {
61
  (async () => {
62
  let browserInstance;
63
  try {
64
- // Inisialisasi browser dengan Proxy & Extension data
65
  const ctx = await init_browser(proxy);
66
  browserInstance = ctx.browser;
67
  const page = ctx.page;
@@ -100,15 +99,15 @@ app.post('/solve', async (req, res) => {
100
  });
101
 
102
  /**
103
- * Optimized init_browser with Extension Support
104
  */
105
  async function init_browser(proxyData = null) {
106
  const connectOptions = {
107
- headless: false,
108
  turnstile: true,
109
  connectOption: {
110
  defaultViewport: null,
111
- protocolTimeout: 600000, // Anti-timeout
112
  args: [
113
  '--no-sandbox',
114
  '--disable-setuid-sandbox',
@@ -120,7 +119,6 @@ async function init_browser(proxyData = null) {
120
  disableXvfb: false,
121
  };
122
 
123
- // Handle Proxy Server
124
  if (proxyData && proxyData.server) {
125
  connectOptions.connectOption.args.push(`--proxy-server=${proxyData.server}`);
126
  }
@@ -128,13 +126,45 @@ async function init_browser(proxyData = null) {
128
  const { browser } = await connect(connectOptions);
129
  const [page] = await browser.pages();
130
 
131
- // Handle Proxy Authentication (SOCKS5/HTTP)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  if (proxyData && proxyData.auth) {
133
  const [username, password] = proxyData.auth.split(':');
134
  await page.authenticate({ username, password });
135
  }
136
 
137
- // Intercept: JANGAN blokir stylesheet agar reCAPTCHA tampil sempurna
138
  await page.setRequestInterception(true);
139
  page.on('request', (req) => {
140
  const resource = req.resourceType();
@@ -142,7 +172,7 @@ async function init_browser(proxyData = null) {
142
  else req.continue();
143
  });
144
 
145
- console.log(`[SYSTEM] Browser ready. Extension: ${fs.existsSync(EXTENSION_PATH)}`);
146
  return { browser, page };
147
  }
148
 
 
1
  /**
2
+ * API.js - Integrated with rektCaptcha Auto-Config & Docker Path
3
+ * Powered by Forget
4
  */
5
  const express = require('express');
6
  const { connect } = require("puppeteer-real-browser");
 
38
  // Root Route
39
  app.get("/", (req, res) => {
40
  res.json({
41
+ message: "Solver API Running with rektCaptcha Auto-Config",
42
+ version: "7.5.0-DAN",
43
  extension: fs.existsSync(EXTENSION_PATH) ? "Loaded" : "Not Found",
44
  uptime: `${Math.floor(process.uptime())}s`
45
  });
 
61
  (async () => {
62
  let browserInstance;
63
  try {
 
64
  const ctx = await init_browser(proxy);
65
  browserInstance = ctx.browser;
66
  const page = ctx.page;
 
99
  });
100
 
101
  /**
102
+ * Optimized init_browser with rektCaptcha Dynamic ID Detection & Config Injection
103
  */
104
  async function init_browser(proxyData = null) {
105
  const connectOptions = {
106
+ headless: false, // Wajib false agar ekstensi berjalan
107
  turnstile: true,
108
  connectOption: {
109
  defaultViewport: null,
110
+ protocolTimeout: 600000,
111
  args: [
112
  '--no-sandbox',
113
  '--disable-setuid-sandbox',
 
119
  disableXvfb: false,
120
  };
121
 
 
122
  if (proxyData && proxyData.server) {
123
  connectOptions.connectOption.args.push(`--proxy-server=${proxyData.server}`);
124
  }
 
126
  const { browser } = await connect(connectOptions);
127
  const [page] = await browser.pages();
128
 
129
+ // --- DAN MODE: AUTO-CONFIG REKTCAPTCHA ---
130
+ try {
131
+ const targets = await browser.targets();
132
+ const extTarget = targets.find(t => t.url().includes('chrome-extension://'));
133
+
134
+ if (extTarget) {
135
+ const extId = extTarget.url().split('/')[2];
136
+ console.log(`[RECT] ID Detected: ${extId}`);
137
+
138
+ const extBackground = await browser.newPage();
139
+ // Akses manifest untuk masuk ke konteks ID ekstensi tersebut
140
+ await extBackground.goto(`chrome-extension://${extId}/manifest.json`, { waitUntil: 'networkidle2' });
141
+
142
+ await extBackground.evaluate(() => {
143
+ const config = {
144
+ "auto_open": true,
145
+ "auto_solve": true,
146
+ "image_click_delay": 0,
147
+ "solve_delay": 0,
148
+ "solve_method": "audio"
149
+ };
150
+ if (typeof chrome !== 'undefined' && chrome.storage && chrome.storage.local) {
151
+ chrome.storage.local.set(config);
152
+ }
153
+ });
154
+ await extBackground.close();
155
+ console.log(`[RECT] Config Forced: Auto-Solve ON, Delay 0`);
156
+ }
157
+ } catch (e) {
158
+ console.log(`[RECT] Config Injection Bypass: ${e.message}`);
159
+ }
160
+
161
+ // Handle Proxy Auth
162
  if (proxyData && proxyData.auth) {
163
  const [username, password] = proxyData.auth.split(':');
164
  await page.authenticate({ username, password });
165
  }
166
 
167
+ // Intercept: Stylesheet JANGAN diblokir agar widget terbaca
168
  await page.setRequestInterception(true);
169
  page.on('request', (req) => {
170
  const resource = req.resourceType();
 
172
  else req.continue();
173
  });
174
 
175
+ console.log(`[SYSTEM] Browser initialized with rektCaptcha`);
176
  return { browser, page };
177
  }
178