This repository was archived by the owner on Aug 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetConvoToken.js
More file actions
74 lines (65 loc) · 2.32 KB
/
getConvoToken.js
File metadata and controls
74 lines (65 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Function to create and show notification
function showNotification(message, duration = 4000, color = '#4CAF50') {
// Create notification element
const notification = document.createElement('div');
notification.textContent = message;
// Style the notification
notification.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
background-color: ${color};
color: white;
padding: 16px 24px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
font-size: 14px;
font-weight: 500;
z-index: 10000;
opacity: 0;
transform: translateX(100%);
transition: all 0.3s ease-in-out;
max-width: 300px;
word-wrap: break-word;
`;
// Add to page
document.body.appendChild(notification);
// Animate in
setTimeout(() => {
notification.style.opacity = '1';
notification.style.transform = 'translateX(0)';
}, 10);
// Auto remove after duration
setTimeout(() => {
notification.style.opacity = '0';
notification.style.transform = 'translateX(100%)';
setTimeout(() => {
if (notification.parentNode) {
notification.parentNode.removeChild(notification);
}
}, 300);
}, duration);
}
if (window.location.href.includes('webExtLogin') || localStorage.getItem('webExtLogin') == 'true') {
showNotification('Trying to login...', 1000, '#00bbffff');
}
setTimeout(() => {
const convoToken = localStorage.getItem('flutter.convoToken');
if (convoToken) {
chrome.storage.local.set(
{ convoToken: convoToken },
() => { }
);
if (window.location.href.includes('webExtLogin') || localStorage.getItem('webExtLogin') == 'true') {
showNotification('Flow Extension login successful');
localStorage.removeItem('webExtLogin');
}
} else {
console.log('flutter.convoToken not found in localStorage');
if (window.location.href.includes('webExtLogin')) {
showNotification('Please login to use the Flow Extension', 300000, '#aa0e00');
localStorage.setItem('webExtLogin', 'true');
}
}
}, 1000);