HerzaJ commited on
Commit
2f70c2e
·
verified ·
1 Parent(s): ac49a00

Update plugins/sora2.js

Browse files
Files changed (1) hide show
  1. plugins/sora2.js +14 -17
plugins/sora2.js CHANGED
@@ -1,10 +1,7 @@
1
  const axios = require('axios');
2
  const dns = require('dns').promises;
3
- const { HttpsProxyAgent } = require('https-proxy-agent');
4
 
5
- const PROXY_HOST = 'de19.spaceify.eu';
6
- const PROXY_PORT = 25815;
7
- const PROXY_URL = `http://${PROXY_HOST}:${PROXY_PORT}`;
8
  const API_BASE_URL = 'https://api.bylo.ai';
9
 
10
  dns.setServers(['1.1.1.1', '8.8.8.8', '8.8.4.4']);
@@ -36,7 +33,6 @@ function generateRandomIP() {
36
  async function proxyRequest(path, options = {}) {
37
  const fullUrl = path.startsWith('http') ? path : `${API_BASE_URL}${path}`;
38
  const fakeIP = generateRandomIP();
39
- const proxyAgent = new HttpsProxyAgent(PROXY_URL);
40
 
41
  const headers = {
42
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
@@ -51,30 +47,31 @@ async function proxyRequest(path, options = {}) {
51
 
52
  await randomDelay(300, 800);
53
 
54
- const axiosConfig = {
55
- url: fullUrl,
56
- method: options.method || 'GET',
57
- headers: headers,
 
 
 
 
 
 
 
 
58
  timeout: 60000,
59
- httpAgent: proxyAgent,
60
- httpsAgent: proxyAgent,
61
- proxy: false,
62
  validateStatus: function (status) {
63
  return status >= 200 && status < 600;
64
  }
65
  };
66
 
67
- if (options.data && (options.method === 'POST' || options.method === 'PUT')) {
68
- axiosConfig.data = options.data;
69
- }
70
-
71
  let lastError = null;
72
 
73
  for (let attempt = 1; attempt <= 3; attempt++) {
74
  try {
75
  console.log(`[${new Date().toISOString()}] Attempt ${attempt}: ${fullUrl}`);
76
 
77
- const response = await axios(axiosConfig);
78
 
79
  console.log(`[${new Date().toISOString()}] Status ${response.status}`);
80
 
 
1
  const axios = require('axios');
2
  const dns = require('dns').promises;
 
3
 
4
+ const PROXY_URL = 'https://proxy-sigma-roan.vercel.app/api/proxy';
 
 
5
  const API_BASE_URL = 'https://api.bylo.ai';
6
 
7
  dns.setServers(['1.1.1.1', '8.8.8.8', '8.8.4.4']);
 
33
  async function proxyRequest(path, options = {}) {
34
  const fullUrl = path.startsWith('http') ? path : `${API_BASE_URL}${path}`;
35
  const fakeIP = generateRandomIP();
 
36
 
37
  const headers = {
38
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
 
47
 
48
  await randomDelay(300, 800);
49
 
50
+ const proxyConfig = {
51
+ url: PROXY_URL,
52
+ method: 'POST',
53
+ headers: {
54
+ 'Content-Type': 'application/json'
55
+ },
56
+ data: {
57
+ url: fullUrl,
58
+ method: options.method || 'GET',
59
+ headers: headers,
60
+ ...(options.data && { body: options.data })
61
+ },
62
  timeout: 60000,
 
 
 
63
  validateStatus: function (status) {
64
  return status >= 200 && status < 600;
65
  }
66
  };
67
 
 
 
 
 
68
  let lastError = null;
69
 
70
  for (let attempt = 1; attempt <= 3; attempt++) {
71
  try {
72
  console.log(`[${new Date().toISOString()}] Attempt ${attempt}: ${fullUrl}`);
73
 
74
+ const response = await axios(proxyConfig);
75
 
76
  console.log(`[${new Date().toISOString()}] Status ${response.status}`);
77