Add proper SAC support and fix getTheater

This commit is contained in:
Lawin0129
2021-12-25 19:30:24 +00:00
parent aaee3529e9
commit 641c5af4df
2 changed files with 29 additions and 15 deletions

View File

@@ -172,15 +172,19 @@ express.get("/socialban/api/public/v1/*", async (req, res) => {
}) })
express.get("/affiliate/api/public/affiliates/slug/:slug", async (req, res) => { express.get("/affiliate/api/public/affiliates/slug/:slug", async (req, res) => {
if (req.params.slug.toLowerCase() == "lawin") { const SupportedCodes = require("./responses/SAC.json");
return res.json({ SupportedCodes.forEach(code => {
"id": "Lawin", if (req.params.slug.toLowerCase() == code.toLowerCase()) {
"slug": "lawin", return res.json({
"displayName": "Lawin", "id": code,
"status": "ACTIVE", "slug": code,
"verified": false "displayName": code,
}); "status": "ACTIVE",
} "verified": false
});
}
})
res.status(404); res.status(404);
res.json({}); res.json({});
}) })
@@ -1214,11 +1218,14 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetAffiliateName", async (r
var QueryRevision = req.query.rvn || -1; var QueryRevision = req.query.rvn || -1;
var StatChanged = false; var StatChanged = false;
if (req.body.affiliateName.toLowerCase() == "lawin") { const SupportedCodes = require("./responses/SAC.json");
profile.stats.attributes.mtx_affiliate_set_time = new Date().toISOString(); SupportedCodes.forEach(code => {
profile.stats.attributes.mtx_affiliate = req.body.affiliateName; if (req.body.affiliateName.toLowerCase() == code.toLowerCase() || req.body.affiliateName == "") {
StatChanged = true; profile.stats.attributes.mtx_affiliate_set_time = new Date().toISOString();
} profile.stats.attributes.mtx_affiliate = req.body.affiliateName;
StatChanged = true;
}
})
if (StatChanged == true) { if (StatChanged == true) {
profile.rvn += 1; profile.rvn += 1;
@@ -5754,7 +5761,7 @@ function getTheater(req) {
try { try {
if (seasondata.season >= 16 || seasondata.build == 15.30 || seasondata.build == 15.40 || seasondata.build == 15.50) { if (seasondata.season >= 16 || seasondata.build == 15.30 || seasondata.build == 15.40 || seasondata.build == 15.50) {
theater = theater.replaceAll(/\/Game\//g, "\/SaveTheWorld\/"); theater = theater.replace(/\/Game\//ig, "\/SaveTheWorld\/");
} }
} catch (err) {} } catch (err) {}

7
responses/SAC.json Normal file
View File

@@ -0,0 +1,7 @@
[
"lawin",
"ti93",
"pro100katyt",
"playeereq",
"matteoki"
]