-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackground.js
More file actions
36 lines (32 loc) · 992 Bytes
/
background.js
File metadata and controls
36 lines (32 loc) · 992 Bytes
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
// Background script for Uhmegle Bot
// Listen for install event
chrome.runtime.onInstalled.addListener((details) => {
if (details.reason === 'install') {
// Initialize extension state
chrome.storage.local.set({
botRunning: false,
botLogs: []
});
// Request notification permission
if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {
Notification.requestPermission();
}
// Open onboarding page
chrome.tabs.create({
url: 'https://uhmegle.com/'
});
}
});
// Listen for messages from content script or popup
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
// Handle notification request from content script
if (message.action === 'NOTIFICATION') {
chrome.notifications.create({
type: 'basic',
iconUrl: 'images/icon128.png',
title: message.title || 'Uhmegle Bot',
message: message.message || '',
priority: 2
});
}
});