diff --git a/package.json b/package.json index b8015b2e6..bc2955de3 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "glob": "7.1.2", "image-type": "^4.1.0", "ip2country": "1.0.1", - "libsession_util_nodejs": "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.10/libsession_util_nodejs-v0.1.10.tar.gz", + "libsession_util_nodejs": "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.14/libsession_util_nodejs-v0.1.14.tar.gz", "libsodium-wrappers-sumo": "^0.7.9", "linkify-it": "3.0.2", "lodash": "^4.17.20", diff --git a/ts/components/dialog/InviteContactsDialog.tsx b/ts/components/dialog/InviteContactsDialog.tsx index 795e60fd7..6ec80e31d 100644 --- a/ts/components/dialog/InviteContactsDialog.tsx +++ b/ts/components/dialog/InviteContactsDialog.tsx @@ -34,7 +34,7 @@ function submitForOpenGroup(convoId: string, pubkeys: Array) { throw new Error(`getCommunityByFullUrl returned no result for ${convo.id}`); } const groupInvitation = { - url: roomDetails?.fullUrl, + url: roomDetails?.fullUrlWithPubkey, name: convo.getNicknameOrRealUsernameOrPlaceholder(), }; pubkeys.forEach(async pubkeyStr => { diff --git a/ts/interactions/conversationInteractions.ts b/ts/interactions/conversationInteractions.ts index f6f3a2586..77ca33c4d 100644 --- a/ts/interactions/conversationInteractions.ts +++ b/ts/interactions/conversationInteractions.ts @@ -39,28 +39,28 @@ import { BlockedNumberController } from '../util/blockedNumberController'; import { encryptProfile } from '../util/crypto/profileEncrypter'; import { Storage, setLastProfileUpdateTimestamp } from '../util/storage'; import { OpenGroupUtils } from '../session/apis/open_group_api/utils'; -import { SessionUtilUserGroups } from '../session/utils/libsession/libsession_utils_user_groups'; import { leaveClosedGroup } from '../session/group/closed-group'; import { SessionUtilContact } from '../session/utils/libsession/libsession_utils_contacts'; import { SettingsKey } from '../data/settings-key'; import { ReleasedFeatures } from '../util/releaseFeature'; +import { UserGroupsWrapperActions } from '../webworker/workers/browser/libsession_worker_interface'; -export function copyPublicKeyByConvoId(convoId: string) { +export async function copyPublicKeyByConvoId(convoId: string) { if (OpenGroupUtils.isOpenGroupV2(convoId)) { - const fromWrapper = SessionUtilUserGroups.getCommunityByConvoIdCached(convoId); + const fromWrapper = await UserGroupsWrapperActions.getCommunityByFullUrl(convoId); if (!fromWrapper) { - throw new Error('opengroup to copy was not found in the UserGroupsWrapper'); + window.log.warn('opengroup to copy was not found in the UserGroupsWrapper'); + return; } - if (fromWrapper.fullUrl) { - window.clipboard.writeText(fromWrapper.fullUrl); + if (fromWrapper.fullUrlWithPubkey) { + window.clipboard.writeText(fromWrapper.fullUrlWithPubkey); + ToastUtils.pushCopiedToClipBoard(); } } else { window.clipboard.writeText(convoId); } - - ToastUtils.pushCopiedToClipBoard(); } export async function blockConvoById(conversationId: string) { diff --git a/ts/node/migration/sessionMigrations.ts b/ts/node/migration/sessionMigrations.ts index 34aca5ff8..9d3bd53b2 100644 --- a/ts/node/migration/sessionMigrations.ts +++ b/ts/node/migration/sessionMigrations.ts @@ -1500,7 +1500,7 @@ function updateToSessionSchemaVersion30(currentVersion: number, db: BetterSqlite /** * Remove the `publicChat` prefix from the communities, instead keep the full url+room in it, with the corresponding http or https prefix. * This is easier to handle with the libsession wrappers - **/ + */ const allOpengroupsConvo = db .prepare( `SELECT id FROM ${CONVERSATIONS_TABLE} WHERE diff --git a/ts/receiver/configMessage.ts b/ts/receiver/configMessage.ts index dd4a3d065..9f4ca2c14 100644 --- a/ts/receiver/configMessage.ts +++ b/ts/receiver/configMessage.ts @@ -214,7 +214,7 @@ async function handleCommunitiesUpdate() { const allCommunitiesInWrapper = await UserGroupsWrapperActions.getAllCommunities(); window.log.debug( 'allCommunitiesInWrapper', - allCommunitiesInWrapper.map(m => m.fullUrl) + allCommunitiesInWrapper.map(m => m.fullUrlWithPubkey) ); const allCommunitiesConversation = getConversationController() .getConversations() @@ -266,7 +266,7 @@ async function handleCommunitiesUpdate() { // this call can take quite a long time and should not cause issues to not be awaited void Promise.all( communitiesToJoinInDB.map(async toJoin => { - console.warn('joining community with convoId ', toJoin.fullUrl); + window.log.info('joining community with convoId ', toJoin.fullUrlWithPubkey); return getOpenGroupManager().attemptConnectionV2OneAtATime( toJoin.baseUrl, toJoin.roomCasePreserved, diff --git a/ts/session/apis/snode_api/snodeSignatures.ts b/ts/session/apis/snode_api/snodeSignatures.ts index 9402107de..dfee91598 100644 --- a/ts/session/apis/snode_api/snodeSignatures.ts +++ b/ts/session/apis/snode_api/snodeSignatures.ts @@ -106,7 +106,7 @@ async function generateUpdateExpirySignature({ const ourEd25519Key = await UserUtils.getUserED25519KeyPair(); if (!ourEd25519Key) { - const err = `getSnodeSignatureParams "expiry": User has no getUserED25519KeyPair()`; + const err = 'getSnodeSignatureParams "expiry": User has no getUserED25519KeyPair()'; window.log.warn(err); throw new Error(err); } diff --git a/ts/session/apis/snode_api/swarmPolling.ts b/ts/session/apis/snode_api/swarmPolling.ts index 87594098a..73c6c44df 100644 --- a/ts/session/apis/snode_api/swarmPolling.ts +++ b/ts/session/apis/snode_api/swarmPolling.ts @@ -439,7 +439,9 @@ export class SwarmPolling { )}` ); } - } catch (e) {} + } catch (e) { + // nothing to do I suppose here. + } results = results.slice(0, results.length - 1); } diff --git a/ts/session/conversations/ConversationController.ts b/ts/session/conversations/ConversationController.ts index a49108ffe..cc56ba2b8 100644 --- a/ts/session/conversations/ConversationController.ts +++ b/ts/session/conversations/ConversationController.ts @@ -238,10 +238,10 @@ export class ConversationController { try { const fromWrapper = await UserGroupsWrapperActions.getCommunityByFullUrl(conversation.id); - if (fromWrapper?.fullUrl) { + if (fromWrapper?.fullUrlWithPubkey) { await SessionUtilConvoInfoVolatile.removeCommunityFromWrapper( conversation.id, - fromWrapper.fullUrl + fromWrapper.fullUrlWithPubkey ); } } catch (e) { diff --git a/ts/session/utils/job_runners/jobs/ConfigurationSyncJob.ts b/ts/session/utils/job_runners/jobs/ConfigurationSyncJob.ts index 752508483..efd61d9ea 100644 --- a/ts/session/utils/job_runners/jobs/ConfigurationSyncJob.ts +++ b/ts/session/utils/job_runners/jobs/ConfigurationSyncJob.ts @@ -299,7 +299,6 @@ async function queueNewJobIfNeeded() { const leftBeforeNextTick = Math.max(defaultMsBetweenRetries - diff, 0); window.log.debug('Scheduling ConfSyncJob: LATER'); - // TODO we need to make the addJob wait for the previous addJob to be done before it can be called. await runners.configurationSyncRunner.addJob( new ConfigurationSyncJob({ nextAttemptTimestamp: Date.now() + leftBeforeNextTick }) ); @@ -309,5 +308,5 @@ async function queueNewJobIfNeeded() { export const ConfigurationSync = { ConfigurationSyncJob, queueNewJobIfNeeded: () => - allowOnlyOneAtATime(`ConfigurationSyncJob-oneAtAtTime`, queueNewJobIfNeeded), + allowOnlyOneAtATime('ConfigurationSyncJob-oneAtAtTime', queueNewJobIfNeeded), }; diff --git a/ts/session/utils/libsession/libsession_utils_user_groups.ts b/ts/session/utils/libsession/libsession_utils_user_groups.ts index f5c4bb405..65aea766b 100644 --- a/ts/session/utils/libsession/libsession_utils_user_groups.ts +++ b/ts/session/utils/libsession/libsession_utils_user_groups.ts @@ -155,7 +155,7 @@ async function refreshCachedUserGroup(convoId: string, duringAppStart = false) { let refreshed = false; if (OpenGroupUtils.isOpenGroupV2(convoId)) { const fromWrapper = await UserGroupsWrapperActions.getCommunityByFullUrl(convoId); - if (fromWrapper && fromWrapper.fullUrl) { + if (fromWrapper && fromWrapper.fullUrlWithPubkey) { mappedCommunityWrapperValues.set(convoId, fromWrapper); } refreshed = true; @@ -190,7 +190,7 @@ async function removeCommunityFromWrapper(convoId: string, fullUrlWithOrWithoutP ); if (fromWrapper) { - await UserGroupsWrapperActions.eraseCommunityByFullUrl(fromWrapper.fullUrl); + await UserGroupsWrapperActions.eraseCommunityByFullUrl(fromWrapper.fullUrlWithPubkey); } mappedCommunityWrapperValues.delete(convoId); } diff --git a/ts/util/releaseFeature.ts b/ts/util/releaseFeature.ts index e8fc4965f..94d4c0a20 100644 --- a/ts/util/releaseFeature.ts +++ b/ts/util/releaseFeature.ts @@ -21,7 +21,7 @@ function getIsFeatureReleasedCached(featureName: FeatureNameTracked) { case 'user_config_libsession': return isUserConfigLibsessionFeatureReleased; default: - assertUnreachable(featureName, `case not handled for getIsFeatureReleasedCached`); + assertUnreachable(featureName, 'case not handled for getIsFeatureReleasedCached'); } } @@ -34,7 +34,7 @@ function setIsFeatureReleasedCached(featureName: FeatureNameTracked, value: bool isUserConfigLibsessionFeatureReleased = value; break; default: - assertUnreachable(featureName, `case not handled for setIsFeatureReleasedCached `); + assertUnreachable(featureName, 'case not handled for setIsFeatureReleasedCached'); } } @@ -47,11 +47,11 @@ function getFeatureReleaseTimestamp(featureName: FeatureNameTracked) { case 'user_config_libsession': // TODO update to agreed value between platforms for `user_config_libsession` - return 1706778000000; // unix 01/02/2024 09:00; + return (window as any).user_config_libsession || 1706778000000; // unix 01/02/2024 09:00; // return 1677488400000; // testing: unix 27/02/2023 09:00 default: - assertUnreachable(featureName, `case not handled for getFeatureReleaseTimestamp `); + assertUnreachable(featureName, 'case not handled for getFeatureReleaseTimestamp'); } } @@ -90,7 +90,7 @@ async function checkIsFeatureReleased(featureName: FeatureNameTracked): Promise< return isReleased; } -function checkIsUserConfigFeatureReleased() { +async function checkIsUserConfigFeatureReleased() { return checkIsFeatureReleased('user_config_libsession'); } diff --git a/ts/webworker/workers/node/libsession/libsession.worker.ts b/ts/webworker/workers/node/libsession/libsession.worker.ts index 1fcc7ba43..d86a070ae 100644 --- a/ts/webworker/workers/node/libsession/libsession.worker.ts +++ b/ts/webworker/workers/node/libsession/libsession.worker.ts @@ -149,9 +149,9 @@ function prepareErrorForPostMessage(error: any) { return null; } - if (error.stack) { - return error.stack; - } + // if (error.stack) { + // return error.stack; + // } return error.message; } diff --git a/yarn.lock b/yarn.lock index 4f479107e..343ddc196 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5148,9 +5148,9 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -"libsession_util_nodejs@https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.10/libsession_util_nodejs-v0.1.10.tar.gz": - version "0.1.10" - resolved "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.10/libsession_util_nodejs-v0.1.10.tar.gz#d508007fd15976bdb8b168234d7a7a2e54c7eaf8" +"libsession_util_nodejs@https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.14/libsession_util_nodejs-v0.1.14.tar.gz": + version "0.1.14" + resolved "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.14/libsession_util_nodejs-v0.1.14.tar.gz#effb7e83ad6f09fb236b3f25497306b0236732ef" dependencies: cmake-js "^7.2.1" node-addon-api "^6.1.0"