Skip to content
Merged
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
24 changes: 24 additions & 0 deletions web/bringyour.com/lib-ur/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,29 @@ new function() {
}
}

self.sendJWTToExtension = async (jwt) => {
// chrome extension id
const extensionId = 'kpnklgbgjkihebbieiggfeokkddjbkfb'

try {
const response = await chrome.runtime.sendMessage(
extensionId,
{
type: "SET_JWT",
jwt: jwt,
}
);

if (response && response.success) {
console.log("JWT successfully sent to extension");
} else {
console.error("Failed to send JWT:", response?.error);
}
} catch (error) {
console.error("Error communicating with extension:", error);
}
}

self.notifyByJwtChanged = function() {
let buttonElements = document.querySelectorAll('div[data-bs-target="#dialog-connect"]')
for (const buttonElement of buttonElements) {
Expand Down Expand Up @@ -126,6 +149,7 @@ new function() {
self.setByJwt = function(byJwt) {
localStorage.setItem('byJwt', byJwt)
self.notifyByJwtChanged()
self.sendJWTToExtension(byJwt)
}

self.removeByJwt = function() {
Expand Down