Spaces:
Runtime error
Runtime error
Update server.js
Browse files
server.js
CHANGED
|
@@ -154,12 +154,16 @@ app.get('/auth/login', (req, res) => {
|
|
| 154 |
});
|
| 155 |
|
| 156 |
async function fetchWithRetry(url, options, retries = 2) {
|
|
|
|
|
|
|
|
|
|
| 157 |
for (let i = 0; i <= retries; i++) {
|
| 158 |
try {
|
| 159 |
let targetUrl = url;
|
| 160 |
// Use direct connection to Discord API
|
| 161 |
if (url.includes('discord.com/api')) {
|
| 162 |
-
targetUrl = url;
|
|
|
|
| 163 |
if (i > 0) console.log(`[Dashboard] Retrying Discord API call (${i + 1}/${retries})...`);
|
| 164 |
}
|
| 165 |
|
|
|
|
| 154 |
});
|
| 155 |
|
| 156 |
async function fetchWithRetry(url, options, retries = 2) {
|
| 157 |
+
const https = require('https');
|
| 158 |
+
const agent = new https.Agent({ rejectUnauthorized: false });
|
| 159 |
+
|
| 160 |
for (let i = 0; i <= retries; i++) {
|
| 161 |
try {
|
| 162 |
let targetUrl = url;
|
| 163 |
// Use direct connection to Discord API
|
| 164 |
if (url.includes('discord.com/api')) {
|
| 165 |
+
targetUrl = url;
|
| 166 |
+
options.agent = agent; // Apply the agent here
|
| 167 |
if (i > 0) console.log(`[Dashboard] Retrying Discord API call (${i + 1}/${retries})...`);
|
| 168 |
}
|
| 169 |
|