From 0528a4c8ac8828b8f9d9e49da2b32b351b4cb226 Mon Sep 17 00:00:00 2001 From: Audric Ackermann <audric@loki.network> Date: Wed, 26 Feb 2020 17:20:23 +1100 Subject: [PATCH] fix lint --- js/modules/loki_message_api.js | 7 ++++++- js/modules/loki_rpc.js | 7 +++++-- js/modules/loki_snode_api.js | 21 +++++++++++++++---- libtextsecure/message_receiver.js | 5 ++++- .../conversation/CreateGroupDialog.tsx | 6 +++++- 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/js/modules/loki_message_api.js b/js/modules/loki_message_api.js index 98411fd85..88b02b7af 100644 --- a/js/modules/loki_message_api.js +++ b/js/modules/loki_message_api.js @@ -217,7 +217,12 @@ class LokiMessageAPI { } return true; } catch (e) { - log.warn('Loki send message error:', e.code, e.message, `from ${address}`); + log.warn( + 'Loki send message error:', + e.code, + e.message, + `from ${address}` + ); if (e instanceof textsecure.WrongSwarmError) { const { newSwarm } = e; await lokiSnodeAPI.updateSwarmNodes(params.pubKey, newSwarm); diff --git a/js/modules/loki_rpc.js b/js/modules/loki_rpc.js index 61fb83926..5f29f6c38 100644 --- a/js/modules/loki_rpc.js +++ b/js/modules/loki_rpc.js @@ -70,7 +70,10 @@ const sendToProxy = async (options = {}, targetNode) => { // detect SNode is not ready (not in swarm; not done syncing) if (response.status === 503) { const ciphertext = await response.text(); - log.error(`lokiRpc sendToProxy snode ${randSnode.ip}:${randSnode.port} error`, ciphertext); + log.error( + `lokiRpc sendToProxy snode ${randSnode.ip}:${randSnode.port} error`, + ciphertext + ); // mark as bad for this round (should give it some time and improve success rates) lokiSnodeAPI.markRandomNodeUnreachable(randSnode); // retry for a new working snode @@ -104,7 +107,7 @@ const sendToProxy = async (options = {}, targetNode) => { const textDecoder = new TextDecoder(); plaintext = textDecoder.decode(plaintextBuffer); - } catch(e) { + } catch (e) { log.error( 'lokiRpc sendToProxy decode error', e.code, diff --git a/js/modules/loki_snode_api.js b/js/modules/loki_snode_api.js index 7bc2944ed..7d163a215 100644 --- a/js/modules/loki_snode_api.js +++ b/js/modules/loki_snode_api.js @@ -31,7 +31,10 @@ class LokiSnodeAPI { ]; } - async initialiseRandomPool(seedNodes = [...window.seedNodeList], consecutiveErrors = 0) { + async initialiseRandomPool( + seedNodes = [...window.seedNodeList], + consecutiveErrors = 0 + ) { const params = { limit: 20, active_only: true, @@ -71,7 +74,10 @@ class LokiSnodeAPI { if (consecutiveErrors < 3) { // retry after a possible delay setTimeout(() => { - log.info('Retrying initialising random snode pool, try #', consecutiveErrors); + log.info( + 'Retrying initialising random snode pool, try #', + consecutiveErrors + ); this.initialiseRandomPool(seedNodes, consecutiveErrors + 1); }, consecutiveErrors * consecutiveErrors * 5000); } else { @@ -181,7 +187,12 @@ class LokiSnodeAPI { const snodes = result.snodes.filter(tSnode => tSnode.ip !== '0.0.0.0'); return snodes; } catch (e) { - log.error('getSnodesForPubkey error', e.code, e.message, `for ${snode.ip}:${snode.port}`); + log.error( + 'getSnodesForPubkey error', + e.code, + e.message, + `for ${snode.ip}:${snode.port}` + ); this.markRandomNodeUnreachable(snode); return []; } @@ -197,7 +208,9 @@ class LokiSnodeAPI { const resList = await this.getSnodesForPubkey(rSnode, pubKey); // should we only activate entries that are in all results? resList.map(item => { - const hasItem = snodes.some(hItem => item.ip === hItem.ip && item.port === hItem.port); + const hasItem = snodes.some( + hItem => item.ip === hItem.ip && item.port === hItem.port + ); if (!hasItem) { snodes.push(item); } diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 0e6204016..b6b24f355 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -59,7 +59,10 @@ function MessageReceiver(username, password, signalingKey, options = {}) { lokiPublicChatAPI.removeAllListeners('publicMessage'); // we only need one MR in the system handling these // bind events - lokiPublicChatAPI.on('publicMessage', this.handleUnencryptedMessage.bind(this)); + lokiPublicChatAPI.on( + 'publicMessage', + this.handleUnencryptedMessage.bind(this) + ); openGroupBound = true; } } else { diff --git a/ts/components/conversation/CreateGroupDialog.tsx b/ts/components/conversation/CreateGroupDialog.tsx index ce853d4ce..482a35579 100644 --- a/ts/components/conversation/CreateGroupDialog.tsx +++ b/ts/components/conversation/CreateGroupDialog.tsx @@ -95,7 +95,11 @@ export class CreateGroupDialog extends React.Component<Props, State> { ); return ( - <SessionModal title={titleText} onClose={this.closeDialog} onOk={() => null}> + <SessionModal + title={titleText} + onClose={this.closeDialog} + onOk={() => null} + > <div className="spacer-lg" /> <p className={errorMessageClasses}>{this.state.errorMessage}</p>