pull/1160/head
Mikunj 5 years ago
parent e6139a5463
commit 3ea0689d2f

@ -2229,8 +2229,7 @@
}, },
"invalidHexId": { "invalidHexId": {
"message": "Invalid Session ID or LNS Name", "message": "Invalid Session ID or LNS Name",
"description": "description": "Error string shown when user types an invalid pubkey hex string"
"Error string shown when user types an invalid pubkey hex string"
}, },
"invalidLnsFormat": { "invalidLnsFormat": {
"message": "Invalid LNS Name", "message": "Invalid LNS Name",

@ -124,21 +124,15 @@ describe('Add friends', function() {
); );
await common.logsContains( await common.logsContains(
bobLogs, bobLogs,
`Received a NORMAL_FRIEND_REQUEST from source: ${ `Received a NORMAL_FRIEND_REQUEST from source: ${common.TEST_PUBKEY1}, primarySource: ${common.TEST_PUBKEY1},`
common.TEST_PUBKEY1
}, primarySource: ${common.TEST_PUBKEY1},`
); );
await common.logsContains( await common.logsContains(
bobLogs, bobLogs,
`Sending incoming-friend-request-accept:onlineBroadcast message to ${ `Sending incoming-friend-request-accept:onlineBroadcast message to ${common.TEST_PUBKEY1}`
common.TEST_PUBKEY1
}`
); );
await common.logsContains( await common.logsContains(
aliceLogs, aliceLogs,
`Sending outgoing-friend-request-accepted:onlineBroadcast message to ${ `Sending outgoing-friend-request-accepted:onlineBroadcast message to ${common.TEST_PUBKEY2}`
common.TEST_PUBKEY2
}`
); );
}); });
}); });

