mirror of
https://github.com/ApfelTeeSaft/Reload-Backend.git
synced 2026-08-26 19:33:26 +00:00
Added Cross Bans and fixed styles
This commit is contained in:
@@ -26100,41 +26100,11 @@
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "Fortnite",
|
||||
"channel": "Parts",
|
||||
"active": "Stage0",
|
||||
"owned": [
|
||||
"Fortnite",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Belgium",
|
||||
"Brazil",
|
||||
"Canada",
|
||||
"Colombia",
|
||||
"Denmark",
|
||||
"Egypt",
|
||||
"England",
|
||||
"France",
|
||||
"Germany",
|
||||
"Iceland",
|
||||
"Italy",
|
||||
"Ireland",
|
||||
"Japan",
|
||||
"Korea",
|
||||
"Mexico",
|
||||
"Netherlands",
|
||||
"NewZealand",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Russia",
|
||||
"Saudi",
|
||||
"Spain",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Terkey",
|
||||
"Uruguay",
|
||||
"USA"
|
||||
"Stage0",
|
||||
"Stage1"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -26151,41 +26121,12 @@
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "Fortnite",
|
||||
"channel": "ClothingColor",
|
||||
"active": "Mat0",
|
||||
"owned": [
|
||||
"Fortnite",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Belgium",
|
||||
"Brazil",
|
||||
"Canada",
|
||||
"Colombia",
|
||||
"Denmark",
|
||||
"Egypt",
|
||||
"England",
|
||||
"France",
|
||||
"Germany",
|
||||
"Iceland",
|
||||
"Italy",
|
||||
"Ireland",
|
||||
"Japan",
|
||||
"Korea",
|
||||
"Mexico",
|
||||
"Netherlands",
|
||||
"NewZealand",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Russia",
|
||||
"Saudi",
|
||||
"Spain",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Terkey",
|
||||
"Uruguay",
|
||||
"USA"
|
||||
"Mat0",
|
||||
"Mat1",
|
||||
"Mat2"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -26202,41 +26143,11 @@
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "Fortnite",
|
||||
"channel": "Parts",
|
||||
"active": "Stage1",
|
||||
"owned": [
|
||||
"Fortnite",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Belgium",
|
||||
"Brazil",
|
||||
"Canada",
|
||||
"Colombia",
|
||||
"Denmark",
|
||||
"Egypt",
|
||||
"England",
|
||||
"France",
|
||||
"Germany",
|
||||
"Iceland",
|
||||
"Italy",
|
||||
"Ireland",
|
||||
"Japan",
|
||||
"Korea",
|
||||
"Mexico",
|
||||
"Netherlands",
|
||||
"NewZealand",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Russia",
|
||||
"Saudi",
|
||||
"Spain",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Terkey",
|
||||
"Uruguay",
|
||||
"USA"
|
||||
"Stage1",
|
||||
"Stage2"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -26251,46 +26162,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "Fortnite",
|
||||
"owned": [
|
||||
"Fortnite",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Belgium",
|
||||
"Brazil",
|
||||
"Canada",
|
||||
"Colombia",
|
||||
"Denmark",
|
||||
"Egypt",
|
||||
"England",
|
||||
"France",
|
||||
"Germany",
|
||||
"Iceland",
|
||||
"Italy",
|
||||
"Ireland",
|
||||
"Japan",
|
||||
"Korea",
|
||||
"Mexico",
|
||||
"Netherlands",
|
||||
"NewZealand",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Russia",
|
||||
"Saudi",
|
||||
"Spain",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Terkey",
|
||||
"Uruguay",
|
||||
"USA"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
@@ -26302,46 +26174,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "Fortnite",
|
||||
"owned": [
|
||||
"Fortnite",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Belgium",
|
||||
"Brazil",
|
||||
"Canada",
|
||||
"Colombia",
|
||||
"Denmark",
|
||||
"Egypt",
|
||||
"England",
|
||||
"France",
|
||||
"Germany",
|
||||
"Iceland",
|
||||
"Italy",
|
||||
"Ireland",
|
||||
"Japan",
|
||||
"Korea",
|
||||
"Mexico",
|
||||
"Netherlands",
|
||||
"NewZealand",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Russia",
|
||||
"Saudi",
|
||||
"Spain",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Terkey",
|
||||
"Uruguay",
|
||||
"USA"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
@@ -26354,43 +26187,20 @@
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "Pattern",
|
||||
"active": "Mat0",
|
||||
"owned": []
|
||||
},
|
||||
{
|
||||
"channel": "Numeric",
|
||||
"active": "Numeric.69",
|
||||
"owned": []
|
||||
},
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "Fortnite",
|
||||
"owned": [
|
||||
"Fortnite",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Belgium",
|
||||
"Brazil",
|
||||
"Canada",
|
||||
"Colombia",
|
||||
"Denmark",
|
||||
"Egypt",
|
||||
"England",
|
||||
"France",
|
||||
"Germany",
|
||||
"Iceland",
|
||||
"Italy",
|
||||
"Ireland",
|
||||
"Japan",
|
||||
"Korea",
|
||||
"Mexico",
|
||||
"Netherlands",
|
||||
"NewZealand",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Russia",
|
||||
"Saudi",
|
||||
"Spain",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Terkey",
|
||||
"Uruguay",
|
||||
"USA"
|
||||
]
|
||||
"active": "Color.Germany",
|
||||
"owned": []
|
||||
}
|
||||
],
|
||||
"favorite": false
|
||||
@@ -26404,46 +26214,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "Fortnite",
|
||||
"owned": [
|
||||
"Fortnite",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Belgium",
|
||||
"Brazil",
|
||||
"Canada",
|
||||
"Colombia",
|
||||
"Denmark",
|
||||
"Egypt",
|
||||
"England",
|
||||
"France",
|
||||
"Germany",
|
||||
"Iceland",
|
||||
"Italy",
|
||||
"Ireland",
|
||||
"Japan",
|
||||
"Korea",
|
||||
"Mexico",
|
||||
"Netherlands",
|
||||
"NewZealand",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Russia",
|
||||
"Saudi",
|
||||
"Spain",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Terkey",
|
||||
"Uruguay",
|
||||
"USA"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
@@ -26456,43 +26227,20 @@
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "Pattern",
|
||||
"active": "Mat0",
|
||||
"owned": []
|
||||
},
|
||||
{
|
||||
"channel": "Numeric",
|
||||
"active": "Numeric.14",
|
||||
"owned": []
|
||||
},
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "Fortnite",
|
||||
"owned": [
|
||||
"Fortnite",
|
||||
"Argentina",
|
||||
"Australia",
|
||||
"Belgium",
|
||||
"Brazil",
|
||||
"Canada",
|
||||
"Colombia",
|
||||
"Denmark",
|
||||
"Egypt",
|
||||
"England",
|
||||
"France",
|
||||
"Germany",
|
||||
"Iceland",
|
||||
"Italy",
|
||||
"Ireland",
|
||||
"Japan",
|
||||
"Korea",
|
||||
"Mexico",
|
||||
"Netherlands",
|
||||
"NewZealand",
|
||||
"Nigeria",
|
||||
"Norway",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Russia",
|
||||
"Saudi",
|
||||
"Spain",
|
||||
"Sweden",
|
||||
"Switzerland",
|
||||
"Terkey",
|
||||
"Uruguay",
|
||||
"USA"
|
||||
]
|
||||
"active": "Color.Terkey",
|
||||
"owned": []
|
||||
}
|
||||
],
|
||||
"favorite": false
|
||||
@@ -27304,51 +27052,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "000",
|
||||
"owned": [
|
||||
"000",
|
||||
"001",
|
||||
"002",
|
||||
"003",
|
||||
"004",
|
||||
"005",
|
||||
"006",
|
||||
"007",
|
||||
"008",
|
||||
"009",
|
||||
"010",
|
||||
"011",
|
||||
"012",
|
||||
"013",
|
||||
"014",
|
||||
"015",
|
||||
"016",
|
||||
"017",
|
||||
"018",
|
||||
"019",
|
||||
"020",
|
||||
"021",
|
||||
"022",
|
||||
"023",
|
||||
"024",
|
||||
"025",
|
||||
"026",
|
||||
"027",
|
||||
"028",
|
||||
"029",
|
||||
"030",
|
||||
"031",
|
||||
"036",
|
||||
"032",
|
||||
"033",
|
||||
"034",
|
||||
"035"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
@@ -27360,51 +27064,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "000",
|
||||
"owned": [
|
||||
"000",
|
||||
"001",
|
||||
"002",
|
||||
"003",
|
||||
"004",
|
||||
"005",
|
||||
"006",
|
||||
"007",
|
||||
"008",
|
||||
"009",
|
||||
"010",
|
||||
"011",
|
||||
"012",
|
||||
"013",
|
||||
"014",
|
||||
"015",
|
||||
"016",
|
||||
"017",
|
||||
"018",
|
||||
"019",
|
||||
"020",
|
||||
"021",
|
||||
"022",
|
||||
"023",
|
||||
"024",
|
||||
"025",
|
||||
"026",
|
||||
"027",
|
||||
"028",
|
||||
"029",
|
||||
"030",
|
||||
"031",
|
||||
"036",
|
||||
"032",
|
||||
"033",
|
||||
"034",
|
||||
"035"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
@@ -27416,51 +27076,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "000",
|
||||
"owned": [
|
||||
"000",
|
||||
"001",
|
||||
"002",
|
||||
"003",
|
||||
"004",
|
||||
"005",
|
||||
"006",
|
||||
"007",
|
||||
"008",
|
||||
"009",
|
||||
"010",
|
||||
"011",
|
||||
"012",
|
||||
"013",
|
||||
"014",
|
||||
"015",
|
||||
"016",
|
||||
"017",
|
||||
"018",
|
||||
"019",
|
||||
"020",
|
||||
"021",
|
||||
"022",
|
||||
"023",
|
||||
"024",
|
||||
"025",
|
||||
"026",
|
||||
"027",
|
||||
"028",
|
||||
"029",
|
||||
"030",
|
||||
"031",
|
||||
"036",
|
||||
"032",
|
||||
"033",
|
||||
"034",
|
||||
"035"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
@@ -27472,51 +27088,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "000",
|
||||
"owned": [
|
||||
"000",
|
||||
"001",
|
||||
"002",
|
||||
"003",
|
||||
"004",
|
||||
"005",
|
||||
"006",
|
||||
"007",
|
||||
"008",
|
||||
"009",
|
||||
"010",
|
||||
"011",
|
||||
"012",
|
||||
"013",
|
||||
"014",
|
||||
"015",
|
||||
"016",
|
||||
"017",
|
||||
"018",
|
||||
"019",
|
||||
"020",
|
||||
"021",
|
||||
"022",
|
||||
"023",
|
||||
"024",
|
||||
"025",
|
||||
"026",
|
||||
"027",
|
||||
"028",
|
||||
"029",
|
||||
"030",
|
||||
"031",
|
||||
"036",
|
||||
"032",
|
||||
"033",
|
||||
"034",
|
||||
"035"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
@@ -27528,51 +27100,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "000",
|
||||
"owned": [
|
||||
"000",
|
||||
"001",
|
||||
"002",
|
||||
"003",
|
||||
"004",
|
||||
"005",
|
||||
"006",
|
||||
"007",
|
||||
"008",
|
||||
"009",
|
||||
"010",
|
||||
"011",
|
||||
"012",
|
||||
"013",
|
||||
"014",
|
||||
"015",
|
||||
"016",
|
||||
"017",
|
||||
"018",
|
||||
"019",
|
||||
"020",
|
||||
"021",
|
||||
"022",
|
||||
"023",
|
||||
"024",
|
||||
"025",
|
||||
"026",
|
||||
"027",
|
||||
"028",
|
||||
"029",
|
||||
"030",
|
||||
"031",
|
||||
"036",
|
||||
"032",
|
||||
"033",
|
||||
"034",
|
||||
"035"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
@@ -27584,51 +27112,7 @@
|
||||
"level": 1,
|
||||
"item_seen": true,
|
||||
"xp": 0,
|
||||
"variants": [
|
||||
{
|
||||
"channel": "JerseyColor",
|
||||
"active": "000",
|
||||
"owned": [
|
||||
"000",
|
||||
"001",
|
||||
"002",
|
||||
"003",
|
||||
"004",
|
||||
"005",
|
||||
"006",
|
||||
"007",
|
||||
"008",
|
||||
"009",
|
||||
"010",
|
||||
"011",
|
||||
"012",
|
||||
"013",
|
||||
"014",
|
||||
"015",
|
||||
"016",
|
||||
"017",
|
||||
"018",
|
||||
"019",
|
||||
"020",
|
||||
"021",
|
||||
"022",
|
||||
"023",
|
||||
"024",
|
||||
"025",
|
||||
"026",
|
||||
"027",
|
||||
"028",
|
||||
"029",
|
||||
"030",
|
||||
"031",
|
||||
"036",
|
||||
"032",
|
||||
"033",
|
||||
"034",
|
||||
"035"
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [],
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
"bEnableDebugLogs": false,
|
||||
"bEnableRebootUser": true,
|
||||
"bEnableCrossBans": false,
|
||||
|
||||
"//": "If you want to use the backend on reboot, leave 3551 as the port",
|
||||
"port": 3551,
|
||||
|
||||
@@ -35,7 +35,9 @@ module.exports = {
|
||||
|
||||
await Users.deleteOne({ username: username });
|
||||
await Profiles.deleteOne({ username: username });
|
||||
await SACCodes.deleteOne({ owneraccountId: accountId });
|
||||
await SACCodes.deleteOne({ owneraccountId: accountId }).catch(error => {
|
||||
// Nothing Uwu or just use: log.debug('No SAC codes found or error occurred:', error);
|
||||
});
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle("Account deleted")
|
||||
|
||||
@@ -36,7 +36,9 @@ module.exports = {
|
||||
|
||||
await Users.deleteOne({ discordId: discordId })
|
||||
await Profiles.deleteOne({ discordId: discordId })
|
||||
await SACCodes.deleteOne({ owneraccountId: accountId });
|
||||
await SACCodes.deleteOne({ owneraccountId: accountId }).catch(error => {
|
||||
// Nothing Uwu or just use: log.debug('No SAC codes found or error occurred:', error);
|
||||
});
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle("Account deleted")
|
||||
|
||||
+53
-1
@@ -1,9 +1,10 @@
|
||||
const { Client, Intents } = require("discord.js");
|
||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS] });
|
||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_BANS] });
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const config = JSON.parse(fs.readFileSync("./Config/config.json").toString());
|
||||
const log = require("../structs/log.js");
|
||||
const Users = require("../model/user.js");
|
||||
|
||||
client.once("ready", () => {
|
||||
log.bot("Bot is up and running!");
|
||||
@@ -46,6 +47,57 @@ client.on("interactionCreate", async interaction => {
|
||||
executeCommand(path.join(__dirname, "commands"), interaction.commandName);
|
||||
});
|
||||
|
||||
client.on("guildBanAdd", async (ban) => {
|
||||
if (!config.bEnableCrossBans)
|
||||
return;
|
||||
|
||||
const memberBan = await ban.fetch();
|
||||
|
||||
if (memberBan.user.bot)
|
||||
return;
|
||||
|
||||
const userData = await Users.findOne({ discordId: memberBan.user.id });
|
||||
|
||||
if (userData && userData.banned !== true) {
|
||||
await userData.updateOne({ $set: { banned: true } });
|
||||
|
||||
let refreshToken = global.refreshTokens.findIndex(i => i.accountId == userData.accountId);
|
||||
|
||||
if (refreshToken != -1)
|
||||
global.refreshTokens.splice(refreshToken, 1);
|
||||
let accessToken = global.accessTokens.findIndex(i => i.accountId == userData.accountId);
|
||||
|
||||
if (accessToken != -1) {
|
||||
global.accessTokens.splice(accessToken, 1);
|
||||
let xmppClient = global.Clients.find(client => client.accountId == userData.accountId);
|
||||
if (xmppClient)
|
||||
xmppClient.client.close();
|
||||
}
|
||||
|
||||
if (accessToken != -1 || refreshToken != -1) {
|
||||
await functions.UpdateTokens();
|
||||
}
|
||||
|
||||
log.debug(`user ${memberBan.user.username} (ID: ${memberBan.user.id}) was banned on the discord and also in the game (Cross Ban active).`);
|
||||
}
|
||||
});
|
||||
|
||||
client.on("guildBanRemove", async (ban) => {
|
||||
if (!config.bEnableCrossBans)
|
||||
return;
|
||||
|
||||
if (ban.user.bot)
|
||||
return;
|
||||
|
||||
const userData = await Users.findOne({ discordId: ban.user.id });
|
||||
|
||||
if (userData && userData.banned === true) {
|
||||
await userData.updateOne({ $set: { banned: false } });
|
||||
|
||||
log.debug(`User ${ban.user.username} (ID: ${ban.user.id}) is now unbanned.`);
|
||||
}
|
||||
});
|
||||
|
||||
//AntiCrash System
|
||||
client.on("error", (err) => {
|
||||
console.log("Discord API Error:", err);
|
||||
|
||||
@@ -47,13 +47,20 @@ global.kv = kv;
|
||||
|
||||
global.exchangeCodes = [];
|
||||
|
||||
let updateFound = false;
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, "./package.json")).toString());
|
||||
if (!packageJson) throw new Error("Failed to parse package.json");
|
||||
const version = packageJson.version;
|
||||
|
||||
const checkUpdates = async () => {
|
||||
if (updateFound) return;
|
||||
|
||||
try {
|
||||
await CheckForUpdate.checkForUpdate(version);
|
||||
const updateAvailable = await CheckForUpdate.checkForUpdate(version);
|
||||
if (updateAvailable) {
|
||||
updateFound = true;
|
||||
}
|
||||
} catch (err) {
|
||||
log.error("Failed to check for updates");
|
||||
}
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "reloadbackend",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "reloadbackend",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"axios": "^1.7.7",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "reloadbackend",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Created by Burlone, This is a modded backend, all main backend credits to lawin",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
||||
+1
-2
@@ -217,8 +217,7 @@ app.post("/api/v1/assets/Fortnite/*/*", async (req, res) => {
|
||||
if (req.body.hasOwnProperty("FortCreativeDiscoverySurface") && req.body.FortCreativeDiscoverySurface == 0) {
|
||||
const discovery_api_assets = require("./../responses/Discovery/discovery_api_assets.json");
|
||||
res.json(discovery_api_assets)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
res.json({
|
||||
"FortCreativeDiscoverySurface": {
|
||||
"meta": {
|
||||
|
||||
+1
-1
@@ -128,4 +128,4 @@ app.post("/fortnite/api/game/v2/toxicity/account/:unsafeReporter/report/:reporte
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
module.exports = app;
|
||||
@@ -3,16 +3,44 @@ const fetch = require("node-fetch");
|
||||
|
||||
class CheckForUpdate {
|
||||
static async checkForUpdate(currentVersion) {
|
||||
const packageJson = await fetch('https://raw.githubusercontent.com/Project-Reload/Reload-Backend/refs/heads/main/package.json')
|
||||
.then(res => res.json());
|
||||
try {
|
||||
const response = await fetch('https://raw.githubusercontent.com/Project-Reload/Reload-Backend/main/package.json');
|
||||
if (!response.ok) {
|
||||
log.error(`Failed to fetch package.json. Status: ${response.status}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const latestVersion = packageJson.version.replace(/\./g, "");
|
||||
const currentVersionFormatted = currentVersion.replace(/\./g, "");
|
||||
const packageJson = await response.json();
|
||||
const latestVersion = packageJson.version;
|
||||
|
||||
if (parseFloat(latestVersion) > parseFloat(currentVersionFormatted)) {
|
||||
log.checkforupdate(`A new version of the Backend has been released! ${currentVersion} -> ${packageJson.version}, Download it from the GitHub repo.`);
|
||||
if (isNewerVersion(latestVersion, currentVersion)) {
|
||||
log.checkforupdate(`A new version of the Backend has been released! ${currentVersion} -> ${latestVersion}, Download it from the GitHub repo.`);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (error) {
|
||||
log.error(`Error while checking for updates: ${error.message}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isNewerVersion(latest, current) {
|
||||
const latestParts = latest.split('.').map(Number);
|
||||
const currentParts = current.split('.').map(Number);
|
||||
|
||||
for (let i = 0; i < latestParts.length; i++) {
|
||||
if (latestParts[i] > (currentParts[i] || 0)) {
|
||||
return true;
|
||||
} else if (latestParts[i] < (currentParts[i] || 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = CheckForUpdate;
|
||||
Reference in New Issue
Block a user