Skip to content

Commit

Permalink
✨ support for X (Tweeter) OAuth URLs (#416)
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored May 30, 2024
1 parent eb7e74f commit d26e27c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/tab-manager/__tests__/redirect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,32 @@ describe('Tab Manager Redirect module test suite', () => {
expect(result).toBe(false);
});
});
describe('X login', () => {
test('From Twitter to X, should return false', () => {
// Given
mockViewUrl = 'https://twitter.com';
// When
const result = redirect.shouldOpenInExternalBrowser(mockView, new URL('https://x.com/login?hide_message=true&redirect_after_login=https%3A%2F%2Ftweetdeck.twitter.com%2F%3Fvia_twitter_login%3Dtrue'));
// Then
expect(result).toBe(false);
});
test('From X to Tweeter , should return false', () => {
// Given
mockViewUrl = 'https://x.com/login';
// When
const result = redirect.shouldOpenInExternalBrowser(mockView, new URL('https://twitter.com?via_twitter_login=true'));
// Then
expect(result).toBe(false);
});
test('From Tweeter to logout, should return false', () => {
// Given
mockViewUrl = 'https://twitter.com';
// When
const result = redirect.shouldOpenInExternalBrowser(mockView, new URL('https://x.com/logout'));
// Then
expect(result).toBe(false);
});
});
describe('Zoho login', () => {
test('From Zoho mail to login, should return false', () => {
// Given
Expand Down
3 changes: 3 additions & 0 deletions src/tab-manager/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const isOAuth = matchUrls([
/^https:\/\/.+\.skype\.com\/Auth\/.*/, // NOSONAR
/^https:\/\/.+\.twitter\.com\/login.*/, // NOSONAR
/^https:\/\/.+\.twitter\.com\/logout.*/, // NOSONAR
/^https:\/\/twitter\.com\/x.*/, // NOSONAR
/^https:\/\/x\.com\/login.*/, // NOSONAR
/^https:\/\/x\.com\/logout.*/, // NOSONAR
/^https:\/\/idbroker\.webex\.com\/idb\/oauth2\/.*/, // NOSONAR
/^https:\/\/accounts\.zoho\.(eu|com)\/signin.*/, // NOSONAR
/^https:\/\/.+\.zoom\.us\/profile.*/, // NOSONAR
Expand Down

0 comments on commit d26e27c

Please sign in to comment.