Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add a developer command to reset Megolm and Olm sessions #9044

Merged
merged 1 commit into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/SlashCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,28 @@ export const Commands = [
category: CommandCategories.advanced,
renderingTypes: [TimelineRenderingType.Room],
}),
new Command({
command: 'remakeolm',
description: _td('Developer command: Discards the current outbound group session and sets up new Olm sessions'),
isEnabled: () => {
return SettingsStore.getValue("developerMode");
},
runFn: (roomId) => {
try {
const room = MatrixClientPeg.get().getRoom(roomId);

MatrixClientPeg.get().forceDiscardSession(roomId);

// noinspection JSIgnoredPromiseFromCall
MatrixClientPeg.get().crypto.ensureOlmSessionsForUsers(room.getMembers().map(m => m.userId), true);
} catch (e) {
return reject(e.message);
}
return success();
},
category: CommandCategories.advanced,
renderingTypes: [TimelineRenderingType.Room],
}),
Comment on lines +1073 to +1094
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a bit duplicative of /discardsession and then merely typing into the composer to trigger the megolm setup

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The distinction is the olm sessions.

new Command({
command: "rainbow",
description: _td("Sends the given message coloured as a rainbow"),
Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@
"Verified key": "Verified key",
"The signing key you provided matches the signing key you received from %(userId)s's session %(deviceId)s. Session marked as verified.": "The signing key you provided matches the signing key you received from %(userId)s's session %(deviceId)s. Session marked as verified.",
"Forces the current outbound group session in an encrypted room to be discarded": "Forces the current outbound group session in an encrypted room to be discarded",
"Developer command: Discards the current outbound group session and sets up new Olm sessions": "Developer command: Discards the current outbound group session and sets up new Olm sessions",
"Sends the given message coloured as a rainbow": "Sends the given message coloured as a rainbow",
"Sends the given emote coloured as a rainbow": "Sends the given emote coloured as a rainbow",
"Displays list of commands with usages and descriptions": "Displays list of commands with usages and descriptions",
Expand Down