atendeticket 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/appInstaller.js +149 -1
- package/core/banner.js +7 -7
- package/index.js +1 -1
- package/package.json +1 -1
- package/prompts/mainMenu.js +6 -2
package/appInstaller.js
CHANGED
|
@@ -167,4 +167,152 @@ async function runInstaller() {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
async function handleMenu(choice) {
|
|
171
|
+
if (choice.action === 'install') {
|
|
172
|
+
const answers = await installPrompts();
|
|
173
|
+
|
|
174
|
+
// Generate JWT secrets
|
|
175
|
+
const jwt_secret = require('crypto').randomBytes(64).toString('base64');
|
|
176
|
+
const jwt_refresh_secret = require('crypto').randomBytes(64).toString('base64');
|
|
177
|
+
|
|
178
|
+
// Configurações automáticas do Redis
|
|
179
|
+
const redis_host = "localhost";
|
|
180
|
+
const redis_password = answers.mysql_root_password;
|
|
181
|
+
const redis_uri = `redis://:${redis_password}@${redis_host}:${answers.redisPort}`;
|
|
182
|
+
|
|
183
|
+
// Sistema
|
|
184
|
+
await updateSystem();
|
|
185
|
+
await installNode();
|
|
186
|
+
await installDocker();
|
|
187
|
+
await installPM2();
|
|
188
|
+
await installNginx();
|
|
189
|
+
await installCertbot();
|
|
190
|
+
await createUser(answers.mysql_root_password);
|
|
191
|
+
|
|
192
|
+
// Backend
|
|
193
|
+
await createDatabase(answers.instancia_add, answers.mysql_root_password);
|
|
194
|
+
await createRedis(answers.instancia_add, answers.redisPort, answers.mysql_root_password);
|
|
195
|
+
await setBackendEnv(
|
|
196
|
+
'', // node_env
|
|
197
|
+
answers.backendUrl,
|
|
198
|
+
answers.frontendUrl,
|
|
199
|
+
443, // proxy_port
|
|
200
|
+
answers.backendPort,
|
|
201
|
+
'localhost', // db_host
|
|
202
|
+
'postgres', // db_dialect
|
|
203
|
+
answers.instancia_add, // db_user
|
|
204
|
+
answers.mysql_root_password, // db_pass
|
|
205
|
+
answers.instancia_add, // db_name
|
|
206
|
+
5432, // db_port
|
|
207
|
+
'senha_master', // master_key
|
|
208
|
+
1, // import_fallback_file
|
|
209
|
+
1000, // timeout_to_import_message
|
|
210
|
+
3, // app_trialexpiration
|
|
211
|
+
jwt_secret,
|
|
212
|
+
jwt_refresh_secret,
|
|
213
|
+
redis_uri,
|
|
214
|
+
1, // redis_opt_limiter_max
|
|
215
|
+
3000, // redis_opt_limiter_duration
|
|
216
|
+
8, // flow_menu_cooldown_sec
|
|
217
|
+
answers.max_user, // user_limit
|
|
218
|
+
answers.max_whats, // connections_limit
|
|
219
|
+
true, // closed_send_by_me
|
|
220
|
+
'whaticket', // verify_token
|
|
221
|
+
'', // mp_access_token
|
|
222
|
+
'2813216208828642', // facebook_app_id
|
|
223
|
+
'8233912aeade366dd8e2ebef6be256b6', // facebook_app_secret
|
|
224
|
+
'smtp.gmail.com', // smtp_host
|
|
225
|
+
'587', // smtp_port
|
|
226
|
+
'false', // smtp_secure
|
|
227
|
+
'seuemail@gmail.com', // smtp_user
|
|
228
|
+
'suasenha', // smtp_pass
|
|
229
|
+
'Redefinição de senha <seuemail@gmail.com>' // smtp_from
|
|
230
|
+
);
|
|
231
|
+
await installBackendDeps();
|
|
232
|
+
await buildBackend();
|
|
233
|
+
await migrate();
|
|
234
|
+
await seed();
|
|
235
|
+
await startBackendPM2();
|
|
236
|
+
await setupBackendNginx(answers.backendUrl.replace(/^https?:\/\//, ''));
|
|
237
|
+
|
|
238
|
+
// Frontend
|
|
239
|
+
await setFrontendEnv(
|
|
240
|
+
answers.backendUrl,
|
|
241
|
+
24, // hours_close_tickets_auto
|
|
242
|
+
'https', // backend_protocol
|
|
243
|
+
answers.backendUrl.replace(/^https?:\/\//, ''), // backend_host
|
|
244
|
+
answers.backendPort, // backend_port_param
|
|
245
|
+
'pt-br', // locale
|
|
246
|
+
'America/Sao_Paulo', // timezone
|
|
247
|
+
'55XXXXXXXXXXX', // number_support
|
|
248
|
+
'2813216208828642', // facebook_app_id
|
|
249
|
+
true, // require_business_management
|
|
250
|
+
false, // certificates
|
|
251
|
+
true, // https
|
|
252
|
+
'F:\\bkpidx\\workflow\\backend\\certs\\localhost.pem', // ssl_crt_file
|
|
253
|
+
'F:\\bkpidx\\workflow\\backend\\certs\\localhost-key.pem', // ssl_key_file
|
|
254
|
+
'2813216208828642', // react_app_facebook_app_id
|
|
255
|
+
true, // react_app_require_business_management
|
|
256
|
+
false, // generate_sourcemap
|
|
257
|
+
false // disable_eslint_plugin
|
|
258
|
+
);
|
|
259
|
+
await installFrontendDeps();
|
|
260
|
+
await buildFrontend();
|
|
261
|
+
await startFrontendPM2();
|
|
262
|
+
await setupFrontendNginx(answers.frontendUrl.replace(/^https?:\/\//, ''));
|
|
263
|
+
|
|
264
|
+
// SSL
|
|
265
|
+
const backend_domain = answers.backendUrl.replace(/^https?:\/\//, '');
|
|
266
|
+
const frontend_domain = answers.frontendUrl.replace(/^https?:\/\//, '');
|
|
267
|
+
await setupSSL(backend_domain, frontend_domain, answers.deployEmail);
|
|
268
|
+
|
|
269
|
+
success('Instalação completa do Multizap!');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (choice.action === 'update') {
|
|
273
|
+
const answers = await updatePrompts();
|
|
274
|
+
|
|
275
|
+
if (answers.updateSystem) await updateSystem();
|
|
276
|
+
if (answers.updateBackend) {
|
|
277
|
+
await installBackendDeps();
|
|
278
|
+
await buildBackend();
|
|
279
|
+
await migrate();
|
|
280
|
+
await seed();
|
|
281
|
+
await startBackendPM2();
|
|
282
|
+
}
|
|
283
|
+
if (answers.updateFrontend) {
|
|
284
|
+
await installFrontendDeps();
|
|
285
|
+
await buildFrontend();
|
|
286
|
+
await startFrontendPM2();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
success('Atualização concluída!');
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (choice.action === 'delete') {
|
|
293
|
+
await deleteAction();
|
|
294
|
+
success('Instância deletada com sucesso!');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (choice.action === 'block') {
|
|
298
|
+
await block();
|
|
299
|
+
success('Instância bloqueada com sucesso!');
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (choice.action === 'unblock') {
|
|
303
|
+
await unblock();
|
|
304
|
+
success('Instância desbloqueada com sucesso!');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (choice.action === 'changeDomain') {
|
|
308
|
+
await changeDomain();
|
|
309
|
+
success('Domínio alterado com sucesso!');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (choice.action === 'update') {
|
|
313
|
+
await update();
|
|
314
|
+
success('Atualização concluída!');
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
module.exports = { runInstaller, handleMenu };
|
package/core/banner.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
const chalk = (
|
|
1
|
+
function showBanner() {
|
|
2
|
+
const chalk = require('chalk');
|
|
3
3
|
|
|
4
4
|
console.log(chalk.cyan(`
|
|
5
|
-
___ _ _ _ _ _
|
|
6
|
-
/ _ \\ _ __(_)_ _____| | ___ | | (_) | ___
|
|
7
|
-
| | | | '__| \\ \\ / / _ \\ |/ _ \\ | | | |/ _ \\
|
|
8
|
-
| |_| | | | |\\ V / __/ | __/ | |__| | | __/
|
|
9
|
-
\\___/|_| |_| \\_/ \\___|_|\\___| |____/|_|\\___|
|
|
5
|
+
___ _ _ _ _ _
|
|
6
|
+
/ _ \\ _ __(_)_ _____| | ___ | | (_) | ___
|
|
7
|
+
| | | | '__| \\ \\ / / _ \\ |/ _ \\ | | | |/ _ \\
|
|
8
|
+
| |_| | | | |\\ V / __/ | __/ | |__| | | __/
|
|
9
|
+
\\___/|_| |_| \\_/ \\___|_|\\___| |____/|_|\\___|
|
|
10
10
|
`));
|
|
11
11
|
}
|
|
12
12
|
|
package/index.js
CHANGED
package/package.json
CHANGED
package/prompts/mainMenu.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const inquirer = require('inquirer');
|
|
1
|
+
const { default: inquirer } = require('inquirer');
|
|
2
2
|
|
|
3
3
|
async function mainMenuPrompt() {
|
|
4
4
|
const answers = await inquirer.prompt([
|
|
@@ -9,10 +9,14 @@ async function mainMenuPrompt() {
|
|
|
9
9
|
choices: [
|
|
10
10
|
{ name: 'Instalar sistema', value: 'install' },
|
|
11
11
|
{ name: 'Atualizar sistema', value: 'update' },
|
|
12
|
+
{ name: 'Deletar instância', value: 'delete' },
|
|
13
|
+
{ name: 'Bloquear instância', value: 'block' },
|
|
14
|
+
{ name: 'Desbloquear instância', value: 'unblock' },
|
|
15
|
+
{ name: 'Alterar domínio', value: 'changeDomain' },
|
|
12
16
|
],
|
|
13
17
|
},
|
|
14
18
|
]);
|
|
15
|
-
return answers
|
|
19
|
+
return answers;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
module.exports = { mainMenuPrompt };
|