diff --git a/app/config.js b/app/config.js index 49423916e..3a865109d 100644 --- a/app/config.js +++ b/app/config.js @@ -20,10 +20,12 @@ if (environment === 'production') { process.env.NODE_CONFIG = ''; process.env.NODE_CONFIG_STRICT_MODE = true; process.env.HOSTNAME = ''; - process.env.NODE_APP_INSTANCE = ''; process.env.ALLOW_CONFIG_MUTATIONS = ''; process.env.SUPPRESS_NO_CONFIG_WARNING = ''; process.env.NODE_TLS_REJECT_UNAUTHORIZED = ''; + if (!process.env.LOKI_DEV) { + process.env.NODE_APP_INSTANCE = ''; + } } // We load config after we've made our modifications to NODE_ENV diff --git a/config/default.json b/config/default.json index e3d3701b8..c6ead5686 100644 --- a/config/default.json +++ b/config/default.json @@ -7,15 +7,7 @@ "defaultPoWDifficulty": "100", "seedNodeList": [ { - "ip": "3.104.19.14", - "port": "22023" - }, - { - "ip": "13.238.53.205", - "port": "38157" - }, - { - "ip": "imaginary.stream", + "ip": "storage.testnetseed1.loki.network", "port": "38157" } ], diff --git a/config/production.json b/config/production.json index 0967ef424..7114a9bba 100644 --- a/config/production.json +++ b/config/production.json @@ -1 +1,16 @@ -{} +{ + "seedNodeList": [ + { + "ip": "storage.seed1.loki.network", + "port": "22023" + }, + { + "ip": "storage.seed2.loki.network", + "port": "38157" + }, + { + "ip": "imaginary.stream", + "port": "38157" + } + ] +} diff --git a/js/modules/loki_message_api.js b/js/modules/loki_message_api.js index 05af76ea7..199448a57 100644 --- a/js/modules/loki_message_api.js +++ b/js/modules/loki_message_api.js @@ -96,7 +96,7 @@ class LokiMessageAPI { const timestamp = Date.now(); const nonce = await calcNonce( messageEventData, - pubKey, + window.getStoragePubKey(pubKey), data64, timestamp, ttl diff --git a/js/modules/loki_rpc.js b/js/modules/loki_rpc.js index ae5daa351..13e37e511 100644 --- a/js/modules/loki_rpc.js +++ b/js/modules/loki_rpc.js @@ -1,4 +1,4 @@ -/* global log, libloki, textsecure */ +/* global log, libloki, textsecure, getStoragePubKey */ const nodeFetch = require('node-fetch'); const { parse } = require('url'); @@ -119,6 +119,14 @@ const rpc = ( const portString = port ? `:${port}` : ''; const url = `${address}${portString}${endpoint}`; // TODO: The jsonrpc and body field will be ignored on storage server + if (params.pubKey) { + // Ensure we always take a copy + // eslint-disable-next-line no-param-reassign + params = { + ...params, + pubKey: getStoragePubKey(params.pubKey), + }; + } const body = { jsonrpc: '2.0', id: '0', diff --git a/package.json b/package.json index ef7069683..332d053fe 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,8 @@ "postinstall": "electron-builder install-app-deps && rimraf node_modules/dtrace-provider", "start": "electron .", "start-multi": "NODE_APP_INSTANCE=1 electron .", + "start-prod": "LOKI_DEV=1 electron .", + "start-prod-multi": "LOKI_DEV=1 NODE_APP_INSTANCE=1 electron .", "grunt": "grunt", "icon-gen": "electron-icon-maker --input=images/icon_1024.png --output=./build", "generate": "yarn icon-gen && yarn grunt", diff --git a/preload.js b/preload.js index b4fde7040..be63b33f6 100644 --- a/preload.js +++ b/preload.js @@ -26,6 +26,7 @@ window.platform = process.platform; window.getDefaultPoWDifficulty = () => config.defaultPoWDifficulty; window.getTitle = () => title; window.getEnvironment = () => config.environment; +window.isDev = () => config.environment === 'development'; window.getAppInstance = () => config.appInstance; window.getVersion = () => config.version; window.isImportMode = () => config.importMode; @@ -36,6 +37,8 @@ window.getHostName = () => config.hostname; window.getServerTrustRoot = () => config.serverTrustRoot; window.isBehindProxy = () => Boolean(config.proxyUrl); window.JobQueue = JobQueue; +window.getStoragePubKey = key => + window.isDev() ? key.substring(0, key.length - 2) : key; window.isBeforeVersion = (toCheck, baseVersion) => { try {