diff --git a/package.json b/package.json index 68aa9af6f..0bfccaeb4 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,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.20/libsession_util_nodejs-v0.1.20.tar.gz", + "libsession_util_nodejs": "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.2.0/libsession_util_nodejs-v0.2.0.tar.gz", "libsodium-wrappers-sumo": "^0.7.9", "linkify-it": "3.0.2", "lodash": "^4.17.21", diff --git a/ts/node/migration/sessionMigrations.ts b/ts/node/migration/sessionMigrations.ts index 29b675b0c..3de70f321 100644 --- a/ts/node/migration/sessionMigrations.ts +++ b/ts/node/migration/sessionMigrations.ts @@ -1226,7 +1226,7 @@ function insertContactIntoContactWrapper( const dbApprovedMe = !!contact.didApproveMe || false; const dbBlocked = blockedNumbers.includes(contact.id); const priority = contact.priority || CONVERSATION_PRIORITIES.default; - // const expirationTimerSeconds = contact.expireTimer || 0; + const expirationTimerSeconds = contact.expireTimer || 0; const wrapperContact = getContactInfoFromDBValues({ id: contact.id, @@ -1239,8 +1239,7 @@ function insertContactIntoContactWrapper( dbProfileUrl: contact.avatarPointer || undefined, priority, dbCreatedAtSeconds: Math.floor((contact.active_at || Date.now()) / 1000), - - // expirationTimerSeconds, + expirationTimerSeconds, //FIXME WILL add expirationMode here }); try { @@ -1265,7 +1264,7 @@ function insertContactIntoContactWrapper( dbProfileUrl: undefined, priority: CONVERSATION_PRIORITIES.default, dbCreatedAtSeconds: Math.floor(Date.now() / 1000), - // expirationTimerSeconds: 0, + expirationTimerSeconds: 0, //FIXME WILL add expirationMode here }) ); } catch (e) { @@ -1379,7 +1378,7 @@ function insertCommunityIntoWrapper( function insertLegacyGroupIntoWrapper( legacyGroup: Pick< ConversationAttributes, - 'id' | 'priority' | 'displayNameInProfile' | 'lastJoinedTimestamp' // | 'expireTimer' + 'id' | 'priority' | 'displayNameInProfile' | 'lastJoinedTimestamp' | 'expireTimer' > & { members: string; groupAdmins: string }, // members and groupAdmins are still stringified here userGroupConfigWrapper: UserGroupsWrapperNode, volatileInfoConfigWrapper: ConvoInfoVolatileWrapperNode, @@ -1388,7 +1387,7 @@ function insertLegacyGroupIntoWrapper( const { priority, id, - // expireTimer, + expireTimer, groupAdmins, members, displayNameInProfile, @@ -1403,7 +1402,7 @@ function insertLegacyGroupIntoWrapper( const wrapperLegacyGroup = getLegacyGroupInfoFromDBValues({ id, priority, - // expireTimer, + expireTimer, //FIXME WILL add expirationMode here groupAdmins, members, displayNameInProfile, @@ -1631,7 +1630,7 @@ function updateToSessionSchemaVersion31(currentVersion: number, db: BetterSqlite const ourDbProfileUrl = ourConversation.avatarPointer || ''; const ourDbProfileKey = fromHexToArray(ourConversation.profileKey || ''); const ourConvoPriority = ourConversation.priority; - // const ourConvoExpire = ourConversation.expireTimer || 0; + const ourConvoExpire = ourConversation.expireTimer || 0; if (ourDbProfileUrl && !isEmpty(ourDbProfileKey)) { userProfileWrapper.setUserInfo( ourDbName, @@ -1639,8 +1638,8 @@ function updateToSessionSchemaVersion31(currentVersion: number, db: BetterSqlite { url: ourDbProfileUrl, key: ourDbProfileKey, - } - // ourConvoExpire + }, + ourConvoExpire ); } diff --git a/ts/session/apis/open_group_api/utils/OpenGroupUtils.ts b/ts/session/apis/open_group_api/utils/OpenGroupUtils.ts index 6f539dcfe..6114c5a47 100644 --- a/ts/session/apis/open_group_api/utils/OpenGroupUtils.ts +++ b/ts/session/apis/open_group_api/utils/OpenGroupUtils.ts @@ -124,7 +124,7 @@ export function isOpenGroupV2(conversationId: string) { * @returns A map of conversationIds to roomInfos for all valid open group conversations or undefined */ export async function getAllValidOpenGroupV2ConversationRoomInfos() { - const inWrapperCommunities = SessionUtilUserGroups.getAllCommunitiesCached(); + const inWrapperCommunities = await SessionUtilUserGroups.getAllCommunitiesNotCached(); const inWrapperIds = inWrapperCommunities.map(m => getOpenGroupV2ConversationId(m.baseUrl, m.roomCasePreserved) diff --git a/ts/session/utils/libsession/libsession_utils_contacts.ts b/ts/session/utils/libsession/libsession_utils_contacts.ts index a5d16d5df..640ca5204 100644 --- a/ts/session/utils/libsession/libsession_utils_contacts.ts +++ b/ts/session/utils/libsession/libsession_utils_contacts.ts @@ -57,8 +57,7 @@ async function insertContactFromDBIntoWrapperAndRefresh(id: string): Promise 0 - // ? expirationTimerSeconds - // : 0, // TODOLATER add the expiration mode handling - // expirationMode: - // !!expirationTimerSeconds && isFinite(expirationTimerSeconds) && expirationTimerSeconds > 0 - // ? 'disappearAfterSend' - // : 'off', + expirationTimerSeconds: + !!expirationTimerSeconds && isFinite(expirationTimerSeconds) && expirationTimerSeconds > 0 + ? expirationTimerSeconds + : 0, + expirationMode: 'off', //FIXME WILL add expirationMode here }; if ( @@ -202,14 +199,14 @@ export function getLegacyGroupInfoFromDBValues({ priority, members: maybeMembers, displayNameInProfile, - // expireTimer, + expireTimer, encPubkeyHex, encSeckeyHex, groupAdmins: maybeAdmins, lastJoinedTimestamp, }: Pick< ConversationAttributes, - 'id' | 'priority' | 'displayNameInProfile' | 'lastJoinedTimestamp' //| 'expireTimer' + 'id' | 'priority' | 'displayNameInProfile' | 'lastJoinedTimestamp' | 'expireTimer' > & { encPubkeyHex: string; encSeckeyHex: string; @@ -227,7 +224,7 @@ export function getLegacyGroupInfoFromDBValues({ }); const legacyGroup: LegacyGroupInfo = { pubkeyHex: id, - // disappearingTimerSeconds: !expireTimer ? 0 : expireTimer, + disappearingTimerSeconds: !expireTimer ? 0 : expireTimer, //FIXME WILL add expirationMode here name: displayNameInProfile || '', priority: priority || 0, members: wrappedMembers, diff --git a/ts/webworker/workers/browser/libsession_worker_interface.ts b/ts/webworker/workers/browser/libsession_worker_interface.ts index fb2555e9a..0256e9bb9 100644 --- a/ts/webworker/workers/browser/libsession_worker_interface.ts +++ b/ts/webworker/workers/browser/libsession_worker_interface.ts @@ -104,8 +104,8 @@ export const UserConfigWrapperActions: UserConfigWrapperActionsCalls = { setUserInfo: async ( name: string, priority: number, - profilePic: { url: string; key: Uint8Array } | null - // expireSeconds: number + profilePic: { url: string; key: Uint8Array } | null, + expireSeconds: number ) => callLibSessionWorker([ 'UserConfig', @@ -113,7 +113,7 @@ export const UserConfigWrapperActions: UserConfigWrapperActionsCalls = { name, priority, profilePic, - // expireSeconds, + expireSeconds, ]) as Promise>, }; diff --git a/yarn.lock b/yarn.lock index 2b8c5284f..86436b384 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5155,9 +5155,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.20/libsession_util_nodejs-v0.1.20.tar.gz": - version "0.1.20" - resolved "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.20/libsession_util_nodejs-v0.1.20.tar.gz#4ff8331e4efb1725cf8bba0ef1af7496ebd8533d" +"libsession_util_nodejs@https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.2.0/libsession_util_nodejs-v0.2.0.tar.gz": + version "0.2.0" + resolved "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.2.0/libsession_util_nodejs-v0.2.0.tar.gz#0019ca2e3296b1e151dcd09923823c271dd2c0a0" dependencies: cmake-js "^7.2.1" node-addon-api "^6.1.0"