Conversation
erik-beus
left a comment
There was a problem hiding this comment.
Please see suggestions
chrome/src/background.ts
Outdated
| const url = new URL(urlString) | ||
|
|
||
| if ( | ||
| url.host.endsWith('toddle.dev') === false && |
There was a problem hiding this comment.
We can actually remove all references to the toddle.dev hostname now, as the editor is no longer served on that domain 👍 You might want to include -toddle.toddle.site though to make sure the extension works for preview branches of the editor project? 🤔
There was a problem hiding this comment.
Can you remind me why we would like to run this on the preview branches? 🤔
There was a problem hiding this comment.
I suppose it's useful to have the same experience of the browser extension regardless of which version of the editor you're running?
chrome/src/background.ts
Outdated
|
|
||
| if ( | ||
| url.host.endsWith('toddle.dev') === false && | ||
| url.host.endsWith('nordcraft.com') === false |
There was a problem hiding this comment.
This could be 'editor.nordcraft.com'?
There was a problem hiding this comment.
Since we are checking the endsWith it should work form the editor.nordcraft.com as well.
firefox/src/background.ts
Outdated
| requestUrl: info.url, | ||
| setCookie: (cookie) => browser.cookies.set(cookie), | ||
| setCookie: (cookie, domain) => { | ||
| if (!domain?.endsWith('.toddle.site')) { |
There was a problem hiding this comment.
I was getting an error in the extension that is not possible to set a cookie for a domain that has no permission.
There was a problem hiding this comment.
Makes sense 👍 Perhaps you could also add in support for .nordcraft.site so we're ready for when that's possible?
chrome/src/background.ts
Outdated
| const cookies = await chrome.cookies.getAll({ domain }) | ||
|
|
||
| if (cookies.length > 0) { | ||
| await updateSessionRules({ domainCookies: cookies, RULE_ID }) | ||
| } |
There was a problem hiding this comment.
It seems some of this code is the same as in the onBeforeNavigate listener above. Perhaps you could put the shared code in a function? The code that sends information about the cookies to the editor in the onBeforeNavigate listener might also be relevant for when a tab receives focus?
chrome/src/background.ts
Outdated
|
|
||
| if ( | ||
| url.host.endsWith('nordcraft.com') === false && | ||
| url.host.endsWith('-toddle.toddle.site') |
There was a problem hiding this comment.
| url.host.endsWith('-toddle.toddle.site') | |
| url.host.endsWith('-toddle.toddle.site') === false |
chrome/src/background.ts
Outdated
| return false | ||
| } | ||
|
|
||
| // Get the cookies for the .nordcraft.site domain |
There was a problem hiding this comment.
| // Get the cookies for the .nordcraft.site domain | |
| // Get the cookies for the .toddle.site domain |
No description provided.