Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): deduplicate messages / lower case join code #1082

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

andrei-gavrilescu
Copy link
Contributor

No description provided.

saghul
saghul previously approved these changes Aug 21, 2024
const currentTimestamp = this._lastSpotState && this._lastSpotState.timestamp;

if (currentTimestamp && timestamp && currentTimestamp >= timestamp) {
const previousMsgId = this._lastSpotState && this._lastSpotState.msgId;
Copy link
Member

Choose a reason for hiding this comment

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

Use optional chaining?

@@ -272,7 +275,7 @@ export class RemoteControlServer extends BaseRemoteControlService {
* @returns {Promise} - A Promise resolved when the code has been refreshed.
*/
refreshJoinCodeWithXmpp() {
const roomLock = generateRandomString(3);
const roomLock = generateRandomString(3).toLowerCase();
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the passcode needs to be lowercase, does it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not that the passcode needs to be lowercase, but when you enter it on the remote, even if the ui shows them as upper case it does a toLowerCase() and then sends it to the server.

const trimmedCode = code.trim().toLowerCase();

Copy link
Member

Choose a reason for hiding this comment

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

Oh, got it!

@@ -82,7 +85,7 @@ export class RemoteControlServer extends BaseRemoteControlService {
// If there's no joinCode service then create a room and let the lock
// be set later. Setting the lock on join will throw an error about
// not being authorized..
roomName: generateRandomString(3)
roomName: generateRandomString(3).toLowerCase()
Copy link
Member

Choose a reason for hiding this comment

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

What about above, when we split a 6 digit code?

@andrei-gavrilescu andrei-gavrilescu merged commit d4b8ce6 into master Aug 23, 2024
4 of 5 checks passed
@andrei-gavrilescu andrei-gavrilescu deleted the fix/message-deduplication branch August 23, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants