@ikyyofc/gemini-cli 2.0.2 → 2.0.4
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/package.json +1 -1
- package/utils/proxy-manager.js +1 -14
package/package.json
CHANGED
package/utils/proxy-manager.js
CHANGED
|
@@ -3,17 +3,11 @@ import axios from "axios";
|
|
|
3
3
|
// 1. Menghapus data duplikat di proxyPool
|
|
4
4
|
const proxyPool = [
|
|
5
5
|
{ name: "caliph", host: "https://cors.caliph.my.id/" },
|
|
6
|
-
{ name: "eu", host: "https://cors.eu.org/" },
|
|
7
6
|
{ name: "prox", host: "https://prox.26bruunjorl.workers.dev/" },
|
|
8
|
-
{ name: "wave", host: "https://plain-wave-6f5f.apis1.workers.dev/" },
|
|
9
|
-
{ name: "hill", host: "https://young-hill-815e.apis3.workers.dev/" },
|
|
10
7
|
{ name: "icy", host: "https://icy-morning-72e2.apis2.workers.dev/" },
|
|
11
8
|
{ name: "fazri", host: "https://cors.fazri.workers.dev/" },
|
|
12
9
|
{ name: "spring", host: "https://spring-night-57a1.3540746063.workers.dev/" },
|
|
13
|
-
{ name: "sizable", host: "https://cors.sizable.workers.dev/" }
|
|
14
|
-
{ name: "jiashu", host: "https://jiashu.1win.eu.org/" },
|
|
15
|
-
{ name: "artemisandros", host: "https://cors.artemisandros.workers.dev/?" },
|
|
16
|
-
{ name: "supershadowcube", host: "https://cloudflare-cors-anywhere.supershadowcube.workers.dev/?url=" }
|
|
10
|
+
{ name: "sizable", host: "https://cors.sizable.workers.dev/" }
|
|
17
11
|
];
|
|
18
12
|
|
|
19
13
|
const userAgents = [
|
|
@@ -30,7 +24,6 @@ function getRandomProxy() {
|
|
|
30
24
|
for (const [name, failedAt] of failedProxies.entries()) {
|
|
31
25
|
if (now - failedAt > COOLDOWN_TIME) {
|
|
32
26
|
failedProxies.delete(name);
|
|
33
|
-
console.log(`[Global Proxy] 🔓 ${name} telah dibuka kembali`);
|
|
34
27
|
}
|
|
35
28
|
}
|
|
36
29
|
|
|
@@ -38,7 +31,6 @@ function getRandomProxy() {
|
|
|
38
31
|
|
|
39
32
|
if (available.length === 0) {
|
|
40
33
|
failedProxies.clear();
|
|
41
|
-
console.warn("[Global Proxy] ⚠️ Semua proxy gagal, mereset paksa daftar...");
|
|
42
34
|
return proxyPool[Math.floor(Math.random() * proxyPool.length)];
|
|
43
35
|
}
|
|
44
36
|
return available[Math.floor(Math.random() * available.length)];
|
|
@@ -77,8 +69,6 @@ export function setupGlobalProxy() {
|
|
|
77
69
|
config.metadata = { proxyName: proxy.name, proxyHost: proxy.host, originalUrl: url };
|
|
78
70
|
config._isProxied = true; // Flag untuk retry
|
|
79
71
|
|
|
80
|
-
console.log(`[Global Proxy] 🔄 ${proxy.name} → ${url}`);
|
|
81
|
-
|
|
82
72
|
return config;
|
|
83
73
|
},
|
|
84
74
|
error => Promise.reject(error)
|
|
@@ -93,14 +83,12 @@ export function setupGlobalProxy() {
|
|
|
93
83
|
if (meta?.proxyName && !config._retryAttempted) {
|
|
94
84
|
// Tandai proxy gagal
|
|
95
85
|
failedProxies.set(meta.proxyName, Date.now());
|
|
96
|
-
console.warn(`[Global Proxy] ❌ Proxy "${meta.proxyName}" gagal, diblokir sementara.`);
|
|
97
86
|
|
|
98
87
|
// 3. Mekanisme Auto-Retry (Mencoba 1x lagi dengan proxy berbeda)
|
|
99
88
|
config._retryAttempted = true;
|
|
100
89
|
config._isProxied = false; // Reset agar dicegat ulang oleh request interceptor
|
|
101
90
|
config.url = meta.originalUrl; // Kembalikan ke URL asli
|
|
102
91
|
|
|
103
|
-
console.log(`[Global Proxy] 🔄 Mencoba ulang request ke ${meta.originalUrl}...`);
|
|
104
92
|
return axios(config); // Coba request ulang
|
|
105
93
|
}
|
|
106
94
|
|
|
@@ -108,5 +96,4 @@ export function setupGlobalProxy() {
|
|
|
108
96
|
}
|
|
109
97
|
);
|
|
110
98
|
|
|
111
|
-
console.log("🛡️ Global Proxy Manager diaktifkan!");
|
|
112
99
|
}
|