Skip to content

Commit

Permalink
remove socket.io client and require static files to be served from app
Browse files Browse the repository at this point in the history
  • Loading branch information
briangough committed Oct 25, 2022
1 parent 6bf168f commit 5e35a38
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 403 deletions.
10 changes: 7 additions & 3 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ var fs = require('fs')
, crypto = require('crypto')
, util = require('./util')
, store = require('./store')
, client = require('socket.io-client')
, transports = require('./transports')
, Logger = require('./logger')
, Socket = require('./socket')
, MemoryStore = require('./stores/memory')
, SocketNamespace = require('./namespace')
, Static = require('./static')
, Static = null
, EventEmitter = require('events').EventEmitter;

/**
Expand Down Expand Up @@ -65,7 +64,7 @@ function Manager (server, options) {
, log: true
, store: new MemoryStore
, logger: new Logger
, static: new Static(this)
, static: new Set(['/socket.io.js']) // Overleaf: set of paths for static serving by app
, heartbeats: true
, resource: '/socket.io'
, transports: defaultTransports
Expand Down Expand Up @@ -991,6 +990,11 @@ Manager.prototype.checkRequest = function (req) {
, path: path
};

// Overleaf: pass all static pages back to top-level app
if (this.static.has(path)) {
return false
}

if (pieces) {
data.protocol = Number(pieces[1]);
data.transport = pieces[2];
Expand Down
8 changes: 5 additions & 3 deletions lib/socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
* Module dependencies.
*/

var client = require('socket.io-client');
// Removed from Overleaf version
// var client = require('socket.io-client');

/**
* Version.
Expand All @@ -27,7 +28,8 @@ exports.protocol = 1;
* Client that we serve.
*/

exports.clientVersion = client.version;
// Removed from Overleaf version
// exports.clientVersion = client.version;

/**
* Attaches a manager
Expand Down Expand Up @@ -108,7 +110,7 @@ exports.Socket = require('./socket');
* @api public
*/

exports.Static = require('./static');
exports.Static = null;

/**
* Store constructor.
Expand Down
Loading

0 comments on commit 5e35a38

Please sign in to comment.