roster-server 1.2.4 → 1.2.6

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.
@@ -4,7 +4,14 @@ const { Server } = require('socket.io');
4
4
  const server = https.createServer();
5
5
 
6
6
  // Initialize Socket.IO with the HTTPS server
7
- const io = new Server(server);
7
+ const io = new Server(server, {
8
+ cors: {
9
+ origin: "*",
10
+ methods: ["GET", "POST"]
11
+ },
12
+ allowEIO3: true,
13
+ transports: ['websocket', 'polling']
14
+ });
8
15
 
9
16
  // Handle socket connections
10
17
  io.on('connection', (socket) => {
package/index.js CHANGED
@@ -184,11 +184,9 @@ class Roster {
184
184
  staging: this.staging,
185
185
  manager: { module: "@greenlock/manager" },
186
186
  approveDomains: (opts, certs, cb) => {
187
- // If certs is defined, we already have a certificate and are renewing it
188
187
  if (certs) {
189
188
  opts.domains = certs.altnames;
190
189
  } else {
191
- // If it's a new request, verify if the domain is in our list
192
190
  if (this.domains.includes(opts.domain)) {
193
191
  opts.email = this.maintainerEmail;
194
192
  opts.agreeTos = true;
@@ -206,6 +204,16 @@ class Roster {
206
204
  this.handleRequest(req, res);
207
205
  });
208
206
 
207
+ // Agregar soporte para WebSocket
208
+ httpsServer.on('upgrade', (req, socket, head) => {
209
+ const host = req.headers.host?.split(':')[0] || '';
210
+ const siteApp = this.sites[host];
211
+
212
+ if (siteApp && siteApp.upgrade) {
213
+ siteApp.upgrade(req, socket, head);
214
+ }
215
+ });
216
+
209
217
  httpsServer.listen(443, "0.0.0.0", () => {
210
218
  console.info("ℹ️ HTTPS Listening on", httpsServer.address());
211
219
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roster-server",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "👾 RosterServer - A domain host router to host multiple HTTPS.",
5
5
  "main": "index.js",
6
6
  "scripts": {