-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chrome-extension): Remove requirement for
syncSessionHost
- Loading branch information
1 parent
67265c4
commit cdaf16b
Showing
14 changed files
with
339 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export const CLIENT_JWT_KEY = '__client'; | ||
export const STORAGE_KEY_CLIENT_JWT = '__clerk_client_jwt'; | ||
export const VALID_HOST_PERMISSION_REGEX = /(https?:\/\/[\w.-]+)/; | ||
export const DEFAULT_LOCAL_HOST_PERMISSION = 'http://localhost'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
import browser from 'webextension-polyfill'; | ||
|
||
export async function getClientCookie(url: string, name: string) { | ||
return await browser.cookies.get({ url, name }); | ||
export type GetClientCookieParams = { | ||
urls: string | string[]; | ||
name: string; | ||
}; | ||
|
||
export async function getClientCookie({ urls, name }: GetClientCookieParams) { | ||
// Handle single host request | ||
if (typeof urls === 'string') { | ||
return browser.cookies.get({ url: urls, name }); | ||
} | ||
|
||
// Handle multi-host request | ||
const cookiePromises = urls.map(url => browser.cookies.get({ url, name })); | ||
const cookieResults = await Promise.allSettled(cookiePromises); | ||
|
||
for (const cookie of cookieResults) { | ||
if (cookie.status === 'fulfilled') { | ||
return cookie.value; | ||
} | ||
} | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.