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' }));