forked from HybridFNBR/Neonite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
55 lines (47 loc) · 1.58 KB
/
app.js
File metadata and controls
55 lines (47 loc) · 1.58 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
const sails = require("sails");
const NeoLog = require("./structs/NeoLog")
const { default: axios } = require("axios");
const fs = require("fs");
const ini = require("ini");
const config = ini.parse(fs.readFileSync("config.ini", "utf-8"));
async function compareAndUpdateKeychain() {
const response = await axios.get("https://fortnitecentral.genxgames.gg/api/v1/aes");
if (response.status === 200) {
const data = response.data;
const keychain = JSON.parse(fs.readFileSync("./responses/keychain.json", "utf-8"));
let missingCount = 0;
const keychainArray = [];
for (const keys of data.dynamicKeys) {
if (!keychain.includes(keys.keychain)) {
missingCount++;
keychainArray.push(keys.keychain);
}
}
keychain.push(...keychainArray);
fs.writeFileSync("./responses/keychain.json", JSON.stringify(keychain, null, 2));
NeoLog.Debug(`Fetched ${missingCount} New Keychains from Fortnite Central.`);
} else if (response.status === 503 || response.status === 403) {
NeoLog.Error(`Failed to update Keychain, received status: ${response.status}.`);
}
};
async function startBackend() {
sails.lift({
port: 5595,
environment: "production",
hooks: {
session: false
},
log: {
level: config.logLevel
},
}, (err) => {
if (err) {
console.error(err);
}
});
};
async function runFunctions() {
await compareAndUpdateKeychain();
await startBackend();
};
runFunctions();