-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
91 lines (76 loc) · 2.62 KB
/
main.js
File metadata and controls
91 lines (76 loc) · 2.62 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const { app, BrowserWindow } = require('electron');
const remote1 = require('electron').remote;
const settings = require('electron-settings');
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow({
height: 600,
width: 800
});
mainWindow.setMenu(null);
mainWindow.loadURL('file://' + __dirname + '/startpage.html');
});
function openFile() {
var inputEmail = document.getElementById('email').value;
var inputPass = document.getElementById('mobpassword').value;
$('#loadingmessage').show();
var request = $.ajax({
url: "http://api.mobtexting.in/Authentication/login/",
type: "POST",
data: {
username: inputEmail,
password: inputPass,
mobileApp: "true"
},
dataType: "html"
});
request.done(function(msg) {
$('#loadingmessage').hide();
//console to print data
var nodeConsole = require('console');
var myConsole = new nodeConsole.Console(process.stdout, process.stderr);
var json = msg;
obj = JSON.parse(json);
// myConsole.log(obj.access_token);
if (obj.response_code == 200) {
settings.set('mobtexting', {
email: obj.data.email,
access_token: obj.access_token
});
const remote = require('electron').remote;
const BrowserWindow = remote.BrowserWindow;
var win = new BrowserWindow({ width: 800, height: 600 });
win.setMenu(null);
win.loadURL('file://' + __dirname + '/first.html');
var window = remote1.getCurrentWindow();
window.close();
} else {
alert("Request failed: " + "Check username or password");
}
});
request.fail(function(jqXHR, textStatus) {
$('#loadingmessage').hide();
alert("Request failed: " + "Check username or password");
});
};
function saveSetting() {
var apikey = document.getElementById('apikey').value;
var senderID = document.getElementById('senderID').value;
settings.set('mobtextingsetting', {
apikey: apikey,
senderID: senderID
});
alert("Setting Has been Saved")
};
function openDialog() {
if (settings.has('mobtextingsetting.apikey'))
document.getElementById("apikey").value = settings.get('mobtextingsetting.apikey');
if (settings.has('mobtextingsetting.senderID'))
document.getElementById('senderID').value = settings.get('mobtextingsetting.senderID');
//$("#myBtn").click(function() {
$("#myModal").modal();
//});
};
function sendMessage() {
alert("test");
};