Improve lots of stuff

This commit is contained in:
Lawin0129
2021-12-17 00:27:42 +00:00
parent 9c38004709
commit 689a064ddd
4 changed files with 263 additions and 741 deletions

View File

@@ -4,6 +4,8 @@
"daily2": "", "daily2": "",
"daily3": "", "daily3": "",
"daily4": "", "daily4": "",
"daily5": "",
"daily6": "",
"featured1": "", "featured1": "",
"featured2": "" "featured2": ""
} }

924
index.js

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,6 @@
{ {
"season": 15, "season": 0,
"lobby": "LobbySeason15" "build": 0.0,
"CL": "",
"lobby": "LobbySeason0"
} }

View File

@@ -1,46 +1,54 @@
function CheckLobbyAndSeason(req, seasondata) { function CheckLobbyAndSeason(req, seasondata) {
// Works perfectly fine for any version if (req.headers["user-agent"])
if (req.headers["user-agent"])
{ {
var season = req.headers["user-agent"].slice(28, 30) var CL = "";
var seasonInt = Number(season)
if (!Number.isNaN(seasonInt)) if (req.headers["user-agent"]) {
{ try {
seasondata.season = seasonInt; var BuildID = req.headers["user-agent"].split("-")[3].split(",")[0]
seasondata.lobby = `LobbySeason${seasonInt}`; if (!Number.isNaN(Number(BuildID))) {
CL = BuildID;
}
if (Number.isNaN(Number(BuildID))) {
var BuildID = req.headers["user-agent"].split("-")[3].split(" ")[0]
if (!Number.isNaN(Number(BuildID))) {
CL = BuildID;
}
}
} catch (err) {
try {
var BuildID = req.headers["user-agent"].split("-")[1].split("+")[0]
if (!Number.isNaN(Number(BuildID))) {
CL = BuildID;
}
} catch (err) {}
}
} }
if (Number.isNaN(seasonInt)) try {
{ var Build = req.headers["user-agent"].split("Release-")[1].split("-")[0];
var season = req.headers["user-agent"].slice(32, 34)
var seasonInt = Number(season)
if (!Number.isNaN(seasonInt)) if (Build.split(".").length == 3) {
{ Value = Build.split(".");
seasondata.season = seasonInt; Build = Value[0] + "." + Value[1] + Value[2];
seasondata.lobby = `LobbySeason${seasonInt}`;
} }
if (Number.isNaN(seasonInt)) seasondata.season = Number(Build.split(".")[0]);
{ seasondata.build = Number(Build);
var season = req.headers["user-agent"].slice(52, 54) seasondata.CL = CL;
var seasonInt = Number(season) seasondata.lobby = `LobbySeason${seasondata.season}`;
if (!Number.isNaN(seasonInt)) if (Number.isNaN(seasondata.season)) {
{ throw new Error();
seasondata.season = seasonInt;
seasondata.lobby = `LobbySeason${seasonInt}`;
}
if (Number.isNaN(seasonInt))
{
seasondata.season = 2;
seasondata.lobby = "LobbyWinterDecor";
}
} }
} catch (err) {
seasondata.season = 2;
seasondata.build = 2.0;
seasondata.CL = CL;
seasondata.lobby = "LobbyWinterDecor";
} }
} }
} }
module.exports = CheckLobbyAndSeason; module.exports = CheckLobbyAndSeason;