From 85b04208364172cb824d6a7b5aeb21c153795749 Mon Sep 17 00:00:00 2001 From: Amirreza Date: Mon, 6 Jul 2026 01:55:55 +0330 Subject: [PATCH] ll --- index.js | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/index.js b/index.js index 34ce890..d78d367 100644 --- a/index.js +++ b/index.js @@ -66,33 +66,13 @@ const { default: axios } = require('axios'); // })); // // Socket.IO CORS -// const io = require('socket.io')(http, { -// cors: { -// origin: (origin, callback) => { -// if (process.env.NODE_ENV !== 'production') { -// return callback(null, true); -// } - -// if (!origin) { -// return callback(null, true); -// } - -// const isAllowed = allowedOrigins.some(item => { -// if (typeof item === 'string') return item === origin; -// if (item instanceof RegExp) return item.test(origin); -// return false; -// }); - -// if (isAllowed) { -// callback(null, true); -// } else { -// callback(new Error('Not allowed by CORS')); -// } -// }, -// methods: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'], -// credentials: true -// } -// }); +const io = require('socket.io')(http, { + cors: { + origin: '*', + methods: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'], + credentials: true + } +}); // افزایش limit برای Base64 (1000mb کافیه) app.use(express.json({ limit: '1000mb' }));