This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
/
background.js
67 lines (56 loc) · 1.96 KB
/
background.js
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
// background.js
setInterval(function() {
var email;
var password;
var decryptAndAlert = function(md5pass, message) {
jQuery.ajax({
type: "POST",
url: "http://ping-me.himanshumishra.in/cryptex/",
data: "key=" + md5pass.toString() + "&cipher=" + message.toString(),
success: function(response2) {
if (response2.success == "True") {
notifyMe(response2.cipher);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
notifyMe("some error" + textStatus + " " + errorThrown);
}
});
};
chrome.storage.sync.get(function(localData) {
if (localData.authorized == "True") {
email = localData.email;
password = localData.md5pass;
}
jQuery.ajax({
type: "POST",
url: "http://ping-me.himanshumishra.in/ping/",
data: "email=" + email + "&password=" + password,
success: function(response) {
if (response.success == "True") {
decryptAndAlert(password, response.message);
}
}
});
});
}
, 60000);
function notifyMe(message) {
try
{if (!Notification) {
alert('Desktop notifications not available in your browser. Try Chromium.');
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
else {
var notification = new Notification('ping-me', {
icon: 'icon.png',
body: message,
});
notification.onclick = function () {
// do nothing
};
}}
catch (e) {console.log(e);}
}