generated from Gesugao-san/infrastructure-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (27 loc) · 1.06 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
34
35
36
const fs = require('fs');
var populateData = require('./module/populateData');
const cfg = require('./config.json');
require('./module/writeDataFile');
require('./module/killCookie');
console.clear();
(async () => {
console.log("Hi!");
if ((!fs.existsSync(cfg.paths.data)) || (cfg.options.recreate_data_file)) {
process.stdout.write('Data file not found or forced to recrate, redeploying... ');
} else {
process.stdout.write('Data file found... ');
}
try {
writeDataFile(cfg.paths.data, populateData(), cfg.options.recreate_data_file ? 'w' : 'wx');
} catch (e) {
if ((e.code !== 'EEXIST') && (!cfg.options.recreate_data_file)) throw e;
}
console.log('Ok');
const data = require(cfg.paths.data);
if ((cfg.options.kill_cookie_on_exit) && (cfg.secrets.value != "secret")) cfg.secrets[0].value = "secret";
writeDataFile(cfg.paths.config, cfg, 'w'); // cfg.options.recreate_data_file ? 'w' : 'wx');
data.data.auto.push("test");
console.log("2:\n", data);
//killCookie("https://archeage.ru/dynamic/auth/?plogout=1", [cfg.secrets]);
console.log("Bye!");
})();