From 51eb5a1f656f709178fad50aa1268dbcd1db5fa3 Mon Sep 17 00:00:00 2001 From: emizzle Date: Wed, 20 Jun 2018 16:19:25 +1000 Subject: [PATCH] Added cors for whisper --- lib/core/config.js | 4 ++++ lib/modules/whisper/index.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/core/config.js b/lib/core/config.js index 608d1f580..43ffcd369 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -113,6 +113,10 @@ Config.prototype._updateBlockchainCors = function(){ corsParts.push(utils.buildUrlFromConfig(storageConfig.upload)); } } + // add whisper cors + if(this.communicationConfig && this.communicationConfig.enabled && this.communicationConfig.provider === 'whisper'){ + corsParts.push('embark'); + } let cors = corsParts.join(','); if(blockchainConfig.rpcCorsDomain === 'auto' && cors.length) blockchainConfig.rpcCorsDomain = cors; diff --git a/lib/modules/whisper/index.js b/lib/modules/whisper/index.js index a92fb7c65..b63a84182 100644 --- a/lib/modules/whisper/index.js +++ b/lib/modules/whisper/index.js @@ -20,7 +20,7 @@ class Whisper { connectToProvider() { let {host, port} = this.communicationConfig.connection; let web3Endpoint = 'ws://' + host + ':' + port; - this.web3.setProvider(new Web3.providers.WebsocketProvider(web3Endpoint, {headers: {Origin: "http://localhost:8000"}})); + this.web3.setProvider(new Web3.providers.WebsocketProvider(web3Endpoint, {headers: {Origin: "embark"}})); } setServiceCheck() {