-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (27 loc) · 1.24 KB
/
index.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
/* Copyright (c) 2024 Serhii I. Myshko
https://github.com/sergeiown/Alert_Server/blob/main/LICENSE */
'use strict';
const { restoreConfigFiles } = require('./modules/maintenance/configFilesRestoreHandler');
const { checkIntegrity } = require('./modules/maintenance/integrityChecker');
(async () => {
try {
await restoreConfigFiles();
await checkIntegrity();
} catch (err) {
console.error(`Error during initialization:`, err);
} finally {
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
await delay(2000);
const { handleExceptionAndRestart, logSystemEvents } = require('./modules/systemEventAndErrorHandler');
const { createTrayIcon } = require('./modules/trayMenu/trayIconManager');
const { fetchDataAndSaveToFile } = require('./modules/alertManager/apiRequestHandler');
const { showNotification } = require('./modules/alertManager/alertNotifier');
const { delayedCheckForUpdates } = require('./modules/maintenance/updateHandler');
handleExceptionAndRestart();
logSystemEvents();
createTrayIcon();
delayedCheckForUpdates();
await fetchDataAndSaveToFile();
await showNotification();
}
})();