-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
70 lines (59 loc) · 1.94 KB
/
main.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
68
69
70
const { app, ipcMain, ipcRenderer, BrowserWindow, nativeImage } = require('electron');
const { exec } = require("child_process");
var mainWindow = null;
async function createWindow(){
mainWindow = new BrowserWindow({
width:400,
height:500,
resizable:false,
autoHideMenuBar:true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
});
await mainWindow.loadFile('src/pages/index.html');
}
app.whenReady().then(createWindow);
ipcMain.on("eventoButton", function(event, args) {
let nomeUsuario = args['nomeUsuario'];
let localEmpresa = args['localEmpresa'];
const caminhosArapoti = [
`@echo off`,
`ipconfig /flushdns`,
`net use n: /del`,
`net use y: /del`,
`net use p: /del`,
`net use z: /del`,
`net use n: \\\\braras001\\arapoti_mill$ /persistent:no`,
`net use p: \\\\bopaper.local\\shares\\common /persistent:no`,
`net use u: \\\\braras001\\users$\\${nomeUsuario} /persistent:no`,
`net use y: \\\\braras001\\public$ /persistent:no`
]
const caminhosPisa = [
`@echo off`,
`ipconfig /flushdns`,
`net use n: /del`,
`net use y: /del`,
`net use p: /del`,
`net use z: /del`,
`net use y: \\\\braras001\\public$ /persistent:no`,
`net use u: \\\\10.218.6.129\\homedirs\\${nomeUsuario} /persistent:no`,
`net use n: \\\\pisa.com\\shares\\common\\ARA /persistent:no`,
`net use p: \\\\pisa.com\\shares\\common\ /persistent:no`,
]
if(localEmpresa == '1'){
for(let item in caminhosArapoti){
exec(caminhosArapoti[item]);
}
}else
if(localEmpresa == '2'){
for(let item in caminhosPisa){
exec(caminhosPisa[item]);
}
}
mainWindow.loadFile("src/pages/success.html")
});
ipcMain.on("buttonEncerrar", function(event, args){
app.exit();
});