From d88ad1e7069003814be12f52cd2ab17fd86df5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Tue, 13 Apr 2021 13:21:02 +0300 Subject: [PATCH 1/9] Added websocket authentication --- bin/authenticators/conspectus.js | 37 ++++++++++++++++++++++++ bin/collaborate-editing-server.js | 8 +++++ bin/connections/mysql.js | 23 +++++++++++++++ bin/transfer-data-from-mysql-to-redis.js | 20 +------------ 4 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 bin/authenticators/conspectus.js create mode 100644 bin/connections/mysql.js diff --git a/bin/authenticators/conspectus.js b/bin/authenticators/conspectus.js new file mode 100644 index 00000000..0b5dba1c --- /dev/null +++ b/bin/authenticators/conspectus.js @@ -0,0 +1,37 @@ +const mysqlConnection = require('../connections/mysql').mysqlConnection + +function parseCookies (cookies) { + const list = {} + + cookies && cookies.split(';').forEach(function (cookie) { + const parts = cookie.split('=') + list[parts.shift().trim()] = decodeURI(parts.join('=')) + }) + + return list +} + +module.exports = { + authenticate: function (request) { + const rawCookies = request.headers.cookie + if (!rawCookies) { + return false + } + const cookies = parseCookies(rawCookies) + if (!cookies.sessionId) { + return false + } + let authenticated = false + mysqlConnection.query( + 'SELECT session_key FROM django_session WHERE session_key = ?', + [cookies.sessionId], + function (error, rows, fields) { + if (error) { + throw error + } + authenticated = rows.length === 1 + } + ) + return authenticated + } +} diff --git a/bin/collaborate-editing-server.js b/bin/collaborate-editing-server.js index cbddd159..fbf662da 100644 --- a/bin/collaborate-editing-server.js +++ b/bin/collaborate-editing-server.js @@ -8,6 +8,7 @@ const setupWSConnection = require('./utils.js').setupWSConnection const host = process.env.YWEBSOCKET_HOST || 'localhost' const port = process.env.YWEBSOCKET_PORT || 1234 +const authenticator = process.env.YWEBSOCKET_AUTHENTICATOR || null const server = http.createServer((request, response) => { response.writeHead(200, { 'Content-Type': 'application/json' }) @@ -22,6 +23,13 @@ server.on('upgrade', (request, socket, head) => { * @param {any} ws */ const handleAuth = ws => { + if (authenticator) { + const authenticatorInstance = require('./authenticators/' + authenticator) + if (!authenticatorInstance.authenticate(request)) { + return + } + } + wss.emit('connection', ws, request) } wss.handleUpgrade(request, socket, head, handleAuth) diff --git a/bin/connections/mysql.js b/bin/connections/mysql.js new file mode 100644 index 00000000..db8f92e1 --- /dev/null +++ b/bin/connections/mysql.js @@ -0,0 +1,23 @@ +const mysql = require('mysql2') + +const MYSQL_HOST = process.env.MYSQL_HOST || 'localhost' +const MYSQL_PORT = process.env.MYSQL_PORT || 3306 +const MYSQL_USER = process.env.MYSQL_USER || 'root' +const MYSQL_PASSWORD = process.env.MYSQL_PASSWORD || '' +const MYSQL_DATABASE = process.env.MYSQL_DATABASE || 'database' + +const mysqlConnection = mysql.createConnection({ + host: MYSQL_HOST, + user: MYSQL_USER, + database: MYSQL_DATABASE, + password: MYSQL_PASSWORD, + port: MYSQL_PORT +}) + +mysqlConnection.connect(function (error) { + if (error) throw error +}) + +module.exports = { + mysqlConnection: mysqlConnection +} diff --git a/bin/transfer-data-from-mysql-to-redis.js b/bin/transfer-data-from-mysql-to-redis.js index 283d3ddf..aac50b97 100644 --- a/bin/transfer-data-from-mysql-to-redis.js +++ b/bin/transfer-data-from-mysql-to-redis.js @@ -1,29 +1,11 @@ #!/usr/bin/env node const redisPersistenceBridge = require('./redis-persistence-bridge') +const mysqlConnection = require('../connections/mysql').mysqlConnection -const mysql = require('mysql2') - -const MYSQL_HOST = process.env.MYSQL_HOST || 'localhost' -const MYSQL_USER = process.env.MYSQL_USER || 'root' -const MYSQL_PASSWORD = process.env.MYSQL_PASSWORD || '' -const MYSQL_DATABASE = process.env.MYSQL_DATABASE || 'database' const MYSQL_TABLE = process.env.MYSQL_TABLE || 'table' const MYSQL_CONTENT_FIELDS = process.env.MYSQL_CONTENT_FIELDS || 'content' const MYSQL_KEY_FIELD = process.env.MYSQL_KEY_FIELD || 'id' -const MYSQL_PORT = process.env.MYSQL_PORT || 3306 - -const mysqlConnection = mysql.createConnection({ - host: MYSQL_HOST, - user: MYSQL_USER, - database: MYSQL_DATABASE, - password: MYSQL_PASSWORD, - port: MYSQL_PORT -}) - -mysqlConnection.connect(function (error) { - if (error) throw error -}) mysqlConnection.query( `SELECT ${MYSQL_KEY_FIELD}, ${MYSQL_CONTENT_FIELDS} FROM ${MYSQL_TABLE}`, From a9607dd48466f8aaecaec3701a0f4d2b9ff9b824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Wed, 14 Apr 2021 17:24:04 +0300 Subject: [PATCH 2/9] Switched authentication to HTTP --- .gitignore | 3 ++- bin/authenticators/conspectus.js | 37 -------------------------- bin/authenticators/http.js | 44 +++++++++++++++++++++++++++++++ bin/collaborate-editing-server.js | 13 ++++----- bin/utils.js | 31 +++++++++++++--------- 5 files changed, 71 insertions(+), 57 deletions(-) delete mode 100644 bin/authenticators/conspectus.js create mode 100644 bin/authenticators/http.js diff --git a/.gitignore b/.gitignore index 5f6c423e..5f8b2692 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dist node_modules -tmp \ No newline at end of file +tmp +tests \ No newline at end of file diff --git a/bin/authenticators/conspectus.js b/bin/authenticators/conspectus.js deleted file mode 100644 index 0b5dba1c..00000000 --- a/bin/authenticators/conspectus.js +++ /dev/null @@ -1,37 +0,0 @@ -const mysqlConnection = require('../connections/mysql').mysqlConnection - -function parseCookies (cookies) { - const list = {} - - cookies && cookies.split(';').forEach(function (cookie) { - const parts = cookie.split('=') - list[parts.shift().trim()] = decodeURI(parts.join('=')) - }) - - return list -} - -module.exports = { - authenticate: function (request) { - const rawCookies = request.headers.cookie - if (!rawCookies) { - return false - } - const cookies = parseCookies(rawCookies) - if (!cookies.sessionId) { - return false - } - let authenticated = false - mysqlConnection.query( - 'SELECT session_key FROM django_session WHERE session_key = ?', - [cookies.sessionId], - function (error, rows, fields) { - if (error) { - throw error - } - authenticated = rows.length === 1 - } - ) - return authenticated - } -} diff --git a/bin/authenticators/http.js b/bin/authenticators/http.js new file mode 100644 index 00000000..26adbe94 --- /dev/null +++ b/bin/authenticators/http.js @@ -0,0 +1,44 @@ +const authCallback = process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK || 'http://localhost/auth/' +const authRequester = require('http') + +module.exports = { + authenticate: function (request) { + return new Promise(function (resolve, reject) { + const cookie = request.headers.cookie + console.log(request.headers) + if (!cookie) { + cookie = '' + } + const docName = request.url.substring(1) + console.log(docName) + const authCallbackWithRoomCode = authCallback + docName + const authRequest = authRequester.request(authCallbackWithRoomCode, + { + method: 'GET', + headers: { + Cookie: cookie + } + }, + (response) => { + if (response.statusCode < 200 || response.statusCode >= 300) { + return reject(new Error('statusCode=' + response.statusCode)) + } + response.setEncoding('utf8') + let rawData = '' + response.on('data', (chunk) => { + rawData += chunk + }) + response.on('end', () => { + const data = JSON.parse(rawData) + if (data.status === 'ok') { + resolve(true) + } + }) + authRequest.on('error', function (error) { + reject(error) + }) + authRequest.end() + }) + }) + } +} diff --git a/bin/collaborate-editing-server.js b/bin/collaborate-editing-server.js index fbf662da..bc19ce1c 100644 --- a/bin/collaborate-editing-server.js +++ b/bin/collaborate-editing-server.js @@ -22,15 +22,16 @@ server.on('upgrade', (request, socket, head) => { /** * @param {any} ws */ + const handleAuth = ws => { if (authenticator) { - const authenticatorInstance = require('./authenticators/' + authenticator) - if (!authenticatorInstance.authenticate(request)) { - return - } + const authenticate = require('./authenticators/' + authenticator).authenticate + authenticate(request).then(() => { + wss.emit('connection', ws, request) + }) + } else { + wss.emit('connection', ws, request) } - - wss.emit('connection', ws, request) } wss.handleUpgrade(request, socket, head, handleAuth) }) diff --git a/bin/utils.js b/bin/utils.js index 411b62f4..7cc14214 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -38,23 +38,28 @@ if (typeof persistencePath === 'string') { console.info('Persisting documents to "' + persistenceHost + '"') const RedisPersistence = require('y-redis').RedisPersistence persistenceDB = new RedisPersistence({ redisOpts: { host: persistenceHost, port: persistencePort } }) + persistence = { + provider: persistenceDB, + bindState: persistenceDB.bindState, + writeState: async (docName, ydoc) => {} + } } else { console.info('Persisting documents to "' + persistencePath + '"') const LeveldbPersistence = require('y-leveldb').LeveldbPersistence persistenceDB = new LeveldbPersistence(persistencePath) - } - persistence = { - provider: persistenceDB, - bindState: async (docName, ydoc) => { - const persistedYdoc = await persistenceDB.getYDoc(docName) - const newUpdates = Y.encodeStateAsUpdate(ydoc) - persistenceDB.storeUpdate(docName, newUpdates) - Y.applyUpdate(ydoc, Y.encodeStateAsUpdate(persistedYdoc)) - ydoc.on('update', update => { - persistenceDB.storeUpdate(docName, update) - }) - }, - writeState: async (docName, ydoc) => {} + persistence = { + provider: persistenceDB, + bindState: async (docName, ydoc) => { + const persistedYdoc = await persistenceDB.getYDoc(docName) + const newUpdates = Y.encodeStateAsUpdate(ydoc) + persistenceDB.storeUpdate(docName, newUpdates) + Y.applyUpdate(ydoc, Y.encodeStateAsUpdate(persistedYdoc)) + ydoc.on('update', update => { + persistenceDB.storeUpdate(docName, update) + }) + }, + writeState: async (docName, ydoc) => {} + } } } From 6e898581be720a24114b71b58159a078c17bc224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Wed, 14 Apr 2021 17:29:14 +0300 Subject: [PATCH 3/9] Fixed typos and removed console logs --- bin/authenticators/http.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/authenticators/http.js b/bin/authenticators/http.js index 26adbe94..ba0e6dda 100644 --- a/bin/authenticators/http.js +++ b/bin/authenticators/http.js @@ -4,13 +4,11 @@ const authRequester = require('http') module.exports = { authenticate: function (request) { return new Promise(function (resolve, reject) { - const cookie = request.headers.cookie - console.log(request.headers) + let cookie = request.headers.cookie if (!cookie) { cookie = '' } const docName = request.url.substring(1) - console.log(docName) const authCallbackWithRoomCode = authCallback + docName const authRequest = authRequester.request(authCallbackWithRoomCode, { From 2d005e93cafe7ed00361ddc33ad98b160f8bd0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Thu, 15 Apr 2021 07:19:51 +0300 Subject: [PATCH 4/9] Simplified cookie extraction --- bin/authenticators/http.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bin/authenticators/http.js b/bin/authenticators/http.js index ba0e6dda..048900c5 100644 --- a/bin/authenticators/http.js +++ b/bin/authenticators/http.js @@ -4,17 +4,13 @@ const authRequester = require('http') module.exports = { authenticate: function (request) { return new Promise(function (resolve, reject) { - let cookie = request.headers.cookie - if (!cookie) { - cookie = '' - } const docName = request.url.substring(1) const authCallbackWithRoomCode = authCallback + docName const authRequest = authRequester.request(authCallbackWithRoomCode, { method: 'GET', headers: { - Cookie: cookie + Cookie: request.headers.cookie || '' } }, (response) => { From 95f0dfb48cf0269cd9756da88206dd830a61fd5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Sun, 2 May 2021 12:03:11 +0300 Subject: [PATCH 5/9] wip --- .gitignore | 3 ++- bin/authenticators/http.js | 7 ++++++- bin/collaborate-editing-server.js | 1 - bin/note-synchronizer-server.js | 4 +--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5f8b2692..ae19d5bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ dist node_modules tmp -tests \ No newline at end of file +tests +db/ \ No newline at end of file diff --git a/bin/authenticators/http.js b/bin/authenticators/http.js index 048900c5..b1a972d3 100644 --- a/bin/authenticators/http.js +++ b/bin/authenticators/http.js @@ -1,11 +1,16 @@ const authCallback = process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK || 'http://localhost/auth/' +const authCallbackParam = process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK_GET_PARAM || 'code' const authRequester = require('http') +const querystring = require('querystring') module.exports = { authenticate: function (request) { return new Promise(function (resolve, reject) { const docName = request.url.substring(1) - const authCallbackWithRoomCode = authCallback + docName + const query = querystring.stringify({ + authCallbackParam: docName + }) + const authCallbackWithRoomCode = authCallback + '?' + query const authRequest = authRequester.request(authCallbackWithRoomCode, { method: 'GET', diff --git a/bin/collaborate-editing-server.js b/bin/collaborate-editing-server.js index bc19ce1c..292a677f 100644 --- a/bin/collaborate-editing-server.js +++ b/bin/collaborate-editing-server.js @@ -22,7 +22,6 @@ server.on('upgrade', (request, socket, head) => { /** * @param {any} ws */ - const handleAuth = ws => { if (authenticator) { const authenticate = require('./authenticators/' + authenticator).authenticate diff --git a/bin/note-synchronizer-server.js b/bin/note-synchronizer-server.js index 2a9e1609..ae06cf76 100644 --- a/bin/note-synchronizer-server.js +++ b/bin/note-synchronizer-server.js @@ -1,5 +1,3 @@ -const redisPersistenceBridge = require('./redis-persistence-bridge') - const http = require('http') const host = process.env.YPERSISTENCE_SYNCHRONIZER_HOST || 'localhost' @@ -16,7 +14,7 @@ const server = http.createServer((request, response) => { request.on('end', function () { const post = JSON.parse(body) for (const sharedObject of post.sharedObjects) { - redisPersistenceBridge.saveQuillDeltaToRedis(post.documentName, sharedObject.name, sharedObject.delta) + // redisPersistenceBridge.saveQuillDeltaToRedis(post.documentName, sharedObject.name, sharedObject.delta) } }) } From 6c7bb0534db55db3814507b6b9c159d1ec77c507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Tue, 4 May 2021 18:34:43 +0300 Subject: [PATCH 6/9] Fixed http authenticator --- bin/authenticators/http.js | 26 +++++++++++--------- bin/utils.js | 50 +++++++++++++------------------------- 2 files changed, 32 insertions(+), 44 deletions(-) diff --git a/bin/authenticators/http.js b/bin/authenticators/http.js index b1a972d3..d7e97893 100644 --- a/bin/authenticators/http.js +++ b/bin/authenticators/http.js @@ -1,5 +1,7 @@ -const authCallback = process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK || 'http://localhost/auth/' -const authCallbackParam = process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK_GET_PARAM || 'code' +const authCallback = + process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK || 'http://localhost/auth/' +const authCallbackParam = + process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK_GET_PARAM || 'code' const authRequester = require('http') const querystring = require('querystring') @@ -8,23 +10,24 @@ module.exports = { return new Promise(function (resolve, reject) { const docName = request.url.substring(1) const query = querystring.stringify({ - authCallbackParam: docName + [authCallbackParam]: docName }) const authCallbackWithRoomCode = authCallback + '?' + query - const authRequest = authRequester.request(authCallbackWithRoomCode, + const authRequest = authRequester.request( + authCallbackWithRoomCode, { method: 'GET', headers: { Cookie: request.headers.cookie || '' } }, - (response) => { + response => { if (response.statusCode < 200 || response.statusCode >= 300) { return reject(new Error('statusCode=' + response.statusCode)) } response.setEncoding('utf8') let rawData = '' - response.on('data', (chunk) => { + response.on('data', chunk => { rawData += chunk }) response.on('end', () => { @@ -33,11 +36,12 @@ module.exports = { resolve(true) } }) - authRequest.on('error', function (error) { - reject(error) - }) - authRequest.end() - }) + } + ) + authRequest.on('error', function (error) { + reject(error) + }) + authRequest.end() }) } } diff --git a/bin/utils.js b/bin/utils.js index 7cc14214..3f19b1ee 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -22,44 +22,28 @@ const wsReadyStateClosed = 3 // eslint-disable-line // disable gc when using snapshots! const gcEnabled = process.env.GC !== 'false' && process.env.GC !== '0' -const persistenceStorage = process.env.YPERSISTENCE_STORAGE || 'level-db' -const persistenceHost = process.env.YPERSISTENCE_REDIS_HOST || 'localhost' -const persistencePort = process.env.YPERSISTENCE_REDIS_PORT || 6379 -const persistencePath = process.env.YPERSISTENCE_LEVELDB_PATH || 'db' - +const persistenceDir = process.env.YPERSISTENCE_LEVELDB_PATH /** * @type {{bindState: function(string,WSSharedDoc):void, writeState:function(string,WSSharedDoc):Promise, provider: any}|null} */ let persistence = null -if (typeof persistencePath === 'string') { +if (typeof persistenceDir === 'string') { + console.info('Persisting documents to "' + persistenceDir + '"') // @ts-ignore - let persistenceDB - if (persistenceStorage === 'redis') { - console.info('Persisting documents to "' + persistenceHost + '"') - const RedisPersistence = require('y-redis').RedisPersistence - persistenceDB = new RedisPersistence({ redisOpts: { host: persistenceHost, port: persistencePort } }) - persistence = { - provider: persistenceDB, - bindState: persistenceDB.bindState, - writeState: async (docName, ydoc) => {} - } - } else { - console.info('Persisting documents to "' + persistencePath + '"') - const LeveldbPersistence = require('y-leveldb').LeveldbPersistence - persistenceDB = new LeveldbPersistence(persistencePath) - persistence = { - provider: persistenceDB, - bindState: async (docName, ydoc) => { - const persistedYdoc = await persistenceDB.getYDoc(docName) - const newUpdates = Y.encodeStateAsUpdate(ydoc) - persistenceDB.storeUpdate(docName, newUpdates) - Y.applyUpdate(ydoc, Y.encodeStateAsUpdate(persistedYdoc)) - ydoc.on('update', update => { - persistenceDB.storeUpdate(docName, update) - }) - }, - writeState: async (docName, ydoc) => {} - } + const LeveldbPersistence = require('y-leveldb').LeveldbPersistence + const ldb = new LeveldbPersistence(persistenceDir) + persistence = { + provider: ldb, + bindState: async (docName, ydoc) => { + const persistedYdoc = await ldb.getYDoc(docName) + const newUpdates = Y.encodeStateAsUpdate(ydoc) + ldb.storeUpdate(docName, newUpdates) + Y.applyUpdate(ydoc, Y.encodeStateAsUpdate(persistedYdoc)) + ydoc.on('update', update => { + ldb.storeUpdate(docName, update) + }) + }, + writeState: async (docName, ydoc) => {} } } From 903a33700ceb39e3bd2d12f0b915ca4ab401b2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Tue, 4 May 2021 18:56:03 +0300 Subject: [PATCH 7/9] Added support for https requests --- bin/authenticators/http.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/authenticators/http.js b/bin/authenticators/http.js index d7e97893..22ade038 100644 --- a/bin/authenticators/http.js +++ b/bin/authenticators/http.js @@ -1,8 +1,5 @@ -const authCallback = - process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK || 'http://localhost/auth/' -const authCallbackParam = - process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK_GET_PARAM || 'code' -const authRequester = require('http') +const authCallback = process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK || 'http://localhost/auth/' +const authCallbackParam = process.env.YWEBSOCKET_HTTP_AUTH_CALLBACK_GET_PARAM || 'code' const querystring = require('querystring') module.exports = { @@ -12,6 +9,12 @@ module.exports = { const query = querystring.stringify({ [authCallbackParam]: docName }) + let authRequester + if (authCallback.indexOf('https:') === 0) { + authRequester = require('https') + } else { + authRequester = require('http') + } const authCallbackWithRoomCode = authCallback + '?' + query const authRequest = authRequester.request( authCallbackWithRoomCode, From a741bc3aeff80baad5bd959ff599f14d4f8e3ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Wed, 5 May 2021 07:38:35 +0300 Subject: [PATCH 8/9] Fixed https support --- bin/authenticators/http.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/authenticators/http.js b/bin/authenticators/http.js index 22ade038..f692f406 100644 --- a/bin/authenticators/http.js +++ b/bin/authenticators/http.js @@ -16,6 +16,7 @@ module.exports = { authRequester = require('http') } const authCallbackWithRoomCode = authCallback + '?' + query + console.log(authCallbackWithRoomCode) const authRequest = authRequester.request( authCallbackWithRoomCode, { From f19208379c875443c60df9e5decb6eb48d9f3e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B8=CC=86=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=82=D0=B8=D0=BD?= Date: Wed, 5 May 2021 07:39:35 +0300 Subject: [PATCH 9/9] Fixed https support --- bin/authenticators/http.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/authenticators/http.js b/bin/authenticators/http.js index f692f406..2f0bdd8e 100644 --- a/bin/authenticators/http.js +++ b/bin/authenticators/http.js @@ -32,10 +32,12 @@ module.exports = { response.setEncoding('utf8') let rawData = '' response.on('data', chunk => { + console.log(chunk) rawData += chunk }) response.on('end', () => { const data = JSON.parse(rawData) + console.log(rawData) if (data.status === 'ok') { resolve(true) }