@ -52,9 +52,7 @@ describe('Link Device', function() {
// pairing request message sent from secondary to primary pubkey // pairing request message sent from secondary to primary pubkey
await common.logsContains( await common.logsContains(
secondaryRenderLogs, secondaryRenderLogs,
`Sending pairing-request:pairing-request message to ${ `Sending pairing-request:pairing-request message to ${common.TEST_PUBKEY1}`
common.TEST_PUBKEY1
}`
); );
const primaryRenderLogs = await app.client.getRenderProcessLogs(); const primaryRenderLogs = await app.client.getRenderProcessLogs();

@ -98,16 +98,12 @@ describe('Message Syncing', function() {
); );
await common.logsContains( await common.logsContains(
alice2Logs, alice2Logs,
`Sending auto-friend-request:friend-request message to ${ `Sending auto-friend-request:friend-request message to ${common.TEST_PUBKEY2}`,
common.TEST_PUBKEY2
}`,
1 1
); );
await common.logsContains( await common.logsContains(
alice2Logs, alice2Logs,
`Sending session-request:friend-request message to ${ `Sending session-request:friend-request message to ${common.TEST_PUBKEY2}`,
common.TEST_PUBKEY2
}`,
1 1
); );
await common.logsContains( await common.logsContains(

@ -1005,10 +1005,9 @@
// Search through each conversation (device) for friend request messages // Search through each conversation (device) for friend request messages
const pendingRequestPromises = allConversationsWithUser.map( const pendingRequestPromises = allConversationsWithUser.map(
async conversation => { async conversation => {
const request = (await conversation.getFriendRequests( const request = (
direction, await conversation.getFriendRequests(direction, status)
status )[0];
))[0];
return { conversation, request }; return { conversation, request };
} }
); );

@ -97,16 +97,12 @@ const sendViaOnion = async (srvPubKey, url, fetchOptions, options = {}) => {
pathNodes = await lokiSnodeAPI.getOnionPath(); pathNodes = await lokiSnodeAPI.getOnionPath();
} catch (e) { } catch (e) {
log.error( log.error(
`loki_app_dot_net:::sendViaOnion #${ `loki_app_dot_net:::sendViaOnion #${options.requestNumber} - getOnionPath Error ${e.code} ${e.message}`
options.requestNumber
} - getOnionPath Error ${e.code} ${e.message}`
); );
} }
if (!pathNodes || !pathNodes.length) { if (!pathNodes || !pathNodes.length) {
log.warn( log.warn(
`loki_app_dot_net:::sendViaOnion #${ `loki_app_dot_net:::sendViaOnion #${options.requestNumber} - failing, no path available`
options.requestNumber
} - failing, no path available`
); );
// should we retry? // should we retry?
return {}; return {};
@ -135,9 +131,7 @@ const sendViaOnion = async (srvPubKey, url, fetchOptions, options = {}) => {
// handle error/retries // handle error/retries
if (!result.status) { if (!result.status) {
log.error( log.error(
`loki_app_dot_net:::sendViaOnion #${options.requestNumber} - Retry #${ `loki_app_dot_net:::sendViaOnion #${options.requestNumber} - Retry #${options.retry} Couldnt handle onion request, retrying`,
options.retry
} Couldnt handle onion request, retrying`,
payloadObj payloadObj
); );
return sendViaOnion(srvPubKey, url, fetchOptions, { return sendViaOnion(srvPubKey, url, fetchOptions, {
@ -155,9 +149,7 @@ const sendViaOnion = async (srvPubKey, url, fetchOptions, options = {}) => {
body = JSON.parse(result.body); body = JSON.parse(result.body);
} catch (e) { } catch (e) {
log.error( log.error(
`loki_app_dot_net:::sendViaOnion #${ `loki_app_dot_net:::sendViaOnion #${options.requestNumber} - Cant decode JSON body`,
options.requestNumber
} - Cant decode JSON body`,
result.body result.body
); );
} }

@ -284,9 +284,7 @@ const processOnionResponse = async (
if (response.status !== 200) { if (response.status !== 200) {
log.warn( log.warn(
`(${reqIdx}) [path] lokiRpc::processOnionResponse - fetch unhandled error code: ${ `(${reqIdx}) [path] lokiRpc::processOnionResponse - fetch unhandled error code: ${response.status}`
response.status
}`
); );
return false; return false;
} }

@ -115,9 +115,7 @@ async function tryGetSnodeListFromLokidSeednode(
} }
if (snodes.length) { if (snodes.length) {
log.info( log.info(
`loki_snodes:::tryGetSnodeListFromLokidSeednode - got ${ `loki_snodes:::tryGetSnodeListFromLokidSeednode - got ${snodes.length} service nodes from seed`
snodes.length
} service nodes from seed`
); );
} }
return snodes; return snodes;
@ -277,18 +275,14 @@ class LokiSnodeAPI {
if (shuffled.length < DESIRED_GUARD_COUNT) { if (shuffled.length < DESIRED_GUARD_COUNT) {
log.error( log.error(
`Could not select guard nodes: node pool is not big enough, pool size ${ `Could not select guard nodes: node pool is not big enough, pool size ${shuffled.length}, need ${DESIRED_GUARD_COUNT}, attempting to refresh randomPool`
shuffled.length
}, need ${DESIRED_GUARD_COUNT}, attempting to refresh randomPool`
); );
await this.refreshRandomPool(); await this.refreshRandomPool();
nodePool = await this.getRandomSnodePool(); nodePool = await this.getRandomSnodePool();
shuffled = _.shuffle(nodePool); shuffled = _.shuffle(nodePool);
if (shuffled.length < DESIRED_GUARD_COUNT) { if (shuffled.length < DESIRED_GUARD_COUNT) {
log.error( log.error(
`Could not select guard nodes: node pool is not big enough, pool size ${ `Could not select guard nodes: node pool is not big enough, pool size ${shuffled.length}, need ${DESIRED_GUARD_COUNT}, failing...`
shuffled.length
}, need ${DESIRED_GUARD_COUNT}, failing...`
); );
return []; return [];
} }

@ -167,8 +167,7 @@ function OutgoingMessage(
publicSendData, publicSendData,
debugMessageType, debugMessageType,
autoSession, autoSession,
} = } = options || {};
options || {};
this.numberInfo = numberInfo; this.numberInfo = numberInfo;
this.isPublic = isPublic; this.isPublic = isPublic;
this.isMediumGroup = !!isMediumGroup; this.isMediumGroup = !!isMediumGroup;

@ -73,7 +73,7 @@ window.isBeforeVersion = (toCheck, baseVersion) => {
}; };
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
window.CONSTANTS = new function() { window.CONSTANTS = new (function() {
this.MAX_LOGIN_TRIES = 3; this.MAX_LOGIN_TRIES = 3;
this.MAX_PASSWORD_LENGTH = 64; this.MAX_PASSWORD_LENGTH = 64;
this.MAX_USERNAME_LENGTH = 20; this.MAX_USERNAME_LENGTH = 20;
@ -96,7 +96,7 @@ window.CONSTANTS = new function() {
// https://loki.network/2020/03/25/loki-name-system-the-facts/ // https://loki.network/2020/03/25/loki-name-system-the-facts/
this.LNS_REGEX = `^[a-zA-Z0-9_]([a-zA-Z0-9_-]{0,${this.LNS_MAX_LENGTH - this.LNS_REGEX = `^[a-zA-Z0-9_]([a-zA-Z0-9_-]{0,${this.LNS_MAX_LENGTH -
2}}[a-zA-Z0-9_]){0,1}$`; 2}}[a-zA-Z0-9_]){0,1}$`;
}(); })();
window.versionInfo = { window.versionInfo = {
environment: window.getEnvironment(), environment: window.getEnvironment(),

@ -249,8 +249,7 @@ export class SessionClosableOverlay extends React.Component<Props, State> {
/> />
)} )}
{isClosedGroupView && {isClosedGroupView && window.lokiFeatureFlags.enableSenderKeys && (
window.lokiFeatureFlags.enableSenderKeys && (
<div className="sealed-sender-toggle"> <div className="sealed-sender-toggle">
<SessionToggle <SessionToggle
active={Boolean(false)} active={Boolean(false)}

Loading…
Cancel
Save