From 3797a2169c8d9d8c0a4d2bc99de44ba80bec2fd8 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Wed, 29 Jan 2020 02:47:31 -0800 Subject: [PATCH] add skipToken to establishConnection options, smuggle out secureRpcPubKey --- js/modules/loki_file_server_api.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/modules/loki_file_server_api.js b/js/modules/loki_file_server_api.js index 78c42f216..49fb47fe6 100644 --- a/js/modules/loki_file_server_api.js +++ b/js/modules/loki_file_server_api.js @@ -56,13 +56,17 @@ class LokiFileServerInstance { // FIXME: this is not file-server specific // and is currently called by LokiAppDotNetAPI. // LokiAppDotNetAPI (base) should not know about LokiFileServer. - async establishConnection(serverUrl) { + async establishConnection(serverUrl, options) { // why don't we extend this? this._server = new LokiAppDotNetAPI(this.ourKey, serverUrl); // configure proxy this._server.pubKey = this.pubKey; + if (options !== undefined && options.skipToken) { + return; + } + // get a token for multidevice const gotToken = await this._server.getOrRefreshServerToken(); // TODO: Handle this failure gracefully @@ -307,11 +311,13 @@ class LokiFileServerFactoryAPI { if (!thisServer) { thisServer = new LokiFileServerInstance(this.ourKey); log.info(`Registering FileServer ${serverUrl}`); - await thisServer.establishConnection(serverUrl); + await thisServer.establishConnection(serverUrl, { skipToken: true } ); this.servers.push(thisServer); } return thisServer; } } +// smuggle some data out of this joint (for expire.js/version upgrade check) +LokiFileServerFactoryAPI.secureRpcPubKey = LOKIFOUNDATION_FILESERVER_PUBKEY; module.exports = LokiFileServerFactoryAPI;