From 3a67db8891d5cdf3bd1cc52b6a2aa921f7a05a61 Mon Sep 17 00:00:00 2001 From: Fabrice Baumann Date: Mon, 19 Oct 2020 19:46:59 -0400 Subject: [PATCH 1/2] Bugfix: fix typescript issues --- package.json | 2 +- src/index.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d20bf7c..86a4c35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "excalidraw-room", - "version": "1.0.0", + "version": "1.0.1", "description": "Excalidraw collaboration server", "main": "index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index ac9f2a7..8bb61fd 100755 --- a/src/index.ts +++ b/src/index.ts @@ -17,13 +17,13 @@ server.listen(port, () => { }); const io = socketIO(server, { - handlePreflightRequest: function (req, res) { + handlePreflightRequest: function (server, req, res) { var headers = { "Access-Control-Allow-Headers": "Content-Type, Authorization", - "Access-Control-Allow-Origin": req.header ? req.header.origin : "*", - "Access-Control-Allow-Credentials": true, + "Access-Control-Allow-Origin": req.headers ? req.headers.origin : "*", + "Access-Control-Allow-Credentials": "true", }; - res.writeHead(200, headers); + res.writeHead(200, 'cors', headers); res.end(); }, }); From 8ad980912da273dc13488d91ed773601edc0d5b8 Mon Sep 17 00:00:00 2001 From: Fabrice Baumann Date: Mon, 19 Oct 2020 19:53:02 -0400 Subject: [PATCH 2/2] Remove optional message --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 8bb61fd..ac54de5 100755 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,7 @@ const io = socketIO(server, { "Access-Control-Allow-Origin": req.headers ? req.headers.origin : "*", "Access-Control-Allow-Credentials": "true", }; - res.writeHead(200, 'cors', headers); + res.writeHead(200, headers); res.end(); }, });