mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
fix: ts error
This commit is contained in:
parent
39ba5aab82
commit
cef1573f38
1 changed files with 14 additions and 0 deletions
|
@ -52,11 +52,15 @@ exports.expressCloseServer = async () => {
|
||||||
logger.info('All socket.io clients have disconnected');
|
logger.info('All socket.io clients have disconnected');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
exports.socketSessionMiddleware = (args: any) => (socket: any, next: Function) => {
|
exports.socketSessionMiddleware = (args: any) => (socket: any, next: Function) => {
|
||||||
=======
|
=======
|
||||||
exports.socketSessionMiddleware = (socket: any, next: Function) => {
|
exports.socketSessionMiddleware = (socket: any, next: Function) => {
|
||||||
>>>>>>> 53a847ce4 (feat :migrate socket.io 2 -> 3)
|
>>>>>>> 53a847ce4 (feat :migrate socket.io 2 -> 3)
|
||||||
|
=======
|
||||||
|
exports.socketSessionMiddleware = (args: any) => (socket: any, next: Function) => {
|
||||||
|
>>>>>>> 152f0a1ab (fix: ts error)
|
||||||
const req = socket.request;
|
const req = socket.request;
|
||||||
// Express sets req.ip but socket.io does not. Replicate Express's behavior here.
|
// Express sets req.ip but socket.io does not. Replicate Express's behavior here.
|
||||||
if (req.ip == null) {
|
if (req.ip == null) {
|
||||||
|
@ -67,6 +71,7 @@ exports.socketSessionMiddleware = (socket: any, next: Function) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!req.headers.cookie) {
|
if (!req.headers.cookie) {
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
// socketio.js-client on node.js doesn't support cookies, so pass them via a query parameter.
|
// socketio.js-client on node.js doesn't support cookies, so pass them via a query parameter.
|
||||||
req.headers.cookie = socket.handshake.query.cookie;
|
req.headers.cookie = socket.handshake.query.cookie;
|
||||||
|
@ -78,6 +83,11 @@ exports.socketSessionMiddleware = (socket: any, next: Function) => {
|
||||||
}
|
}
|
||||||
// See: https://socket.io/docs/faq/#Usage-with-express-session
|
// See: https://socket.io/docs/faq/#Usage-with-express-session
|
||||||
>>>>>>> 53a847ce4 (feat :migrate socket.io 2 -> 3)
|
>>>>>>> 53a847ce4 (feat :migrate socket.io 2 -> 3)
|
||||||
|
=======
|
||||||
|
// socketio.js-client on node.js doesn't support cookies, so pass them via a query parameter.
|
||||||
|
req.headers.cookie = socket.handshake.query.cookie;
|
||||||
|
}
|
||||||
|
>>>>>>> 152f0a1ab (fix: ts error)
|
||||||
express.sessionMiddleware(req, {}, next);
|
express.sessionMiddleware(req, {}, next);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -117,6 +127,7 @@ exports.expressCreateServer = (hookName:string, args:ArgsExpressType, cb:Functio
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
io.on('connection', handleConnection);
|
io.on('connection', handleConnection);
|
||||||
|
|
||||||
|
@ -128,6 +139,9 @@ exports.expressCreateServer = (hookName:string, args:ArgsExpressType, cb:Functio
|
||||||
=======
|
=======
|
||||||
io.use(exports.socketSessionMiddleware);
|
io.use(exports.socketSessionMiddleware);
|
||||||
>>>>>>> 53a847ce4 (feat :migrate socket.io 2 -> 3)
|
>>>>>>> 53a847ce4 (feat :migrate socket.io 2 -> 3)
|
||||||
|
=======
|
||||||
|
io.use(exports.socketSessionMiddleware(args));
|
||||||
|
>>>>>>> 152f0a1ab (fix: ts error)
|
||||||
|
|
||||||
io.use((socket:any, next:Function) => {
|
io.use((socket:any, next:Function) => {
|
||||||
socket.conn.on('packet', (packet:string) => {
|
socket.conn.on('packet', (packet:string) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue