Merge branch 'clearnet' into msg-request-ui-2
This commit is contained in:
commit
821f4d73ff
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"privacyPolicy": "Terms & Privacy Policy",
|
||||
"copyErrorAndQuit": "Copy error and quit",
|
||||
"unknown": "Unknown",
|
||||
"databaseError": "Database Error",
|
||||
|
@ -17,7 +16,6 @@
|
|||
"editMenuCut": "Cut",
|
||||
"editMenuCopy": "Copy",
|
||||
"editMenuPaste": "Paste",
|
||||
"editMenuPasteAndMatchStyle": "Paste and Match Style",
|
||||
"editMenuDelete": "Delete",
|
||||
"editMenuDeleteContact": "Delete Contact",
|
||||
"editMenuDeleteGroup": "Delete Group",
|
||||
|
@ -25,7 +23,6 @@
|
|||
"windowMenuClose": "Close Window",
|
||||
"windowMenuMinimize": "Minimize",
|
||||
"windowMenuZoom": "Zoom",
|
||||
"windowMenuBringAllToFront": "Bring All to Front",
|
||||
"viewMenuResetZoom": "Actual Size",
|
||||
"viewMenuZoomIn": "Zoom In",
|
||||
"viewMenuZoomOut": "Zoom Out",
|
||||
|
@ -455,7 +452,7 @@
|
|||
"noAudioOutputFound": "No audio output found",
|
||||
"callMediaPermissionsTitle": "Voice and video calls",
|
||||
"callMissedCausePermission": "Call missed from '$name$' because you need to enable the 'Voice and video calls' permission in the Privacy Settings.",
|
||||
"callMissedNotApproved": "Call missed from '$name$' as you haven't approved this conversation yet. Send a message to him first.",
|
||||
"callMissedNotApproved": "Call missed from '$name$' as you haven't approved this conversation yet. Send a message to them first.",
|
||||
"callMediaPermissionsDescription": "Allows access to accept voice and video calls from other users",
|
||||
"callMediaPermissionsDialogContent": "The current implementation of voice/video calls will expose your IP address to the Oxen Foundation servers and the calling/called user.",
|
||||
"menuCall": "Call",
|
||||
|
|
|
@ -7,7 +7,6 @@ let environment;
|
|||
// In production mode, NODE_ENV cannot be customized by the user
|
||||
if (isDevelopment) {
|
||||
environment = process.env.NODE_ENV || 'development';
|
||||
process.env.LOKI_DEV = 1;
|
||||
} else {
|
||||
environment = 'production';
|
||||
}
|
||||
|
|
11
app/menu.js
11
app/menu.js
|
@ -54,10 +54,6 @@ exports.createTemplate = (options, messages) => {
|
|||
role: 'paste',
|
||||
label: messages.editMenuPaste,
|
||||
},
|
||||
{
|
||||
role: 'pasteandmatchstyle',
|
||||
label: messages.editMenuPasteAndMatchStyle,
|
||||
},
|
||||
{
|
||||
role: 'delete',
|
||||
label: messages.editMenuDelete,
|
||||
|
@ -242,13 +238,6 @@ function updateForMac(template, messages, options) {
|
|||
label: messages.show,
|
||||
click: showWindow,
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
{
|
||||
role: 'front',
|
||||
label: messages.windowMenuBringAllToFront,
|
||||
},
|
||||
];
|
||||
|
||||
return template;
|
||||
|
|
|
@ -65,13 +65,6 @@ exports.setup = (browserWindow, messages) => {
|
|||
template.push({ label: messages.editMenuPaste, role: 'paste' });
|
||||
}
|
||||
|
||||
if (editFlags.canPaste) {
|
||||
template.push({
|
||||
label: messages.editMenuPasteAndMatchStyle,
|
||||
role: 'pasteAndMatchStyle',
|
||||
});
|
||||
}
|
||||
|
||||
// Only enable select all in editors because select all in non-editors
|
||||
// results in all the UI being selected
|
||||
if (editFlags.canSelectAll && params.isEditable) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none';
|
||||
<head>
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none';
|
||||
child-src 'self';
|
||||
connect-src 'self' https: wss:;
|
||||
font-src 'self';
|
||||
|
@ -12,42 +13,40 @@
|
|||
object-src 'none';
|
||||
script-src 'self';
|
||||
style-src 'self' 'unsafe-inline';"
|
||||
>
|
||||
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body class='debug-log-window'>
|
||||
</body>
|
||||
<script type='text/x-tmpl-mustache' id='debug-log'>
|
||||
<div class='content'>
|
||||
<div>
|
||||
<a class='x close' alt='close debug log' href='#'></a>
|
||||
<h1> {{ title }} </h1>
|
||||
<p> {{ debugLogExplanation }}</p>
|
||||
/>
|
||||
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
|
||||
<style></style>
|
||||
</head>
|
||||
<body class="debug-log-window"></body>
|
||||
<script type="text/x-tmpl-mustache" id="debug-log">
|
||||
<div class='content'>
|
||||
<div>
|
||||
<a class='x close' alt='close debug log' href='#'></a>
|
||||
<h1> {{ title }} </h1>
|
||||
<p> {{ debugLogExplanation }}</p>
|
||||
</div>
|
||||
<textarea spellcheck='false' rows='5'></textarea>
|
||||
<div class='buttons'>
|
||||
<button class='grey submit'>{{ submit }}</button>
|
||||
</div>
|
||||
<div class='result'>
|
||||
</div>
|
||||
</div>
|
||||
<textarea spellcheck='false' rows='5'></textarea>
|
||||
<div class='buttons'>
|
||||
<button class='grey submit'>{{ submit }}</button>
|
||||
</script>
|
||||
<script type="text/x-tmpl-mustache" id="debug-log-link">
|
||||
<div class='input-group clearfix'>
|
||||
<input type='text' class='link' readonly value='{{ url }}' />
|
||||
<a class='open' alt='open in a new browser tab' target='_blank' href='{{ url }}'></a>
|
||||
</div>
|
||||
<div class='result'>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type='text/x-tmpl-mustache' id='debug-log-link'>
|
||||
<div class='input-group clearfix'>
|
||||
<input type='text' class='link' readonly value='{{ url }}' />
|
||||
<a class='open' alt='open in a new browser tab' target='_blank' href='{{ url }}'></a>
|
||||
</div>
|
||||
<p>
|
||||
<a class='report-link' target='_blank'
|
||||
href='https://github.com/loki-project/session-desktop/issues/new/'>
|
||||
{{ reportIssue }}
|
||||
</a>
|
||||
</p>
|
||||
</script>
|
||||
<script type='text/javascript' src='js/components.js'></script>
|
||||
<script type='text/javascript' src='js/views/whisper_view.js'></script>
|
||||
<script type='text/javascript' src='js/views/debug_log_view.js'></script>
|
||||
<script type='text/javascript' src='js/debug_log_start.js'></script>
|
||||
<p>
|
||||
<a class='report-link' target='_blank'
|
||||
href='https://github.com/oxen-io/session-desktop/issues/new/'>
|
||||
{{ reportIssue }}
|
||||
</a>
|
||||
</p>
|
||||
</script>
|
||||
<script type="text/javascript" src="js/components.js"></script>
|
||||
<script type="text/javascript" src="js/views/whisper_view.js"></script>
|
||||
<script type="text/javascript" src="js/views/debug_log_view.js"></script>
|
||||
<script type="text/javascript" src="js/debug_log_start.js"></script>
|
||||
</html>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
set -e
|
||||
find release/linux -type d | xargs chmod 755
|
||||
find release/linux -type f | xargs chmod 644
|
||||
chmod +x release/linux/loki-messenger*
|
||||
chmod +x release/linux/session-desktop*
|
||||
|
|
|
@ -19,9 +19,6 @@ const { SessionInboxView } = require('../../ts/components/SessionInboxView');
|
|||
// Types
|
||||
const SettingsType = require('../../ts/types/Settings');
|
||||
|
||||
// Views
|
||||
const Initialization = require('./views/initialization');
|
||||
|
||||
exports.setup = () => {
|
||||
Data.init();
|
||||
|
||||
|
@ -35,10 +32,6 @@ exports.setup = () => {
|
|||
Settings: SettingsType,
|
||||
};
|
||||
|
||||
const Views = {
|
||||
Initialization,
|
||||
};
|
||||
|
||||
return {
|
||||
Components,
|
||||
Crypto,
|
||||
|
@ -49,6 +42,5 @@ exports.setup = () => {
|
|||
Settings,
|
||||
Types,
|
||||
Util,
|
||||
Views,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
/* eslint-env browser */
|
||||
|
||||
/* global i18n: false */
|
||||
|
||||
const DISPLAY_THRESHOLD = 3000; // milliseconds
|
||||
const SELECTOR = '.app-loading-screen .message';
|
||||
|
||||
let timeout;
|
||||
let targetString;
|
||||
let didTimeout = false;
|
||||
|
||||
const clear = () => {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
timeout = null;
|
||||
}
|
||||
};
|
||||
|
||||
const setMessage = loadingText => {
|
||||
const message = document.querySelector(SELECTOR);
|
||||
if (!message) {
|
||||
return clear;
|
||||
}
|
||||
|
||||
targetString = loadingText || i18n('optimizingApplication');
|
||||
|
||||
message.innerText = didTimeout ? targetString : i18n('loading');
|
||||
|
||||
if (timeout) {
|
||||
return clear;
|
||||
}
|
||||
|
||||
timeout = setTimeout(() => {
|
||||
didTimeout = true;
|
||||
const innerMessage = document.querySelector(SELECTOR);
|
||||
if (!innerMessage) {
|
||||
return;
|
||||
}
|
||||
innerMessage.innerText = targetString;
|
||||
}, DISPLAY_THRESHOLD);
|
||||
|
||||
return clear;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
setMessage,
|
||||
};
|
12
main.js
12
main.js
|
@ -28,7 +28,7 @@ const {
|
|||
systemPreferences,
|
||||
} = electron;
|
||||
|
||||
// FIXME Hardcoding appId to prevent build failrues on release.
|
||||
// FIXME Hardcoding appId to prevent build failures on release.
|
||||
// const appUserModelId = packageJson.build.appId;
|
||||
const appUserModelId = 'com.loki-project.messenger-desktop';
|
||||
console.log('Set Windows Application User Model ID (AUMID)', {
|
||||
|
@ -986,7 +986,7 @@ ipc.on('set-call-media-permissions', (event, value) => {
|
|||
event.sender.send('set-success-call-media-permissions', null);
|
||||
});
|
||||
|
||||
// Loki - Auto updating
|
||||
// Session - Auto updating
|
||||
ipc.on('get-auto-update-setting', event => {
|
||||
const configValue = userConfig.get('autoUpdate');
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
|
@ -1011,19 +1011,19 @@ function getThemeFromMainWindow() {
|
|||
});
|
||||
}
|
||||
|
||||
function askForMediaAccess() {
|
||||
async function askForMediaAccess() {
|
||||
// Microphone part
|
||||
let status = systemPreferences.getMediaAccessStatus('microphone');
|
||||
if (status !== 'granted') {
|
||||
systemPreferences.askForMediaAccess('microphone');
|
||||
await systemPreferences.askForMediaAccess('microphone');
|
||||
}
|
||||
// Camera part
|
||||
status = systemPreferences.getMediaAccessStatus('camera');
|
||||
if (status !== 'granted') {
|
||||
systemPreferences.askForMediaAccess('camera');
|
||||
await systemPreferences.askForMediaAccess('camera');
|
||||
}
|
||||
}
|
||||
|
||||
ipc.on('media-access', () => {
|
||||
ipc.on('media-access', async () => {
|
||||
askForMediaAccess();
|
||||
});
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
"version": "1.8.1",
|
||||
"license": "GPL-3.0",
|
||||
"author": {
|
||||
"name": "Loki Project",
|
||||
"email": "team@loki.network"
|
||||
"name": "Oxen Labs",
|
||||
"email": "team@oxen.io"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/loki-project/session-desktop.git"
|
||||
"url": "https://github.com/oxen-io/session-desktop.git"
|
||||
},
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
@ -232,7 +232,7 @@
|
|||
},
|
||||
"win": {
|
||||
"asarUnpack": "node_modules/spellchecker/vendor/hunspell_dictionaries",
|
||||
"publisherName": "Loki Project",
|
||||
"publisherName": "Oxen Labs",
|
||||
"verifyUpdateCodeSignature": false,
|
||||
"icon": "build/icon.ico",
|
||||
"target": [
|
||||
|
|
|
@ -28,7 +28,7 @@ window.isDev = () => config.environment === 'development';
|
|||
window.getCommitHash = () => config.commitHash;
|
||||
window.getNodeVersion = () => config.node_version;
|
||||
|
||||
window.lokiFeatureFlags = {
|
||||
window.sessionFeatureFlags = {
|
||||
useOnionRequests: true,
|
||||
useCallMessage: true,
|
||||
};
|
||||
|
|
|
@ -215,7 +215,7 @@ const CallButton = () => {
|
|||
isMe ||
|
||||
!selectedConvoKey ||
|
||||
isBlocked ||
|
||||
!window.lokiFeatureFlags.useCallMessage
|
||||
!window.sessionFeatureFlags.useCallMessage
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ export const SettingsCategoryPrivacy = (props: {
|
|||
description={window.i18n('mediaPermissionsDescription')}
|
||||
active={Boolean(window.getSettingValue('media-permissions'))}
|
||||
/>
|
||||
{window.lokiFeatureFlags.useCallMessage && (
|
||||
{window.sessionFeatureFlags.useCallMessage && (
|
||||
<SessionToggleWithDescription
|
||||
onClickToggle={async () => {
|
||||
await toggleCallMediaPermissions(forceUpdate);
|
||||
|
|
|
@ -425,7 +425,7 @@ export async function innerHandleSwarmContentMessage(
|
|||
if (content.unsendMessage) {
|
||||
await handleUnsendMessage(envelope, content.unsendMessage as SignalService.Unsend);
|
||||
}
|
||||
if (content.callMessage && window.lokiFeatureFlags?.useCallMessage) {
|
||||
if (content.callMessage && window.sessionFeatureFlags?.useCallMessage) {
|
||||
await handleCallMessage(envelope, content.callMessage as SignalService.CallMessage);
|
||||
}
|
||||
if (content.messageRequestResponse) {
|
||||
|
|
|
@ -48,7 +48,7 @@ export async function fetchSnodePoolFromSeedNodeWithRetries(
|
|||
return fetchSnodePool;
|
||||
} catch (e) {
|
||||
window?.log?.warn(
|
||||
'LokiSnodeAPI::fetchSnodePoolFromSeedNodeWithRetries - error',
|
||||
'SessionSnodeAPI::fetchSnodePoolFromSeedNodeWithRetries - error',
|
||||
e.code,
|
||||
e.message
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { snodeRpc } from './lokiRpc';
|
||||
import { snodeRpc } from './sessionRpc';
|
||||
|
||||
import {
|
||||
getRandomSnode,
|
||||
|
@ -86,7 +86,7 @@ async function requestSnodesForPubkeyWithTargetNodeRetryable(
|
|||
});
|
||||
if (!result) {
|
||||
window?.log?.warn(
|
||||
`LokiSnodeAPI::requestSnodesForPubkeyWithTargetNodeRetryable - lokiRpc on ${targetNode.ip}:${targetNode.port} returned falsish value`,
|
||||
`SessionSnodeAPI::requestSnodesForPubkeyWithTargetNodeRetryable - sessionRpc on ${targetNode.ip}:${targetNode.port} returned falsish value`,
|
||||
result
|
||||
);
|
||||
throw new Error('requestSnodesForPubkeyWithTargetNodeRetryable: Invalid result');
|
||||
|
@ -103,7 +103,7 @@ async function requestSnodesForPubkeyWithTargetNodeRetryable(
|
|||
if (!json.snodes) {
|
||||
// we hit this when snode gives 500s
|
||||
window?.log?.warn(
|
||||
`LokiSnodeAPI::requestSnodesForPubkeyRetryable - lokiRpc on ${targetNode.ip}:${targetNode.port} returned falsish value for snodes`,
|
||||
`SessionSnodeAPI::requestSnodesForPubkeyRetryable - sessionRpc on ${targetNode.ip}:${targetNode.port} returned falsish value for snodes`,
|
||||
result
|
||||
);
|
||||
throw new Error('Invalid json (empty)');
|
||||
|
@ -176,7 +176,7 @@ export async function requestSnodesForPubkey(pubKey: string): Promise<Array<Snod
|
|||
// if all retry fails, we will end up in the catch below when the last exception thrown
|
||||
return await requestSnodesForPubkeyRetryable(pubKey);
|
||||
} catch (e) {
|
||||
window?.log?.error('LokiSnodeAPI::requestSnodesForPubkey - error', e);
|
||||
window?.log?.error('SessionSnodeAPI::requestSnodesForPubkey - error', e);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
@ -393,10 +393,7 @@ export async function TEST_getSnodePoolFromSnode(targetNode: Snode): Promise<Arr
|
|||
const json = JSON.parse(result.body);
|
||||
|
||||
if (!json || !json.result || !json.result.service_node_states?.length) {
|
||||
window?.log?.error(
|
||||
'loki_snode_api:::getSnodePoolFromSnode - invalid result from snode',
|
||||
result.body
|
||||
);
|
||||
window?.log?.error('getSnodePoolFromSnode - invalid result from snode', result.body);
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -452,11 +449,7 @@ export async function storeOnNode(
|
|||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
window?.log?.warn(
|
||||
'loki_message:::store - send error:',
|
||||
e,
|
||||
`destination ${targetNode.ip}:${targetNode.port}`
|
||||
);
|
||||
window?.log?.warn('store - send error:', e, `destination ${targetNode.ip}:${targetNode.port}`);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -484,17 +477,17 @@ export async function retrieveNextMessages(
|
|||
|
||||
if (!result) {
|
||||
window?.log?.warn(
|
||||
`loki_message:::_retrieveNextMessages - lokiRpc could not talk to ${targetNode.ip}:${targetNode.port}`
|
||||
`_retrieveNextMessages - sessionRpc could not talk to ${targetNode.ip}:${targetNode.port}`
|
||||
);
|
||||
throw new Error(
|
||||
`loki_message:::_retrieveNextMessages - lokiRpc could not talk to ${targetNode.ip}:${targetNode.port}`
|
||||
`_retrieveNextMessages - sessionRpc could not talk to ${targetNode.ip}:${targetNode.port}`
|
||||
);
|
||||
}
|
||||
|
||||
if (result.status !== 200) {
|
||||
window?.log?.warn('retrieve result is not 200');
|
||||
throw new Error(
|
||||
`loki_message:::_retrieveNextMessages - retrieve result is not 200 with ${targetNode.ip}:${targetNode.port}`
|
||||
`_retrieveNextMessages - retrieve result is not 200 with ${targetNode.ip}:${targetNode.port}`
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -513,7 +506,7 @@ export async function retrieveNextMessages(
|
|||
window.inboxStore?.dispatch(updateIsOnline(true));
|
||||
}
|
||||
throw new Error(
|
||||
`loki_message:::_retrieveNextMessages - exception while parsing json of nextMessage ${targetNode.ip}:${targetNode.port}: ${e?.message}`
|
||||
`_retrieveNextMessages - exception while parsing json of nextMessage ${targetNode.ip}:${targetNode.port}: ${e?.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -439,7 +439,7 @@ export async function processOnionResponse({
|
|||
|
||||
if (!ciphertext) {
|
||||
window?.log?.warn(
|
||||
'[path] lokiRpc::processingOnionResponse - Target node return empty ciphertext'
|
||||
'[path] sessionRpc::processingOnionResponse - Target node return empty ciphertext'
|
||||
);
|
||||
throw new Error('Target node return empty ciphertext');
|
||||
}
|
||||
|
@ -453,16 +453,16 @@ export async function processOnionResponse({
|
|||
plaintext = decoded.plaintext;
|
||||
ciphertextBuffer = decoded.ciphertextBuffer;
|
||||
} catch (e) {
|
||||
window?.log?.error('[path] lokiRpc::processingOnionResponse - decode error', e);
|
||||
window?.log?.error('[path] sessionRpc::processingOnionResponse - decode error', e);
|
||||
if (symmetricKey) {
|
||||
window?.log?.error(
|
||||
'[path] lokiRpc::processingOnionResponse - symmetricKey',
|
||||
'[path] sessionRpc::processingOnionResponse - symmetricKey',
|
||||
toHex(symmetricKey)
|
||||
);
|
||||
}
|
||||
if (ciphertextBuffer) {
|
||||
window?.log?.error(
|
||||
'[path] lokiRpc::processingOnionResponse - ciphertextBuffer',
|
||||
'[path] sessionRpc::processingOnionResponse - ciphertextBuffer',
|
||||
toHex(ciphertextBuffer)
|
||||
);
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ export async function processOnionResponse({
|
|||
}
|
||||
|
||||
if (debug) {
|
||||
window?.log?.debug('lokiRpc::processingOnionResponse - plaintext', plaintext);
|
||||
window?.log?.debug('sessionRpc::processingOnionResponse - plaintext', plaintext);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -491,7 +491,9 @@ export async function processOnionResponse({
|
|||
|
||||
return jsonRes as SnodeResponse;
|
||||
} catch (e) {
|
||||
window?.log?.error(`[path] lokiRpc::processingOnionResponse - Rethrowing error ${e.message}'`);
|
||||
window?.log?.error(
|
||||
`[path] sessionRpc::processingOnionResponse - Rethrowing error ${e.message}'`
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ async function lokiFetch({
|
|||
// Absence of targetNode indicates that we want a direct connection
|
||||
// (e.g. to connect to a seed node for the first time)
|
||||
const useOnionRequests =
|
||||
window.lokiFeatureFlags?.useOnionRequests === undefined
|
||||
window.sessionFeatureFlags?.useOnionRequests === undefined
|
||||
? true
|
||||
: window.lokiFeatureFlags?.useOnionRequests;
|
||||
: window.sessionFeatureFlags?.useOnionRequests;
|
||||
if (useOnionRequests && targetNode) {
|
||||
const fetchResult = await lokiOnionFetch({
|
||||
targetNode,
|
|
@ -183,7 +183,7 @@ export async function TEST_fetchFromSeedWithRetriesAndWriteToDb() {
|
|||
|
||||
if (!seedNodes || !seedNodes.length) {
|
||||
window?.log?.error(
|
||||
'LokiSnodeAPI:::fetchFromSeedWithRetriesAndWriteToDb - getSeedNodeList has not been loaded yet'
|
||||
'SessionSnodeAPI:::fetchFromSeedWithRetriesAndWriteToDb - getSeedNodeList has not been loaded yet'
|
||||
);
|
||||
|
||||
return;
|
||||
|
@ -196,7 +196,7 @@ export async function TEST_fetchFromSeedWithRetriesAndWriteToDb() {
|
|||
Onions.resetSnodeFailureCount();
|
||||
} catch (e) {
|
||||
window?.log?.error(
|
||||
'LokiSnodeAPI:::fetchFromSeedWithRetriesAndWriteToDb - Failed to fetch snode poll from seed node with retries. Error:',
|
||||
'SessionSnodeAPI:::fetchFromSeedWithRetriesAndWriteToDb - Failed to fetch snode poll from seed node with retries. Error:',
|
||||
e
|
||||
);
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ export async function getGuardNodeOrSelectNewOnes() {
|
|||
|
||||
if (guardNodesFromDb.length === 0) {
|
||||
window?.log?.warn(
|
||||
'LokiSnodeAPI::getGuardNodeOrSelectNewOnes - no guard nodes in DB. Will be selecting new guards nodes...'
|
||||
'SessionSnodeAPI::getGuardNodeOrSelectNewOnes - no guard nodes in DB. Will be selecting new guards nodes...'
|
||||
);
|
||||
} else {
|
||||
const allNodes = await SnodePool.getSnodePoolFromDBOrFetchFromSeed();
|
||||
|
@ -429,7 +429,7 @@ export async function getGuardNodeOrSelectNewOnes() {
|
|||
guardNodes = allNodes.filter(x => edKeys.indexOf(x.pubkey_ed25519) !== -1);
|
||||
if (guardNodes.length < edKeys.length) {
|
||||
window?.log?.warn(
|
||||
`LokiSnodeAPI::getGuardNodeOrSelectNewOnes - could not find some guard nodes: ${guardNodes.length}/${edKeys.length} left`
|
||||
`SessionSnodeAPI::getGuardNodeOrSelectNewOnes - could not find some guard nodes: ${guardNodes.length}/${edKeys.length} left`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ export async function getGuardNodeOrSelectNewOnes() {
|
|||
async function buildNewOnionPathsWorker() {
|
||||
return pRetry(
|
||||
async () => {
|
||||
window?.log?.info('LokiSnodeAPI::buildNewOnionPaths - building new onion paths...');
|
||||
window?.log?.info('SessionSnodeAPI::buildNewOnionPaths - building new onion paths...');
|
||||
|
||||
// get an up to date list of snodes from cache, from db, or from the a seed node.
|
||||
let allNodes = await SnodePool.getSnodePoolFromDBOrFetchFromSeed();
|
||||
|
@ -459,7 +459,9 @@ async function buildNewOnionPathsWorker() {
|
|||
|
||||
// be sure to fetch again as that list might have been refreshed by selectGuardNodes
|
||||
allNodes = await SnodePool.getSnodePoolFromDBOrFetchFromSeed();
|
||||
window?.log?.info(`LokiSnodeAPI::buildNewOnionPaths, snodePool length: ${allNodes.length}`);
|
||||
window?.log?.info(
|
||||
`SessionSnodeAPI::buildNewOnionPaths, snodePool length: ${allNodes.length}`
|
||||
);
|
||||
// get all snodes minus the selected guardNodes
|
||||
if (allNodes.length <= SnodePool.minSnodePoolCount) {
|
||||
throw new Error('Too few nodes to build an onion path. Even after fetching from seed.');
|
||||
|
|
|
@ -28,11 +28,11 @@ describe('MessageSender', () => {
|
|||
// tslint:disable-next-line: max-func-body-length
|
||||
describe('send', () => {
|
||||
const ourNumber = '0123456789abcdef';
|
||||
let lokiMessageAPISendStub: sinon.SinonStub<any>;
|
||||
let sessionMessageAPISendStub: sinon.SinonStub<any>;
|
||||
let encryptStub: sinon.SinonStub<[PubKey, Uint8Array, EncryptionType]>;
|
||||
|
||||
beforeEach(() => {
|
||||
lokiMessageAPISendStub = sandbox.stub(MessageSender, 'TEST_sendMessageToSnode').resolves();
|
||||
sessionMessageAPISendStub = sandbox.stub(MessageSender, 'TEST_sendMessageToSnode').resolves();
|
||||
|
||||
sandbox.stub(Data, 'getMessageById').resolves();
|
||||
|
||||
|
@ -58,29 +58,29 @@ describe('MessageSender', () => {
|
|||
encryptStub.throws(new Error('Failed to encrypt.'));
|
||||
const promise = MessageSender.send(rawMessage, 3, 10);
|
||||
await expect(promise).is.rejectedWith('Failed to encrypt.');
|
||||
expect(lokiMessageAPISendStub.callCount).to.equal(0);
|
||||
expect(sessionMessageAPISendStub.callCount).to.equal(0);
|
||||
});
|
||||
|
||||
it('should only call lokiMessageAPI once if no errors occured', async () => {
|
||||
await MessageSender.send(rawMessage, 3, 10);
|
||||
expect(lokiMessageAPISendStub.callCount).to.equal(1);
|
||||
expect(sessionMessageAPISendStub.callCount).to.equal(1);
|
||||
});
|
||||
|
||||
it('should only retry the specified amount of times before throwing', async () => {
|
||||
// const clock = sinon.useFakeTimers();
|
||||
|
||||
lokiMessageAPISendStub.throws(new Error('API error'));
|
||||
sessionMessageAPISendStub.throws(new Error('API error'));
|
||||
const attempts = 2;
|
||||
const promise = MessageSender.send(rawMessage, attempts, 10);
|
||||
await expect(promise).is.rejectedWith('API error');
|
||||
// clock.restore();
|
||||
expect(lokiMessageAPISendStub.callCount).to.equal(attempts);
|
||||
expect(sessionMessageAPISendStub.callCount).to.equal(attempts);
|
||||
});
|
||||
|
||||
it('should not throw error if successful send occurs within the retry limit', async () => {
|
||||
lokiMessageAPISendStub.onFirstCall().throws(new Error('API error'));
|
||||
sessionMessageAPISendStub.onFirstCall().throws(new Error('API error'));
|
||||
await MessageSender.send(rawMessage, 3, 10);
|
||||
expect(lokiMessageAPISendStub.callCount).to.equal(2);
|
||||
expect(sessionMessageAPISendStub.callCount).to.equal(2);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -102,7 +102,7 @@ describe('MessageSender', () => {
|
|||
|
||||
await MessageSender.send(rawMessage, 3, 10);
|
||||
|
||||
const args = lokiMessageAPISendStub.getCall(0).args;
|
||||
const args = sessionMessageAPISendStub.getCall(0).args;
|
||||
expect(args[0]).to.equal(device.key);
|
||||
// expect(args[3]).to.equal(visibleMessage.timestamp); the timestamp is overwritten on sending by the network clock offset
|
||||
expect(args[2]).to.equal(visibleMessage.ttl());
|
||||
|
@ -120,7 +120,7 @@ describe('MessageSender', () => {
|
|||
sandbox.stub(SNodeAPI, 'getLatestTimestampOffset').returns(offset);
|
||||
await MessageSender.send(rawMessage, 3, 10);
|
||||
|
||||
const data = lokiMessageAPISendStub.getCall(0).args[1];
|
||||
const data = sessionMessageAPISendStub.getCall(0).args[1];
|
||||
const webSocketMessage = SignalService.WebSocketMessage.decode(data);
|
||||
expect(webSocketMessage.request?.body).to.not.equal(
|
||||
undefined,
|
||||
|
@ -163,7 +163,7 @@ describe('MessageSender', () => {
|
|||
const rawMessage = await MessageUtils.toRawMessage(device, visibleMessage);
|
||||
await MessageSender.send(rawMessage, 3, 10);
|
||||
|
||||
const data = lokiMessageAPISendStub.getCall(0).args[1];
|
||||
const data = sessionMessageAPISendStub.getCall(0).args[1];
|
||||
const webSocketMessage = SignalService.WebSocketMessage.decode(data);
|
||||
expect(webSocketMessage.request?.body).to.not.equal(
|
||||
undefined,
|
||||
|
|
|
@ -18,7 +18,6 @@ export type LocalizerKeys =
|
|||
| 'noContactsForGroup'
|
||||
| 'originalMessageNotAvailable'
|
||||
| 'linkVisitWarningMessage'
|
||||
| 'editMenuPasteAndMatchStyle'
|
||||
| 'anonymous'
|
||||
| 'viewMenuZoomOut'
|
||||
| 'dialogClearAllDataDeletionFailedDesc'
|
||||
|
@ -236,7 +235,6 @@ export type LocalizerKeys =
|
|||
| 'audioPermissionNeeded'
|
||||
| 'timestamp_h'
|
||||
| 'add'
|
||||
| 'windowMenuBringAllToFront'
|
||||
| 'messageRequests'
|
||||
| 'show'
|
||||
| 'cannotMixImageAndNonImageAttachments'
|
||||
|
|
|
@ -20,7 +20,7 @@ declare global {
|
|||
CONSTANTS: any;
|
||||
Events: any;
|
||||
Lodash: any;
|
||||
LokiSnodeAPI: any;
|
||||
SessionSnodeAPI: any;
|
||||
Session: any;
|
||||
Signal: SignalInterface;
|
||||
StubAppDotNetApi: any;
|
||||
|
@ -36,11 +36,11 @@ declare global {
|
|||
i18n: LocalizerType;
|
||||
libsignal: LibsignalProtocol;
|
||||
log: any;
|
||||
lokiFeatureFlags: {
|
||||
sessionFeatureFlags: {
|
||||
useOnionRequests: boolean;
|
||||
useCallMessage: boolean;
|
||||
};
|
||||
lokiSnodeAPI: LokiSnodeAPI;
|
||||
SessionSnodeAPI: SessionSnodeAPI;
|
||||
onLogin: any;
|
||||
persistStore?: Persistor;
|
||||
restart: any;
|
||||
|
|
Loading…
Reference in New Issue