Skip to content

Commit

Permalink
Fix indentation and quotations
Browse files Browse the repository at this point in the history
  • Loading branch information
not-a-rootkit committed Jul 30, 2024
1 parent 763431c commit 1fdb059
Showing 1 changed file with 36 additions and 37 deletions.
73 changes: 36 additions & 37 deletions security/badware/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
self.addEventListener("install", (event) => {
console.log("Service Worker installing.");
self.skipWaiting();
self.addEventListener('install', () => {
console.log('Service Worker installing.');
self.skipWaiting();
});

self.addEventListener("activate", (event) => {
console.log("Service Worker activating.");
event.waitUntil(self.clients.claim());
self.addEventListener('activate', () => {
console.log('Service Worker activating.');
self.clients.claim();
});

self.addEventListener("message", (event) => {
if (event.data === "navigate") {
console.log("Service Worker received navigate message.");
self.clients.matchAll({ type: "window" }).then((clients) => {
clients.forEach((client) => {
if ("navigate" in client) {
client
.navigate("/security/badware/phishing.html")
.then(() => {
console.log("Navigation attempt to phishing page.");
self.addEventListener('message', (event) => {
if (event.data === 'navigate') {
console.log('Service Worker received navigate message.');
self.clients.matchAll({ type: 'window' }).then((clients) => {
clients.forEach((client) => {
if ('navigate' in client) {
client.navigate('/security/badware/phishing.html')
.then(() => {
console.log('Navigation attempt to phishing page.');
})
.catch((error) => {
console.error('Navigation failed:', error);
});
}
});
});
} else if (event.data === 'fetch') {
console.log('Service Worker received fetch message.');
fetch('https://bad.third-party.site/security/badware/phishing.html')
.then((response) => {
if (response.ok) {
console.log('Phishing page fetched successfully.');
} else {
console.log('Failed to fetch phishing page.');
}
})
.catch((error) => {
console.error("Navigation failed:", error);
console.error('Error fetching phishing page:', error);
});
}
});
});
} else if (event.data === "fetch") {
console.log("Service Worker received fetch message.");
fetch("https://bad.third-party.site/security/badware/phishing.html")
.then((response) => {
if (response.ok) {
console.log("Phishing page fetched successfully.");
} else {
console.log("Failed to fetch phishing page.");
}
})
.catch((error) => {
console.error("Error fetching phishing page:", error);
});
} else {
console.log("Service Worker received unknown message:", event.data);
}
});
} else {
console.log('Service Worker received unknown message:', event.data);
}
});

0 comments on commit 1fdb059

Please sign in to comment.